explorer: add support for more serum instructions (#21451)
This commit is contained in:
@ -6,15 +6,22 @@ import { reportError } from "utils/sentry";
|
|||||||
import {
|
import {
|
||||||
decodeCancelOrder,
|
decodeCancelOrder,
|
||||||
decodeCancelOrderByClientId,
|
decodeCancelOrderByClientId,
|
||||||
|
decodeCancelOrderByClientIdV2,
|
||||||
|
decodeCancelOrderV2,
|
||||||
|
decodeCloseOpenOrders,
|
||||||
decodeConsumeEvents,
|
decodeConsumeEvents,
|
||||||
|
decodeConsumeEventsPermissioned,
|
||||||
|
decodeDisableMarket,
|
||||||
decodeInitializeMarket,
|
decodeInitializeMarket,
|
||||||
|
decodeInitOpenOrders,
|
||||||
decodeMatchOrders,
|
decodeMatchOrders,
|
||||||
decodeNewOrder,
|
decodeNewOrder,
|
||||||
|
decodeNewOrderV3,
|
||||||
|
decodePrune,
|
||||||
decodeSettleFunds,
|
decodeSettleFunds,
|
||||||
parseSerumInstructionCode,
|
decodeSweepFees,
|
||||||
parseSerumInstructionKey,
|
parseSerumInstructionKey,
|
||||||
parseSerumInstructionTitle,
|
parseSerumInstructionTitle,
|
||||||
SERUM_DECODED_MAX,
|
|
||||||
} from "./serum/types";
|
} from "./serum/types";
|
||||||
import { NewOrderDetailsCard } from "./serum/NewOrderDetailsCard";
|
import { NewOrderDetailsCard } from "./serum/NewOrderDetailsCard";
|
||||||
import { MatchOrdersDetailsCard } from "./serum/MatchOrdersDetailsCard";
|
import { MatchOrdersDetailsCard } from "./serum/MatchOrdersDetailsCard";
|
||||||
@ -23,6 +30,15 @@ import { ConsumeEventsDetailsCard } from "./serum/ConsumeEventsDetails";
|
|||||||
import { CancelOrderDetailsCard } from "./serum/CancelOrderDetails";
|
import { CancelOrderDetailsCard } from "./serum/CancelOrderDetails";
|
||||||
import { CancelOrderByClientIdDetailsCard } from "./serum/CancelOrderByClientIdDetails";
|
import { CancelOrderByClientIdDetailsCard } from "./serum/CancelOrderByClientIdDetails";
|
||||||
import { SettleFundsDetailsCard } from "./serum/SettleFundsDetailsCard";
|
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: {
|
export function SerumDetailsCard(props: {
|
||||||
ix: TransactionInstruction;
|
ix: TransactionInstruction;
|
||||||
@ -39,9 +55,6 @@ export function SerumDetailsCard(props: {
|
|||||||
let title;
|
let title;
|
||||||
try {
|
try {
|
||||||
title = parseSerumInstructionTitle(ix);
|
title = parseSerumInstructionTitle(ix);
|
||||||
const code = parseSerumInstructionCode(ix);
|
|
||||||
|
|
||||||
if (code <= SERUM_DECODED_MAX) {
|
|
||||||
switch (parseSerumInstructionKey(ix)) {
|
switch (parseSerumInstructionKey(ix)) {
|
||||||
case "initializeMarket":
|
case "initializeMarket":
|
||||||
return (
|
return (
|
||||||
@ -58,15 +71,16 @@ export function SerumDetailsCard(props: {
|
|||||||
);
|
);
|
||||||
case "consumeEvents":
|
case "consumeEvents":
|
||||||
return (
|
return (
|
||||||
<ConsumeEventsDetailsCard
|
<ConsumeEventsDetailsCard info={decodeConsumeEvents(ix)} {...props} />
|
||||||
info={decodeConsumeEvents(ix)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
);
|
||||||
case "cancelOrder":
|
case "cancelOrder":
|
||||||
return (
|
return (
|
||||||
<CancelOrderDetailsCard info={decodeCancelOrder(ix)} {...props} />
|
<CancelOrderDetailsCard info={decodeCancelOrder(ix)} {...props} />
|
||||||
);
|
);
|
||||||
|
case "settleFunds":
|
||||||
|
return (
|
||||||
|
<SettleFundsDetailsCard info={decodeSettleFunds(ix)} {...props} />
|
||||||
|
);
|
||||||
case "cancelOrderByClientId":
|
case "cancelOrderByClientId":
|
||||||
return (
|
return (
|
||||||
<CancelOrderByClientIdDetailsCard
|
<CancelOrderByClientIdDetailsCard
|
||||||
@ -74,11 +88,48 @@ export function SerumDetailsCard(props: {
|
|||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
case "settleFunds":
|
case "disableMarket":
|
||||||
return (
|
return (
|
||||||
<SettleFundsDetailsCard info={decodeSettleFunds(ix)} {...props} />
|
<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) {
|
} catch (error) {
|
||||||
reportError(error, {
|
reportError(error, {
|
||||||
|
@ -26,34 +26,34 @@ export function CancelOrderByClientIdDetailsCard(props: {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Open Orders</td>
|
<td>Open Orders</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.openOrders} alignRight link />
|
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Request Queue</td>
|
<td>Request Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.requestQueue} alignRight link />
|
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Owner</td>
|
<td>Open Orders Owner</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.owner} alignRight link />
|
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Client Id</td>
|
<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>
|
</tr>
|
||||||
</InstructionCard>
|
</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>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Open Orders</td>
|
<td>Open Orders</td>
|
||||||
<td className="text-lg-right">
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Request Queue</td>
|
<td>Request Queue</td>
|
||||||
<td className="text-lg-right">
|
<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 className="text-lg-right">
|
|
||||||
<Address pubkey={info.owner} alignRight link />
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Side</td>
|
<td>Side</td>
|
||||||
<td className="text-lg-right">{info.side}</td>
|
<td className="text-lg-right">{info.data.side}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Open Orders Slot</td>
|
<td>Open Orders Slot</td>
|
||||||
<td className="text-lg-right">{info.openOrdersSlot}</td>
|
<td className="text-lg-right">{info.data.openOrdersSlot}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Order Id</td>
|
<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>
|
</tr>
|
||||||
</InstructionCard>
|
</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>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Event Queue</td>
|
<td>Event Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.eventQueue} alignRight link />
|
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Open Orders Accounts</td>
|
<td>Open Orders Accounts</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
{info.openOrdersAccounts.map((account, index) => {
|
{info.accounts.openOrders.map((account, index) => {
|
||||||
return <Address pubkey={account} key={index} alignRight link />;
|
return <Address pubkey={account} key={index} alignRight link />;
|
||||||
})}
|
})}
|
||||||
</td>
|
</td>
|
||||||
@ -55,7 +55,7 @@ export function ConsumeEventsDetailsCard(props: {
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Limit</td>
|
<td>Limit</td>
|
||||||
<td className="text-lg-right">{info.limit}</td>
|
<td className="text-lg-right">{info.data.limit}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</InstructionCard>
|
</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>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Request Queue</td>
|
<td>Request Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.requestQueue} alignRight link />
|
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Event Queue</td>
|
<td>Event Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.eventQueue} alignRight link />
|
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Bids</td>
|
<td>Bids</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.bids} alignRight link />
|
<Address pubkey={info.accounts.bids} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Asks</td>
|
<td>Asks</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.asks} alignRight link />
|
<Address pubkey={info.accounts.asks} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Base Vault</td>
|
<td>Base Vault</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.baseVault} alignRight link />
|
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Vault</td>
|
<td>Quote Vault</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.quoteVault} alignRight link />
|
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Base Mint</td>
|
<td>Base Mint</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.baseMint} alignRight link />
|
<Address pubkey={info.accounts.baseMint} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Mint</td>
|
<td>Quote Mint</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.quoteMint} alignRight link />
|
<Address pubkey={info.accounts.quoteMint} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Base Lot Size</td>
|
<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>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Lot Size</td>
|
<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>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Fee Rate Bps</td>
|
<td>Fee Rate Bps</td>
|
||||||
<td className="text-lg-right">{info.feeRateBps}</td>
|
<td className="text-lg-right">{info.data.feeRateBps}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Dust Threshold</td>
|
<td>Quote Dust Threshold</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
{info.quoteDustThreshold.toString(10)}
|
{info.data.quoteDustThreshold.toString(10)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Vault Signer Nonce</td>
|
<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>
|
</tr>
|
||||||
</InstructionCard>
|
</InstructionCard>
|
||||||
);
|
);
|
||||||
|
@ -33,55 +33,41 @@ export function MatchOrdersDetailsCard(props: {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Request Queue</td>
|
<td>Request Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.requestQueue} alignRight link />
|
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Event Queue</td>
|
<td>Event Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.eventQueue} alignRight link />
|
<Address pubkey={info.accounts.eventQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Bids</td>
|
<td>Bids</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.bids} alignRight link />
|
<Address pubkey={info.accounts.bids} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Asks</td>
|
<td>Asks</td>
|
||||||
<td className="text-lg-right">
|
<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 />
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td>Quote Vault</td>
|
|
||||||
<td className="text-lg-right">
|
|
||||||
<Address pubkey={info.quoteVault} alignRight link />
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Limit</td>
|
<td>Limit</td>
|
||||||
<td className="text-lg-right">{info.limit}</td>
|
<td className="text-lg-right">{info.data.limit}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</InstructionCard>
|
</InstructionCard>
|
||||||
);
|
);
|
||||||
|
@ -33,75 +33,75 @@ export function NewOrderDetailsCard(props: {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Open Orders</td>
|
<td>Open Orders</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.openOrders} alignRight link />
|
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Request Queue</td>
|
<td>Request Queue</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.requestQueue} alignRight link />
|
<Address pubkey={info.accounts.requestQueue} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Payer</td>
|
<td>Payer</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.payer} alignRight link />
|
<Address pubkey={info.accounts.payer} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Owner</td>
|
<td>Open Orders Owner</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.owner} alignRight link />
|
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Base Vault</td>
|
<td>Base Vault</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.baseVault} alignRight link />
|
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Vault</td>
|
<td>Quote Vault</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.quoteVault} alignRight link />
|
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Side</td>
|
<td>Side</td>
|
||||||
<td className="text-lg-right">{info.side}</td>
|
<td className="text-lg-right">{info.data.side}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Order Type</td>
|
<td>Order Type</td>
|
||||||
<td className="text-lg-right">{info.orderType}</td>
|
<td className="text-lg-right">{info.data.orderType}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Limit Price</td>
|
<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>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Max Quantity</td>
|
<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>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Client Id</td>
|
<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>
|
</tr>
|
||||||
</InstructionCard>
|
</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>
|
||||||
|
);
|
||||||
|
}
|
88
explorer/src/components/instruction/serum/PruneDetails.tsx
Normal file
88
explorer/src/components/instruction/serum/PruneDetails.tsx
Normal file
@ -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>
|
<tr>
|
||||||
<td>Market</td>
|
<td>Market</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.market} alignRight link />
|
<Address pubkey={info.accounts.market} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Open Orders</td>
|
<td>Open Orders</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.openOrders} alignRight link />
|
<Address pubkey={info.accounts.openOrders} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Owner</td>
|
<td>Open Orders Owner</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.owner} alignRight link />
|
<Address pubkey={info.accounts.openOrdersOwner} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Base Vault</td>
|
<td>Base Vault</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.baseVault} alignRight link />
|
<Address pubkey={info.accounts.baseVault} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Vault</td>
|
<td>Quote Vault</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.quoteVault} alignRight link />
|
<Address pubkey={info.accounts.quoteVault} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Base Wallet</td>
|
<td>Base Wallet</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.baseWallet} alignRight link />
|
<Address pubkey={info.accounts.baseWallet} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Quote Wallet</td>
|
<td>Quote Wallet</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.quoteWallet} alignRight link />
|
<Address pubkey={info.accounts.quoteWallet} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Vault Signer</td>
|
<td>Vault Signer</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.vaultSigner} alignRight link />
|
<Address pubkey={info.accounts.vaultSigner} alignRight link />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{info.referrerQuoteWallet && (
|
{info.accounts.referrerQuoteWallet && (
|
||||||
<tr>
|
<tr>
|
||||||
<td>Referrer Quote Wallet</td>
|
<td>Referrer Quote Wallet</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<Address pubkey={info.referrerQuoteWallet} alignRight link />
|
<Address
|
||||||
|
pubkey={info.accounts.referrerQuoteWallet}
|
||||||
|
alignRight
|
||||||
|
link
|
||||||
|
/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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 */
|
/* eslint-disable @typescript-eslint/no-redeclare */
|
||||||
|
|
||||||
import { decodeInstruction, MARKETS } from "@project-serum/serum";
|
import { decodeInstruction, MARKETS } from "@project-serum/serum";
|
||||||
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
import {
|
||||||
import BN from "bn.js";
|
AccountMeta,
|
||||||
import { enums, number, optional, type, Infer, create } from "superstruct";
|
PublicKey,
|
||||||
|
TransactionInstruction,
|
||||||
|
} from "@solana/web3.js";
|
||||||
|
import { enums, number, type, Infer, create } from "superstruct";
|
||||||
import { BigNumFromString } from "validators/bignum";
|
import { BigNumFromString } from "validators/bignum";
|
||||||
import { PublicKeyFromString } from "validators/pubkey";
|
|
||||||
|
|
||||||
const SERUM_PROGRAM_IDS = [
|
const SERUM_PROGRAM_IDS = [
|
||||||
"4ckmDgGdxQoPDLUkDT3vHgSAkzA3QRdNq5ywwY4sUSJn",
|
"4ckmDgGdxQoPDLUkDT3vHgSAkzA3QRdNq5ywwY4sUSJn",
|
||||||
@ -20,7 +22,28 @@ export const Side = enums(["buy", "sell"]);
|
|||||||
export type OrderType = Infer<typeof OrderType>;
|
export type OrderType = Infer<typeof OrderType>;
|
||||||
export const OrderType = enums(["limit", "ioc", "postOnly"]);
|
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 = {
|
export type InitializeMarket = {
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Infer<typeof InitializeMarketInstruction>;
|
||||||
|
accounts: {
|
||||||
market: PublicKey;
|
market: PublicKey;
|
||||||
requestQueue: PublicKey;
|
requestQueue: PublicKey;
|
||||||
eventQueue: PublicKey;
|
eventQueue: PublicKey;
|
||||||
@ -30,15 +53,13 @@ export type InitializeMarket = {
|
|||||||
quoteVault: PublicKey;
|
quoteVault: PublicKey;
|
||||||
baseMint: PublicKey;
|
baseMint: PublicKey;
|
||||||
quoteMint: PublicKey;
|
quoteMint: PublicKey;
|
||||||
baseLotSize: BN;
|
openOrdersMarketAuthority?: PublicKey;
|
||||||
quoteLotSize: BN;
|
pruneAuthority?: PublicKey;
|
||||||
feeRateBps: number;
|
crankAuthority?: PublicKey;
|
||||||
vaultSignerNonce: BN;
|
};
|
||||||
quoteDustThreshold: BN;
|
|
||||||
programId: PublicKey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const InitializeMarketDecode = type({
|
export const InitializeMarketInstruction = type({
|
||||||
baseLotSize: BigNumFromString,
|
baseLotSize: BigNumFromString,
|
||||||
quoteLotSize: BigNumFromString,
|
quoteLotSize: BigNumFromString,
|
||||||
feeRateBps: number(),
|
feeRateBps: number(),
|
||||||
@ -49,12 +70,13 @@ export const InitializeMarketDecode = type({
|
|||||||
export function decodeInitializeMarket(
|
export function decodeInitializeMarket(
|
||||||
ix: TransactionInstruction
|
ix: TransactionInstruction
|
||||||
): InitializeMarket {
|
): InitializeMarket {
|
||||||
const decoded = create(
|
return {
|
||||||
|
programId: ix.programId,
|
||||||
|
data: create(
|
||||||
decodeInstruction(ix.data).initializeMarket,
|
decodeInstruction(ix.data).initializeMarket,
|
||||||
InitializeMarketDecode
|
InitializeMarketInstruction
|
||||||
);
|
),
|
||||||
|
accounts: {
|
||||||
let initializeMarket: InitializeMarket = {
|
|
||||||
market: ix.keys[0].pubkey,
|
market: ix.keys[0].pubkey,
|
||||||
requestQueue: ix.keys[1].pubkey,
|
requestQueue: ix.keys[1].pubkey,
|
||||||
eventQueue: ix.keys[2].pubkey,
|
eventQueue: ix.keys[2].pubkey,
|
||||||
@ -64,236 +86,490 @@ export function decodeInitializeMarket(
|
|||||||
quoteVault: ix.keys[6].pubkey,
|
quoteVault: ix.keys[6].pubkey,
|
||||||
baseMint: ix.keys[7].pubkey,
|
baseMint: ix.keys[7].pubkey,
|
||||||
quoteMint: ix.keys[8].pubkey,
|
quoteMint: ix.keys[8].pubkey,
|
||||||
programId: ix.programId,
|
openOrdersMarketAuthority: getOptionalKey(ix.keys, 10),
|
||||||
baseLotSize: decoded.baseLotSize as BN,
|
pruneAuthority: getOptionalKey(ix.keys, 11),
|
||||||
quoteLotSize: decoded.quoteLotSize as BN,
|
crankAuthority: getOptionalKey(ix.keys, 12),
|
||||||
feeRateBps: decoded.feeRateBps,
|
},
|
||||||
quoteDustThreshold: decoded.quoteDustThreshold as BN,
|
|
||||||
vaultSignerNonce: decoded.vaultSignerNonce as BN,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return initializeMarket;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NewOrder = {
|
export type NewOrder = {
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Infer<typeof NewOrderInstruction>;
|
||||||
|
accounts: {
|
||||||
market: PublicKey;
|
market: PublicKey;
|
||||||
openOrders: PublicKey;
|
openOrders: PublicKey;
|
||||||
requestQueue: PublicKey;
|
requestQueue: PublicKey;
|
||||||
payer: PublicKey;
|
payer: PublicKey;
|
||||||
owner: PublicKey;
|
openOrdersOwner: PublicKey;
|
||||||
baseVault: PublicKey;
|
baseVault: PublicKey;
|
||||||
quoteVault: PublicKey;
|
quoteVault: PublicKey;
|
||||||
programId: PublicKey;
|
|
||||||
feeDiscountPubkey?: PublicKey;
|
feeDiscountPubkey?: PublicKey;
|
||||||
side: Side;
|
};
|
||||||
limitPrice: BN;
|
|
||||||
maxQuantity: BN;
|
|
||||||
orderType: OrderType;
|
|
||||||
clientId: BN;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const NewOrderDecode = type({
|
export const NewOrderInstruction = type({
|
||||||
side: Side,
|
side: Side,
|
||||||
limitPrice: BigNumFromString,
|
limitPrice: BigNumFromString,
|
||||||
maxQuantity: BigNumFromString,
|
maxQuantity: BigNumFromString,
|
||||||
orderType: OrderType,
|
orderType: OrderType,
|
||||||
clientId: BigNumFromString,
|
clientId: BigNumFromString,
|
||||||
feeDiscountPubkey: optional(PublicKeyFromString),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export function decodeNewOrder(ix: TransactionInstruction): NewOrder {
|
export function decodeNewOrder(ix: TransactionInstruction): NewOrder {
|
||||||
const decoded = create(decodeInstruction(ix.data).newOrder, NewOrderDecode);
|
return {
|
||||||
|
programId: ix.programId,
|
||||||
let newOrder: NewOrder = {
|
data: create(decodeInstruction(ix.data).newOrder, NewOrderInstruction),
|
||||||
|
accounts: {
|
||||||
market: ix.keys[0].pubkey,
|
market: ix.keys[0].pubkey,
|
||||||
openOrders: ix.keys[1].pubkey,
|
openOrders: ix.keys[1].pubkey,
|
||||||
requestQueue: ix.keys[2].pubkey,
|
requestQueue: ix.keys[2].pubkey,
|
||||||
payer: ix.keys[3].pubkey,
|
payer: ix.keys[3].pubkey,
|
||||||
owner: ix.keys[4].pubkey,
|
openOrdersOwner: ix.keys[4].pubkey,
|
||||||
baseVault: ix.keys[5].pubkey,
|
baseVault: ix.keys[5].pubkey,
|
||||||
quoteVault: ix.keys[6].pubkey,
|
quoteVault: ix.keys[6].pubkey,
|
||||||
programId: ix.programId,
|
feeDiscountPubkey: getOptionalKey(ix.keys, 9),
|
||||||
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,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (decoded.feeDiscountPubkey) {
|
|
||||||
newOrder.feeDiscountPubkey = decoded.feeDiscountPubkey;
|
|
||||||
}
|
|
||||||
|
|
||||||
return newOrder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MatchOrders = {
|
export type MatchOrders = {
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Infer<typeof MatchOrdersInstruction>;
|
||||||
|
accounts: {
|
||||||
market: PublicKey;
|
market: PublicKey;
|
||||||
requestQueue: PublicKey;
|
requestQueue: PublicKey;
|
||||||
eventQueue: PublicKey;
|
eventQueue: PublicKey;
|
||||||
bids: PublicKey;
|
bids: PublicKey;
|
||||||
asks: PublicKey;
|
asks: PublicKey;
|
||||||
baseVault: PublicKey;
|
};
|
||||||
quoteVault: PublicKey;
|
|
||||||
limit: number;
|
|
||||||
programId: PublicKey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MatchOrdersDecode = type({
|
export const MatchOrdersInstruction = type({
|
||||||
limit: number(),
|
limit: number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function decodeMatchOrders(ix: TransactionInstruction): MatchOrders {
|
export function decodeMatchOrders(ix: TransactionInstruction): MatchOrders {
|
||||||
const decoded = create(
|
return {
|
||||||
|
programId: ix.programId,
|
||||||
|
data: create(
|
||||||
decodeInstruction(ix.data).matchOrders,
|
decodeInstruction(ix.data).matchOrders,
|
||||||
MatchOrdersDecode
|
MatchOrdersInstruction
|
||||||
);
|
),
|
||||||
|
accounts: {
|
||||||
const matchOrders: MatchOrders = {
|
|
||||||
market: ix.keys[0].pubkey,
|
market: ix.keys[0].pubkey,
|
||||||
requestQueue: ix.keys[1].pubkey,
|
requestQueue: ix.keys[1].pubkey,
|
||||||
eventQueue: ix.keys[2].pubkey,
|
eventQueue: ix.keys[2].pubkey,
|
||||||
bids: ix.keys[3].pubkey,
|
bids: ix.keys[3].pubkey,
|
||||||
asks: ix.keys[4].pubkey,
|
asks: ix.keys[4].pubkey,
|
||||||
baseVault: ix.keys[5].pubkey,
|
},
|
||||||
quoteVault: ix.keys[6].pubkey,
|
|
||||||
programId: ix.programId,
|
|
||||||
limit: decoded.limit,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return matchOrders;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ConsumeEvents = {
|
export type ConsumeEvents = {
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Infer<typeof ConsumeEventsInstruction>;
|
||||||
|
accounts: {
|
||||||
|
openOrders: PublicKey[];
|
||||||
market: PublicKey;
|
market: PublicKey;
|
||||||
eventQueue: PublicKey;
|
eventQueue: PublicKey;
|
||||||
openOrdersAccounts: PublicKey[];
|
};
|
||||||
limit: number;
|
|
||||||
programId: PublicKey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ConsumeEventsDecode = type({
|
export const ConsumeEventsInstruction = type({
|
||||||
limit: number(),
|
limit: number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function decodeConsumeEvents(ix: TransactionInstruction): ConsumeEvents {
|
export function decodeConsumeEvents(ix: TransactionInstruction): ConsumeEvents {
|
||||||
const decoded = create(
|
return {
|
||||||
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,
|
|
||||||
programId: ix.programId,
|
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 = {
|
export type CancelOrder = {
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Infer<typeof CancelOrderInstruction>;
|
||||||
|
accounts: {
|
||||||
market: PublicKey;
|
market: PublicKey;
|
||||||
openOrders: PublicKey;
|
openOrders: PublicKey;
|
||||||
owner: PublicKey;
|
|
||||||
requestQueue: PublicKey;
|
requestQueue: PublicKey;
|
||||||
side: "buy" | "sell";
|
openOrdersOwner: PublicKey;
|
||||||
orderId: BN;
|
};
|
||||||
openOrdersSlot: number;
|
|
||||||
programId: PublicKey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CancelOrderDecode = type({
|
export const CancelOrderInstruction = type({
|
||||||
side: Side,
|
side: Side,
|
||||||
orderId: BigNumFromString,
|
orderId: BigNumFromString,
|
||||||
openOrdersSlot: number(),
|
openOrdersSlot: number(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export function decodeCancelOrder(ix: TransactionInstruction): CancelOrder {
|
export function decodeCancelOrder(ix: TransactionInstruction): CancelOrder {
|
||||||
const decoded = create(
|
return {
|
||||||
|
programId: ix.programId,
|
||||||
|
data: create(
|
||||||
decodeInstruction(ix.data).cancelOrder,
|
decodeInstruction(ix.data).cancelOrder,
|
||||||
CancelOrderDecode
|
CancelOrderInstruction
|
||||||
);
|
),
|
||||||
|
accounts: {
|
||||||
const cancelOrder: CancelOrder = {
|
|
||||||
market: ix.keys[0].pubkey,
|
market: ix.keys[0].pubkey,
|
||||||
openOrders: ix.keys[1].pubkey,
|
openOrders: ix.keys[1].pubkey,
|
||||||
requestQueue: ix.keys[2].pubkey,
|
requestQueue: ix.keys[2].pubkey,
|
||||||
owner: ix.keys[3].pubkey,
|
openOrdersOwner: ix.keys[3].pubkey,
|
||||||
programId: ix.programId,
|
},
|
||||||
openOrdersSlot: decoded.openOrdersSlot,
|
|
||||||
orderId: decoded.orderId as BN,
|
|
||||||
side: decoded.side,
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
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 = {
|
export type CancelOrderByClientId = {
|
||||||
|
programId: PublicKey;
|
||||||
|
data: Infer<typeof CancelOrderByClientIdInstruction>;
|
||||||
|
accounts: {
|
||||||
market: PublicKey;
|
market: PublicKey;
|
||||||
openOrders: PublicKey;
|
openOrders: PublicKey;
|
||||||
owner: PublicKey;
|
|
||||||
requestQueue: PublicKey;
|
requestQueue: PublicKey;
|
||||||
clientId: BN;
|
openOrdersOwner: PublicKey;
|
||||||
programId: PublicKey;
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CancelOrderByClientIdDecode = type({
|
export const CancelOrderByClientIdInstruction = type({
|
||||||
clientId: BigNumFromString,
|
clientId: BigNumFromString,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function decodeCancelOrderByClientId(
|
export function decodeCancelOrderByClientId(
|
||||||
ix: TransactionInstruction
|
ix: TransactionInstruction
|
||||||
): CancelOrderByClientId {
|
): CancelOrderByClientId {
|
||||||
const decoded = create(
|
return {
|
||||||
|
programId: ix.programId,
|
||||||
|
data: create(
|
||||||
decodeInstruction(ix.data).cancelOrderByClientId,
|
decodeInstruction(ix.data).cancelOrderByClientId,
|
||||||
CancelOrderByClientIdDecode
|
CancelOrderByClientIdInstruction
|
||||||
);
|
),
|
||||||
|
accounts: {
|
||||||
const cancelOrderByClientId: CancelOrderByClientId = {
|
|
||||||
market: ix.keys[0].pubkey,
|
market: ix.keys[0].pubkey,
|
||||||
openOrders: ix.keys[1].pubkey,
|
openOrders: ix.keys[1].pubkey,
|
||||||
requestQueue: ix.keys[2].pubkey,
|
requestQueue: ix.keys[2].pubkey,
|
||||||
owner: ix.keys[3].pubkey,
|
openOrdersOwner: ix.keys[3].pubkey,
|
||||||
programId: ix.programId,
|
},
|
||||||
clientId: decoded.clientId as BN,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return cancelOrderByClientId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SettleFunds = {
|
export type DisableMarket = {
|
||||||
market: PublicKey;
|
|
||||||
openOrders: PublicKey;
|
|
||||||
owner: PublicKey;
|
|
||||||
baseVault: PublicKey;
|
|
||||||
quoteVault: PublicKey;
|
|
||||||
baseWallet: PublicKey;
|
|
||||||
quoteWallet: PublicKey;
|
|
||||||
vaultSigner: PublicKey;
|
|
||||||
programId: PublicKey;
|
programId: PublicKey;
|
||||||
referrerQuoteWallet?: PublicKey;
|
accounts: {
|
||||||
|
market: PublicKey;
|
||||||
|
disableAuthority: PublicKey;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function decodeSettleFunds(ix: TransactionInstruction): SettleFunds {
|
export function decodeDisableMarket(ix: TransactionInstruction): DisableMarket {
|
||||||
let settleFunds: SettleFunds = {
|
return {
|
||||||
|
programId: ix.programId,
|
||||||
|
accounts: {
|
||||||
|
market: ix.keys[0].pubkey,
|
||||||
|
disableAuthority: ix.keys[1].pubkey,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export type SweepFees = {
|
||||||
|
programId: PublicKey;
|
||||||
|
accounts: {
|
||||||
|
market: PublicKey;
|
||||||
|
quoteVault: PublicKey;
|
||||||
|
feeSweepingAuthority: PublicKey;
|
||||||
|
quoteFeeReceiver: PublicKey;
|
||||||
|
vaultSigner: PublicKey;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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,
|
market: ix.keys[0].pubkey,
|
||||||
openOrders: ix.keys[1].pubkey,
|
openOrders: ix.keys[1].pubkey,
|
||||||
owner: ix.keys[2].pubkey,
|
requestQueue: ix.keys[2].pubkey,
|
||||||
baseVault: ix.keys[3].pubkey,
|
eventQueue: ix.keys[3].pubkey,
|
||||||
quoteVault: ix.keys[4].pubkey,
|
bids: ix.keys[4].pubkey,
|
||||||
baseWallet: ix.keys[5].pubkey,
|
asks: ix.keys[5].pubkey,
|
||||||
quoteWallet: ix.keys[6].pubkey,
|
payer: ix.keys[6].pubkey,
|
||||||
vaultSigner: ix.keys[7].pubkey,
|
openOrdersOwner: ix.keys[7].pubkey,
|
||||||
programId: ix.programId,
|
baseVault: ix.keys[8].pubkey,
|
||||||
|
quoteVault: ix.keys[9].pubkey,
|
||||||
|
feeDiscountPubkey: getOptionalKey(ix.keys, 12),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (ix.keys.length > 9) {
|
export type CancelOrderV2 = {
|
||||||
settleFunds.referrerQuoteWallet = ix.keys[9].pubkey;
|
programId: PublicKey;
|
||||||
}
|
data: Infer<typeof CancelOrderV2Instruction>;
|
||||||
|
accounts: {
|
||||||
|
market: PublicKey;
|
||||||
|
bids: PublicKey;
|
||||||
|
asks: PublicKey;
|
||||||
|
openOrders: PublicKey;
|
||||||
|
openOrdersOwner: PublicKey;
|
||||||
|
eventQueue: PublicKey;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
return settleFunds;
|
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) {
|
export function isSerumInstruction(instruction: TransactionInstruction) {
|
||||||
@ -326,16 +602,18 @@ const SERUM_CODE_LOOKUP: { [key: number]: string } = {
|
|||||||
3: "Consume Events",
|
3: "Consume Events",
|
||||||
4: "Cancel Order",
|
4: "Cancel Order",
|
||||||
5: "Settle Funds",
|
5: "Settle Funds",
|
||||||
6: "Cancel Order By Client Id",
|
6: "Cancel Order by Client Id",
|
||||||
7: "Disable Market",
|
7: "Disable Market",
|
||||||
8: "Sweep Fees",
|
8: "Sweep Fees",
|
||||||
9: "New Order",
|
9: "New Order v2",
|
||||||
10: "New Order",
|
10: "New Order v3",
|
||||||
11: "Cancel Order",
|
11: "Cancel Order v2",
|
||||||
12: "Cancel Order By Client Id",
|
12: "Cancel Order by Client Id v2",
|
||||||
13: "Send Take",
|
13: "Send Take",
|
||||||
14: "Close Open Orders",
|
14: "Close Open Orders",
|
||||||
15: "Init Open Orders",
|
15: "Init Open Orders",
|
||||||
|
16: "Prune",
|
||||||
|
17: "Consume Events Permissioned",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function parseSerumInstructionCode(instruction: TransactionInstruction) {
|
export function parseSerumInstructionCode(instruction: TransactionInstruction) {
|
||||||
|
Reference in New Issue
Block a user