explorer: add support for more serum instructions (#21451)
This commit is contained in:
parent
7aad6fa6a6
commit
04551183a5
|
@ -6,15 +6,22 @@ import { reportError } from "utils/sentry";
|
|||
import {
|
||||
decodeCancelOrder,
|
||||
decodeCancelOrderByClientId,
|
||||
decodeCancelOrderByClientIdV2,
|
||||
decodeCancelOrderV2,
|
||||
decodeCloseOpenOrders,
|
||||
decodeConsumeEvents,
|
||||
decodeConsumeEventsPermissioned,
|
||||
decodeDisableMarket,
|
||||
decodeInitializeMarket,
|
||||
decodeInitOpenOrders,
|
||||
decodeMatchOrders,
|
||||
decodeNewOrder,
|
||||
decodeNewOrderV3,
|
||||
decodePrune,
|
||||
decodeSettleFunds,
|
||||
parseSerumInstructionCode,
|
||||
decodeSweepFees,
|
||||
parseSerumInstructionKey,
|
||||
parseSerumInstructionTitle,
|
||||
SERUM_DECODED_MAX,
|
||||
} from "./serum/types";
|
||||
import { NewOrderDetailsCard } from "./serum/NewOrderDetailsCard";
|
||||
import { MatchOrdersDetailsCard } from "./serum/MatchOrdersDetailsCard";
|
||||
|
@ -23,6 +30,15 @@ import { ConsumeEventsDetailsCard } from "./serum/ConsumeEventsDetails";
|
|||
import { CancelOrderDetailsCard } from "./serum/CancelOrderDetails";
|
||||
import { CancelOrderByClientIdDetailsCard } from "./serum/CancelOrderByClientIdDetails";
|
||||
import { SettleFundsDetailsCard } from "./serum/SettleFundsDetailsCard";
|
||||
import { DisableMarketDetailsCard } from "./serum/DisableMarketDetails";
|
||||
import { SweepFeesDetailsCard } from "./serum/SweepFeesDetails";
|
||||
import { NewOrderV3DetailsCard } from "./serum/NewOrderV3DetailsCard";
|
||||
import { CancelOrderV2DetailsCard } from "./serum/CancelOrderV2Details";
|
||||
import { CancelOrderByClientIdV2DetailsCard } from "./serum/CancelOrderByClientIdV2Details";
|
||||
import { CloseOpenOrdersDetailsCard } from "./serum/CloseOpenOrdersDetails";
|
||||
import { InitOpenOrdersDetailsCard } from "./serum/InitOpenOrdersDetails";
|
||||
import { PruneDetailsCard } from "./serum/PruneDetails";
|
||||
import { ConsumeEventsPermissionedDetailsCard } from "./serum/ConsumeEventsPermissionedDetails";
|
||||
|
||||
export function SerumDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
|
@ -39,46 +55,81 @@ export function SerumDetailsCard(props: {
|
|||
let title;
|
||||
try {
|
||||
title = parseSerumInstructionTitle(ix);
|
||||
const code = parseSerumInstructionCode(ix);
|
||||
|
||||
if (code <= SERUM_DECODED_MAX) {
|
||||
switch (parseSerumInstructionKey(ix)) {
|
||||
case "initializeMarket":
|
||||
return (
|
||||
<InitializeMarketDetailsCard
|
||||
info={decodeInitializeMarket(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "newOrder":
|
||||
return <NewOrderDetailsCard info={decodeNewOrder(ix)} {...props} />;
|
||||
case "matchOrders":
|
||||
return (
|
||||
<MatchOrdersDetailsCard info={decodeMatchOrders(ix)} {...props} />
|
||||
);
|
||||
case "consumeEvents":
|
||||
return (
|
||||
<ConsumeEventsDetailsCard
|
||||
info={decodeConsumeEvents(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "cancelOrder":
|
||||
return (
|
||||
<CancelOrderDetailsCard info={decodeCancelOrder(ix)} {...props} />
|
||||
);
|
||||
case "cancelOrderByClientId":
|
||||
return (
|
||||
<CancelOrderByClientIdDetailsCard
|
||||
info={decodeCancelOrderByClientId(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "settleFunds":
|
||||
return (
|
||||
<SettleFundsDetailsCard info={decodeSettleFunds(ix)} {...props} />
|
||||
);
|
||||
}
|
||||
switch (parseSerumInstructionKey(ix)) {
|
||||
case "initializeMarket":
|
||||
return (
|
||||
<InitializeMarketDetailsCard
|
||||
info={decodeInitializeMarket(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "newOrder":
|
||||
return <NewOrderDetailsCard info={decodeNewOrder(ix)} {...props} />;
|
||||
case "matchOrders":
|
||||
return (
|
||||
<MatchOrdersDetailsCard info={decodeMatchOrders(ix)} {...props} />
|
||||
);
|
||||
case "consumeEvents":
|
||||
return (
|
||||
<ConsumeEventsDetailsCard info={decodeConsumeEvents(ix)} {...props} />
|
||||
);
|
||||
case "cancelOrder":
|
||||
return (
|
||||
<CancelOrderDetailsCard info={decodeCancelOrder(ix)} {...props} />
|
||||
);
|
||||
case "settleFunds":
|
||||
return (
|
||||
<SettleFundsDetailsCard info={decodeSettleFunds(ix)} {...props} />
|
||||
);
|
||||
case "cancelOrderByClientId":
|
||||
return (
|
||||
<CancelOrderByClientIdDetailsCard
|
||||
info={decodeCancelOrderByClientId(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "disableMarket":
|
||||
return (
|
||||
<DisableMarketDetailsCard info={decodeDisableMarket(ix)} {...props} />
|
||||
);
|
||||
case "sweepFees":
|
||||
return <SweepFeesDetailsCard info={decodeSweepFees(ix)} {...props} />;
|
||||
case "newOrderV3":
|
||||
return <NewOrderV3DetailsCard info={decodeNewOrderV3(ix)} {...props} />;
|
||||
case "cancelOrderV2":
|
||||
return (
|
||||
<CancelOrderV2DetailsCard info={decodeCancelOrderV2(ix)} {...props} />
|
||||
);
|
||||
case "cancelOrderByClientIdV2":
|
||||
return (
|
||||
<CancelOrderByClientIdV2DetailsCard
|
||||
info={decodeCancelOrderByClientIdV2(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "closeOpenOrders":
|
||||
return (
|
||||
<CloseOpenOrdersDetailsCard
|
||||
info={decodeCloseOpenOrders(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "initOpenOrders":
|
||||
return (
|
||||
<InitOpenOrdersDetailsCard
|
||||
info={decodeInitOpenOrders(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
case "prune":
|
||||
return <PruneDetailsCard info={decodePrune(ix)} {...props} />;
|
||||
case "consumeEventsPermissioned":
|
||||
return (
|
||||
<ConsumeEventsPermissionedDetailsCard
|
||||
info={decodeConsumeEventsPermissioned(ix)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
reportError(error, {
|
||||
|
|
|
@ -26,34 +26,34 @@ export function CancelOrderByClientIdDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.openOrders} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Request Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.requestQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Owner</td>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.owner} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Client Id</td>
|
||||
<td className="text-lg-right">{info.clientId.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.clientId.toString(10)}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CancelOrderByClientIdV2 } from "./types";
|
||||
|
||||
export function CancelOrderByClientIdV2DetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CancelOrderByClientIdV2;
|
||||
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 By Client Id v2"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bids</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.bids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Asks</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Client Id</td>
|
||||
<td className="text-lg-right">{info.data.clientId.toString(10)}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -33,44 +33,44 @@ export function CancelOrderDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.openOrders} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Request Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.owner} alignRight link />
|
||||
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Side</td>
|
||||
<td className="text-lg-right">{info.side}</td>
|
||||
<td className="text-lg-right">{info.data.side}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Slot</td>
|
||||
<td className="text-lg-right">{info.openOrdersSlot}</td>
|
||||
<td className="text-lg-right">{info.data.openOrdersSlot}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Order Id</td>
|
||||
<td className="text-lg-right">{info.orderId.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.orderId.toString(10)}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CancelOrderV2 } from "./types";
|
||||
|
||||
export function CancelOrderV2DetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CancelOrderV2;
|
||||
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 v2"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bids</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.bids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Asks</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Side</td>
|
||||
<td className="text-lg-right">{info.data.side}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Order Id</td>
|
||||
<td className="text-lg-right">{info.data.orderId.toString(10)}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { CloseOpenOrders } from "./types";
|
||||
|
||||
export function CloseOpenOrdersDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: CloseOpenOrders;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Close Open Orders"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Rent Receiver</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.rentReceiver} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -33,21 +33,21 @@ export function ConsumeEventsDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.eventQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Accounts</td>
|
||||
<td className="text-lg-right">
|
||||
{info.openOrdersAccounts.map((account, index) => {
|
||||
{info.accounts.openOrders.map((account, index) => {
|
||||
return <Address pubkey={account} key={index} alignRight link />;
|
||||
})}
|
||||
</td>
|
||||
|
@ -55,7 +55,7 @@ export function ConsumeEventsDetailsCard(props: {
|
|||
|
||||
<tr>
|
||||
<td>Limit</td>
|
||||
<td className="text-lg-right">{info.limit}</td>
|
||||
<td className="text-lg-right">{info.data.limit}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { ConsumeEventsPermissioned } from "./types";
|
||||
|
||||
export function ConsumeEventsPermissionedDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: ConsumeEventsPermissioned;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Consume Events Permissioned"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Crank Authority</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.crankAuthority} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Accounts</td>
|
||||
<td className="text-lg-right">
|
||||
{info.accounts.openOrders.map((account, index) => {
|
||||
return <Address pubkey={account} key={index} alignRight link />;
|
||||
})}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Limit</td>
|
||||
<td className="text-lg-right">{info.data.limit}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { DisableMarket } from "./types";
|
||||
|
||||
export function DisableMarketDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: DisableMarket;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Disable Market"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Disable Authority</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.disableAuthority} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { InitOpenOrders } from "./types";
|
||||
|
||||
export function InitOpenOrdersDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: InitOpenOrders;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Init Open Orders"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{info.accounts.openOrdersMarketAuthority && (
|
||||
<tr>
|
||||
<td>Open Orders Market Authority</td>
|
||||
<td className="text-lg-right">
|
||||
<Address
|
||||
pubkey={info.accounts.openOrdersMarketAuthority}
|
||||
alignRight
|
||||
link
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -33,91 +33,93 @@ export function InitializeMarketDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Request Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.requestQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.eventQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bids</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.bids} alignRight link />
|
||||
<Address pubkey={info.accounts.bids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Asks</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.asks} alignRight link />
|
||||
<Address pubkey={info.accounts.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.baseVault} alignRight link />
|
||||
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.quoteVault} alignRight link />
|
||||
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Mint</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.baseMint} alignRight link />
|
||||
<Address pubkey={info.accounts.baseMint} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Mint</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.quoteMint} alignRight link />
|
||||
<Address pubkey={info.accounts.quoteMint} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Lot Size</td>
|
||||
<td className="text-lg-right">{info.baseLotSize.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.baseLotSize.toString(10)}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Lot Size</td>
|
||||
<td className="text-lg-right">{info.quoteLotSize.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.quoteLotSize.toString(10)}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fee Rate Bps</td>
|
||||
<td className="text-lg-right">{info.feeRateBps}</td>
|
||||
<td className="text-lg-right">{info.data.feeRateBps}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Dust Threshold</td>
|
||||
<td className="text-lg-right">
|
||||
{info.quoteDustThreshold.toString(10)}
|
||||
{info.data.quoteDustThreshold.toString(10)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Vault Signer Nonce</td>
|
||||
<td className="text-lg-right">{info.vaultSignerNonce.toString(10)}</td>
|
||||
<td className="text-lg-right">
|
||||
{info.data.vaultSignerNonce.toString(10)}
|
||||
</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
|
|
|
@ -33,55 +33,41 @@ export function MatchOrdersDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Request Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.requestQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.eventQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bids</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.bids} alignRight link />
|
||||
<Address pubkey={info.accounts.bids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Asks</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.baseVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.quoteVault} alignRight link />
|
||||
<Address pubkey={info.accounts.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Limit</td>
|
||||
<td className="text-lg-right">{info.limit}</td>
|
||||
<td className="text-lg-right">{info.data.limit}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
|
|
|
@ -33,75 +33,75 @@ export function NewOrderDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.openOrders} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Request Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.requestQueue} alignRight link />
|
||||
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Payer</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.payer} alignRight link />
|
||||
<Address pubkey={info.accounts.payer} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Owner</td>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.owner} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.baseVault} alignRight link />
|
||||
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.quoteVault} alignRight link />
|
||||
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Side</td>
|
||||
<td className="text-lg-right">{info.side}</td>
|
||||
<td className="text-lg-right">{info.data.side}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Order Type</td>
|
||||
<td className="text-lg-right">{info.orderType}</td>
|
||||
<td className="text-lg-right">{info.data.orderType}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Limit Price</td>
|
||||
<td className="text-lg-right">{info.limitPrice.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.limitPrice.toString(10)}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Max Quantity</td>
|
||||
<td className="text-lg-right">{info.maxQuantity.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.maxQuantity.toString(10)}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Client Id</td>
|
||||
<td className="text-lg-right">{info.clientId.toString(10)}</td>
|
||||
<td className="text-lg-right">{info.data.clientId.toString(10)}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { NewOrderV3 } from "./types";
|
||||
|
||||
export function NewOrderV3DetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: NewOrderV3;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: New Order v3"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Request Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bids</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.bids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Asks</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Payer</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.payer} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{info.accounts.feeDiscountPubkey && (
|
||||
<tr>
|
||||
<td>Fee Discount</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.feeDiscountPubkey} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
|
||||
<tr>
|
||||
<td>Side</td>
|
||||
<td className="text-lg-right">{info.data.side.toUpperCase()}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Order Type</td>
|
||||
<td className="text-lg-right">{info.data.orderType}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Limit Price</td>
|
||||
<td className="text-lg-right">{info.data.limitPrice.toString(10)}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Max Base Quantity</td>
|
||||
<td className="text-lg-right">
|
||||
{info.data.maxBaseQuantity.toString(10)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Max Quote Quantity</td>
|
||||
<td className="text-lg-right">
|
||||
{info.data.maxQuoteQuantity.toString(10)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Client Id</td>
|
||||
<td className="text-lg-right">{info.data.clientId.toString(10)}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Match Iteration Limit</td>
|
||||
<td className="text-lg-right">{info.data.limit}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { Prune } from "./types";
|
||||
|
||||
export function PruneDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: Prune;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Prune"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Bids</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.bids} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Asks</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.asks} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Prune Authority</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.pruneAuthority} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Event Queue</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Iteration Limit</td>
|
||||
<td className="text-lg-right">{info.data.limit}</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -33,64 +33,68 @@ export function SettleFundsDetailsCard(props: {
|
|||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.market} alignRight link />
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Open Orders</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.openOrders} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Owner</td>
|
||||
<td>Open Orders Owner</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.owner} alignRight link />
|
||||
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.baseVault} alignRight link />
|
||||
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.quoteVault} alignRight link />
|
||||
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Base Wallet</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.baseWallet} alignRight link />
|
||||
<Address pubkey={info.accounts.baseWallet} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Wallet</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.quoteWallet} alignRight link />
|
||||
<Address pubkey={info.accounts.quoteWallet} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Vault Signer</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.vaultSigner} alignRight link />
|
||||
<Address pubkey={info.accounts.vaultSigner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{info.referrerQuoteWallet && (
|
||||
{info.accounts.referrerQuoteWallet && (
|
||||
<tr>
|
||||
<td>Referrer Quote Wallet</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.referrerQuoteWallet} alignRight link />
|
||||
<Address
|
||||
pubkey={info.accounts.referrerQuoteWallet}
|
||||
alignRight
|
||||
link
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
import React from "react";
|
||||
import { SignatureResult, TransactionInstruction } from "@solana/web3.js";
|
||||
import { InstructionCard } from "../InstructionCard";
|
||||
import { Address } from "components/common/Address";
|
||||
import { SweepFees } from "./types";
|
||||
|
||||
export function SweepFeesDetailsCard(props: {
|
||||
ix: TransactionInstruction;
|
||||
index: number;
|
||||
result: SignatureResult;
|
||||
info: SweepFees;
|
||||
innerCards?: JSX.Element[];
|
||||
childIndex?: number;
|
||||
}) {
|
||||
const { ix, index, result, info, innerCards, childIndex } = props;
|
||||
|
||||
return (
|
||||
<InstructionCard
|
||||
ix={ix}
|
||||
index={index}
|
||||
result={result}
|
||||
title="Serum Program: Sweep Fees"
|
||||
innerCards={innerCards}
|
||||
childIndex={childIndex}
|
||||
>
|
||||
<tr>
|
||||
<td>Program</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.programId} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Market</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.market} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Quote Vault</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fee Sweeping Authority</td>
|
||||
<td className="text-lg-right">
|
||||
<Address
|
||||
pubkey={info.accounts.feeSweepingAuthority}
|
||||
alignRight
|
||||
link
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Fee Receiver</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.quoteFeeReceiver} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Vault Signer</td>
|
||||
<td className="text-lg-right">
|
||||
<Address pubkey={info.accounts.vaultSigner} alignRight link />
|
||||
</td>
|
||||
</tr>
|
||||
</InstructionCard>
|
||||
);
|
||||
}
|
|
@ -1,11 +1,13 @@
|
|||
/* eslint-disable @typescript-eslint/no-redeclare */
|
||||
|
||||
import { decodeInstruction, MARKETS } from "@project-serum/serum";
|
||||
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import { enums, number, optional, type, Infer, create } from "superstruct";
|
||||
import {
|
||||
AccountMeta,
|
||||
PublicKey,
|
||||
TransactionInstruction,
|
||||
} from "@solana/web3.js";
|
||||
import { enums, number, type, Infer, create } from "superstruct";
|
||||
import { BigNumFromString } from "validators/bignum";
|
||||
import { PublicKeyFromString } from "validators/pubkey";
|
||||
|
||||
const SERUM_PROGRAM_IDS = [
|
||||
"4ckmDgGdxQoPDLUkDT3vHgSAkzA3QRdNq5ywwY4sUSJn",
|
||||
|
@ -20,25 +22,44 @@ export const Side = enums(["buy", "sell"]);
|
|||
export type OrderType = Infer<typeof OrderType>;
|
||||
export const OrderType = enums(["limit", "ioc", "postOnly"]);
|
||||
|
||||
export type SelfTradeBehavior = Infer<typeof SelfTradeBehavior>;
|
||||
export const SelfTradeBehavior = enums([
|
||||
"decrementTake",
|
||||
"cancelProvide",
|
||||
"abortTransaction",
|
||||
]);
|
||||
|
||||
function getOptionalKey(
|
||||
keys: AccountMeta[],
|
||||
index: number
|
||||
): PublicKey | undefined {
|
||||
if (index < keys.length) {
|
||||
return keys[index].pubkey;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
export type InitializeMarket = {
|
||||
market: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
baseMint: PublicKey;
|
||||
quoteMint: PublicKey;
|
||||
baseLotSize: BN;
|
||||
quoteLotSize: BN;
|
||||
feeRateBps: number;
|
||||
vaultSignerNonce: BN;
|
||||
quoteDustThreshold: BN;
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof InitializeMarketInstruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
baseMint: PublicKey;
|
||||
quoteMint: PublicKey;
|
||||
openOrdersMarketAuthority?: PublicKey;
|
||||
pruneAuthority?: PublicKey;
|
||||
crankAuthority?: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const InitializeMarketDecode = type({
|
||||
export const InitializeMarketInstruction = type({
|
||||
baseLotSize: BigNumFromString,
|
||||
quoteLotSize: BigNumFromString,
|
||||
feeRateBps: number(),
|
||||
|
@ -49,251 +70,506 @@ export const InitializeMarketDecode = type({
|
|||
export function decodeInitializeMarket(
|
||||
ix: TransactionInstruction
|
||||
): InitializeMarket {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data).initializeMarket,
|
||||
InitializeMarketDecode
|
||||
);
|
||||
|
||||
let initializeMarket: InitializeMarket = {
|
||||
market: ix.keys[0].pubkey,
|
||||
requestQueue: ix.keys[1].pubkey,
|
||||
eventQueue: ix.keys[2].pubkey,
|
||||
bids: ix.keys[3].pubkey,
|
||||
asks: ix.keys[4].pubkey,
|
||||
baseVault: ix.keys[5].pubkey,
|
||||
quoteVault: ix.keys[6].pubkey,
|
||||
baseMint: ix.keys[7].pubkey,
|
||||
quoteMint: ix.keys[8].pubkey,
|
||||
return {
|
||||
programId: ix.programId,
|
||||
baseLotSize: decoded.baseLotSize as BN,
|
||||
quoteLotSize: decoded.quoteLotSize as BN,
|
||||
feeRateBps: decoded.feeRateBps,
|
||||
quoteDustThreshold: decoded.quoteDustThreshold as BN,
|
||||
vaultSignerNonce: decoded.vaultSignerNonce as BN,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).initializeMarket,
|
||||
InitializeMarketInstruction
|
||||
),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
requestQueue: ix.keys[1].pubkey,
|
||||
eventQueue: ix.keys[2].pubkey,
|
||||
bids: ix.keys[3].pubkey,
|
||||
asks: ix.keys[4].pubkey,
|
||||
baseVault: ix.keys[5].pubkey,
|
||||
quoteVault: ix.keys[6].pubkey,
|
||||
baseMint: ix.keys[7].pubkey,
|
||||
quoteMint: ix.keys[8].pubkey,
|
||||
openOrdersMarketAuthority: getOptionalKey(ix.keys, 10),
|
||||
pruneAuthority: getOptionalKey(ix.keys, 11),
|
||||
crankAuthority: getOptionalKey(ix.keys, 12),
|
||||
},
|
||||
};
|
||||
|
||||
return initializeMarket;
|
||||
}
|
||||
|
||||
export type NewOrder = {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
payer: PublicKey;
|
||||
owner: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
programId: PublicKey;
|
||||
feeDiscountPubkey?: PublicKey;
|
||||
side: Side;
|
||||
limitPrice: BN;
|
||||
maxQuantity: BN;
|
||||
orderType: OrderType;
|
||||
clientId: BN;
|
||||
data: Infer<typeof NewOrderInstruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
payer: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
feeDiscountPubkey?: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const NewOrderDecode = type({
|
||||
export const NewOrderInstruction = type({
|
||||
side: Side,
|
||||
limitPrice: BigNumFromString,
|
||||
maxQuantity: BigNumFromString,
|
||||
orderType: OrderType,
|
||||
clientId: BigNumFromString,
|
||||
feeDiscountPubkey: optional(PublicKeyFromString),
|
||||
});
|
||||
|
||||
export function decodeNewOrder(ix: TransactionInstruction): NewOrder {
|
||||
const decoded = create(decodeInstruction(ix.data).newOrder, NewOrderDecode);
|
||||
|
||||
let newOrder: NewOrder = {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
payer: ix.keys[3].pubkey,
|
||||
owner: ix.keys[4].pubkey,
|
||||
baseVault: ix.keys[5].pubkey,
|
||||
quoteVault: ix.keys[6].pubkey,
|
||||
return {
|
||||
programId: ix.programId,
|
||||
side: decoded.side as Side,
|
||||
limitPrice: decoded.limitPrice as BN,
|
||||
maxQuantity: decoded.maxQuantity as BN,
|
||||
orderType: decoded.orderType as OrderType,
|
||||
clientId: decoded.clientId as BN,
|
||||
data: create(decodeInstruction(ix.data).newOrder, NewOrderInstruction),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
payer: ix.keys[3].pubkey,
|
||||
openOrdersOwner: ix.keys[4].pubkey,
|
||||
baseVault: ix.keys[5].pubkey,
|
||||
quoteVault: ix.keys[6].pubkey,
|
||||
feeDiscountPubkey: getOptionalKey(ix.keys, 9),
|
||||
},
|
||||
};
|
||||
|
||||
if (decoded.feeDiscountPubkey) {
|
||||
newOrder.feeDiscountPubkey = decoded.feeDiscountPubkey;
|
||||
}
|
||||
|
||||
return newOrder;
|
||||
}
|
||||
|
||||
export type MatchOrders = {
|
||||
market: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
limit: number;
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof MatchOrdersInstruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const MatchOrdersDecode = type({
|
||||
export const MatchOrdersInstruction = type({
|
||||
limit: number(),
|
||||
});
|
||||
|
||||
export function decodeMatchOrders(ix: TransactionInstruction): MatchOrders {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data).matchOrders,
|
||||
MatchOrdersDecode
|
||||
);
|
||||
|
||||
const matchOrders: MatchOrders = {
|
||||
market: ix.keys[0].pubkey,
|
||||
requestQueue: ix.keys[1].pubkey,
|
||||
eventQueue: ix.keys[2].pubkey,
|
||||
bids: ix.keys[3].pubkey,
|
||||
asks: ix.keys[4].pubkey,
|
||||
baseVault: ix.keys[5].pubkey,
|
||||
quoteVault: ix.keys[6].pubkey,
|
||||
return {
|
||||
programId: ix.programId,
|
||||
limit: decoded.limit,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).matchOrders,
|
||||
MatchOrdersInstruction
|
||||
),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
requestQueue: ix.keys[1].pubkey,
|
||||
eventQueue: ix.keys[2].pubkey,
|
||||
bids: ix.keys[3].pubkey,
|
||||
asks: ix.keys[4].pubkey,
|
||||
},
|
||||
};
|
||||
|
||||
return matchOrders;
|
||||
}
|
||||
|
||||
export type ConsumeEvents = {
|
||||
market: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
openOrdersAccounts: PublicKey[];
|
||||
limit: number;
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof ConsumeEventsInstruction>;
|
||||
accounts: {
|
||||
openOrders: PublicKey[];
|
||||
market: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const ConsumeEventsDecode = type({
|
||||
export const ConsumeEventsInstruction = type({
|
||||
limit: number(),
|
||||
});
|
||||
|
||||
export function decodeConsumeEvents(ix: TransactionInstruction): ConsumeEvents {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data).consumeEvents,
|
||||
ConsumeEventsDecode
|
||||
);
|
||||
|
||||
const consumeEvents: ConsumeEvents = {
|
||||
openOrdersAccounts: ix.keys.slice(0, -2).map((k) => k.pubkey),
|
||||
market: ix.keys[ix.keys.length - 2].pubkey,
|
||||
eventQueue: ix.keys[ix.keys.length - 3].pubkey,
|
||||
return {
|
||||
programId: ix.programId,
|
||||
limit: decoded.limit,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).consumeEvents,
|
||||
ConsumeEventsInstruction
|
||||
),
|
||||
accounts: {
|
||||
openOrders: ix.keys.slice(0, -4).map((k) => k.pubkey),
|
||||
market: ix.keys[ix.keys.length - 4].pubkey,
|
||||
eventQueue: ix.keys[ix.keys.length - 3].pubkey,
|
||||
},
|
||||
};
|
||||
|
||||
return consumeEvents;
|
||||
}
|
||||
|
||||
export type CancelOrder = {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
owner: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
side: "buy" | "sell";
|
||||
orderId: BN;
|
||||
openOrdersSlot: number;
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof CancelOrderInstruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const CancelOrderDecode = type({
|
||||
export const CancelOrderInstruction = type({
|
||||
side: Side,
|
||||
orderId: BigNumFromString,
|
||||
openOrdersSlot: number(),
|
||||
});
|
||||
|
||||
export function decodeCancelOrder(ix: TransactionInstruction): CancelOrder {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data).cancelOrder,
|
||||
CancelOrderDecode
|
||||
);
|
||||
|
||||
const cancelOrder: CancelOrder = {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
owner: ix.keys[3].pubkey,
|
||||
return {
|
||||
programId: ix.programId,
|
||||
openOrdersSlot: decoded.openOrdersSlot,
|
||||
orderId: decoded.orderId as BN,
|
||||
side: decoded.side,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).cancelOrder,
|
||||
CancelOrderInstruction
|
||||
),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
openOrdersOwner: ix.keys[3].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return cancelOrder;
|
||||
export type SettleFunds = {
|
||||
programId: PublicKey;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
baseWallet: PublicKey;
|
||||
quoteWallet: PublicKey;
|
||||
vaultSigner: PublicKey;
|
||||
referrerQuoteWallet?: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export function decodeSettleFunds(ix: TransactionInstruction): SettleFunds {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
openOrdersOwner: ix.keys[2].pubkey,
|
||||
baseVault: ix.keys[3].pubkey,
|
||||
quoteVault: ix.keys[4].pubkey,
|
||||
baseWallet: ix.keys[5].pubkey,
|
||||
quoteWallet: ix.keys[6].pubkey,
|
||||
vaultSigner: ix.keys[7].pubkey,
|
||||
referrerQuoteWallet: getOptionalKey(ix.keys, 9),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type CancelOrderByClientId = {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
owner: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
clientId: BN;
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof CancelOrderByClientIdInstruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const CancelOrderByClientIdDecode = type({
|
||||
export const CancelOrderByClientIdInstruction = type({
|
||||
clientId: BigNumFromString,
|
||||
});
|
||||
|
||||
export function decodeCancelOrderByClientId(
|
||||
ix: TransactionInstruction
|
||||
): CancelOrderByClientId {
|
||||
const decoded = create(
|
||||
decodeInstruction(ix.data).cancelOrderByClientId,
|
||||
CancelOrderByClientIdDecode
|
||||
);
|
||||
|
||||
const cancelOrderByClientId: CancelOrderByClientId = {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
owner: ix.keys[3].pubkey,
|
||||
return {
|
||||
programId: ix.programId,
|
||||
clientId: decoded.clientId as BN,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).cancelOrderByClientId,
|
||||
CancelOrderByClientIdInstruction
|
||||
),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
openOrdersOwner: ix.keys[3].pubkey,
|
||||
},
|
||||
};
|
||||
|
||||
return cancelOrderByClientId;
|
||||
}
|
||||
|
||||
export type SettleFunds = {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
owner: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
baseWallet: PublicKey;
|
||||
quoteWallet: PublicKey;
|
||||
vaultSigner: PublicKey;
|
||||
export type DisableMarket = {
|
||||
programId: PublicKey;
|
||||
referrerQuoteWallet?: PublicKey;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
disableAuthority: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export function decodeSettleFunds(ix: TransactionInstruction): SettleFunds {
|
||||
let settleFunds: SettleFunds = {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
owner: ix.keys[2].pubkey,
|
||||
baseVault: ix.keys[3].pubkey,
|
||||
quoteVault: ix.keys[4].pubkey,
|
||||
baseWallet: ix.keys[5].pubkey,
|
||||
quoteWallet: ix.keys[6].pubkey,
|
||||
vaultSigner: ix.keys[7].pubkey,
|
||||
export function decodeDisableMarket(ix: TransactionInstruction): DisableMarket {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
disableAuthority: ix.keys[1].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (ix.keys.length > 9) {
|
||||
settleFunds.referrerQuoteWallet = ix.keys[9].pubkey;
|
||||
}
|
||||
export type SweepFees = {
|
||||
programId: PublicKey;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
feeSweepingAuthority: PublicKey;
|
||||
quoteFeeReceiver: PublicKey;
|
||||
vaultSigner: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
return settleFunds;
|
||||
export function decodeSweepFees(ix: TransactionInstruction): SweepFees {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
quoteVault: ix.keys[1].pubkey,
|
||||
feeSweepingAuthority: ix.keys[2].pubkey,
|
||||
quoteFeeReceiver: ix.keys[3].pubkey,
|
||||
vaultSigner: ix.keys[4].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type NewOrderV3 = {
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof NewOrderV3Instruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
requestQueue: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
payer: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
baseVault: PublicKey;
|
||||
quoteVault: PublicKey;
|
||||
feeDiscountPubkey?: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const NewOrderV3Instruction = type({
|
||||
side: Side,
|
||||
limitPrice: BigNumFromString,
|
||||
maxBaseQuantity: BigNumFromString,
|
||||
maxQuoteQuantity: BigNumFromString,
|
||||
selfTradeBehavior: SelfTradeBehavior,
|
||||
orderType: OrderType,
|
||||
clientId: BigNumFromString,
|
||||
limit: number(),
|
||||
});
|
||||
|
||||
export function decodeNewOrderV3(ix: TransactionInstruction): NewOrderV3 {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
data: create(decodeInstruction(ix.data).newOrderV3, NewOrderV3Instruction),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
openOrders: ix.keys[1].pubkey,
|
||||
requestQueue: ix.keys[2].pubkey,
|
||||
eventQueue: ix.keys[3].pubkey,
|
||||
bids: ix.keys[4].pubkey,
|
||||
asks: ix.keys[5].pubkey,
|
||||
payer: ix.keys[6].pubkey,
|
||||
openOrdersOwner: ix.keys[7].pubkey,
|
||||
baseVault: ix.keys[8].pubkey,
|
||||
quoteVault: ix.keys[9].pubkey,
|
||||
feeDiscountPubkey: getOptionalKey(ix.keys, 12),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type CancelOrderV2 = {
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof CancelOrderV2Instruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const CancelOrderV2Instruction = type({
|
||||
side: Side,
|
||||
orderId: BigNumFromString,
|
||||
});
|
||||
|
||||
export function decodeCancelOrderV2(ix: TransactionInstruction): CancelOrderV2 {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).cancelOrderV2,
|
||||
CancelOrderV2Instruction
|
||||
),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
bids: ix.keys[1].pubkey,
|
||||
asks: ix.keys[2].pubkey,
|
||||
openOrders: ix.keys[3].pubkey,
|
||||
openOrdersOwner: ix.keys[4].pubkey,
|
||||
eventQueue: ix.keys[5].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type CancelOrderByClientIdV2 = {
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof CancelOrderByClientIdV2Instruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const CancelOrderByClientIdV2Instruction = type({
|
||||
clientId: BigNumFromString,
|
||||
});
|
||||
|
||||
export function decodeCancelOrderByClientIdV2(
|
||||
ix: TransactionInstruction
|
||||
): CancelOrderByClientIdV2 {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).cancelOrderByClientIdV2,
|
||||
CancelOrderByClientIdV2Instruction
|
||||
),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
bids: ix.keys[1].pubkey,
|
||||
asks: ix.keys[2].pubkey,
|
||||
openOrders: ix.keys[3].pubkey,
|
||||
openOrdersOwner: ix.keys[4].pubkey,
|
||||
eventQueue: ix.keys[5].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type CloseOpenOrders = {
|
||||
programId: PublicKey;
|
||||
accounts: {
|
||||
openOrders: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
rentReceiver: PublicKey;
|
||||
market: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export function decodeCloseOpenOrders(
|
||||
ix: TransactionInstruction
|
||||
): CloseOpenOrders {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
accounts: {
|
||||
openOrders: ix.keys[0].pubkey,
|
||||
openOrdersOwner: ix.keys[1].pubkey,
|
||||
rentReceiver: ix.keys[2].pubkey,
|
||||
market: ix.keys[3].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type InitOpenOrders = {
|
||||
programId: PublicKey;
|
||||
accounts: {
|
||||
openOrders: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
market: PublicKey;
|
||||
openOrdersMarketAuthority?: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export function decodeInitOpenOrders(
|
||||
ix: TransactionInstruction
|
||||
): InitOpenOrders {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
accounts: {
|
||||
openOrders: ix.keys[0].pubkey,
|
||||
openOrdersOwner: ix.keys[1].pubkey,
|
||||
market: ix.keys[2].pubkey,
|
||||
openOrdersMarketAuthority: ix.keys[4].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type Prune = {
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof PruneInstruction>;
|
||||
accounts: {
|
||||
market: PublicKey;
|
||||
bids: PublicKey;
|
||||
asks: PublicKey;
|
||||
pruneAuthority: PublicKey;
|
||||
openOrders: PublicKey;
|
||||
openOrdersOwner: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const PruneInstruction = type({
|
||||
limit: number(),
|
||||
});
|
||||
|
||||
export function decodePrune(ix: TransactionInstruction): Prune {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
data: create(decodeInstruction(ix.data).prune, PruneInstruction),
|
||||
accounts: {
|
||||
market: ix.keys[0].pubkey,
|
||||
bids: ix.keys[1].pubkey,
|
||||
asks: ix.keys[2].pubkey,
|
||||
pruneAuthority: ix.keys[3].pubkey,
|
||||
openOrders: ix.keys[4].pubkey,
|
||||
openOrdersOwner: ix.keys[5].pubkey,
|
||||
eventQueue: ix.keys[6].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type ConsumeEventsPermissioned = {
|
||||
programId: PublicKey;
|
||||
data: Infer<typeof ConsumeEventsPermissionedInstruction>;
|
||||
accounts: {
|
||||
openOrders: PublicKey[];
|
||||
market: PublicKey;
|
||||
eventQueue: PublicKey;
|
||||
crankAuthority: PublicKey;
|
||||
};
|
||||
};
|
||||
|
||||
export const ConsumeEventsPermissionedInstruction = type({
|
||||
limit: number(),
|
||||
});
|
||||
|
||||
export function decodeConsumeEventsPermissioned(
|
||||
ix: TransactionInstruction
|
||||
): ConsumeEventsPermissioned {
|
||||
return {
|
||||
programId: ix.programId,
|
||||
data: create(
|
||||
decodeInstruction(ix.data).consumeEventsPermissioned,
|
||||
ConsumeEventsPermissionedInstruction
|
||||
),
|
||||
accounts: {
|
||||
openOrders: ix.keys.slice(0, -3).map((k) => k.pubkey),
|
||||
market: ix.keys[ix.keys.length - 3].pubkey,
|
||||
eventQueue: ix.keys[ix.keys.length - 2].pubkey,
|
||||
crankAuthority: ix.keys[ix.keys.length - 1].pubkey,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function isSerumInstruction(instruction: TransactionInstruction) {
|
||||
|
@ -326,16 +602,18 @@ const SERUM_CODE_LOOKUP: { [key: number]: string } = {
|
|||
3: "Consume Events",
|
||||
4: "Cancel Order",
|
||||
5: "Settle Funds",
|
||||
6: "Cancel Order By Client Id",
|
||||
6: "Cancel Order by Client Id",
|
||||
7: "Disable Market",
|
||||
8: "Sweep Fees",
|
||||
9: "New Order",
|
||||
10: "New Order",
|
||||
11: "Cancel Order",
|
||||
12: "Cancel Order By Client Id",
|
||||
9: "New Order v2",
|
||||
10: "New Order v3",
|
||||
11: "Cancel Order v2",
|
||||
12: "Cancel Order by Client Id v2",
|
||||
13: "Send Take",
|
||||
14: "Close Open Orders",
|
||||
15: "Init Open Orders",
|
||||
16: "Prune",
|
||||
17: "Consume Events Permissioned",
|
||||
};
|
||||
|
||||
export function parseSerumInstructionCode(instruction: TransactionInstruction) {
|
||||
|
|
Loading…
Reference in New Issue