diff --git a/explorer/src/components/instruction/bpf-loader/BpfLoaderDetailsCard.tsx b/explorer/src/components/instruction/bpf-loader/BpfLoaderDetailsCard.tsx
index 4233bddb6f..47a19507b6 100644
--- a/explorer/src/components/instruction/bpf-loader/BpfLoaderDetailsCard.tsx
+++ b/explorer/src/components/instruction/bpf-loader/BpfLoaderDetailsCard.tsx
@@ -8,7 +8,7 @@ import {
import { InstructionCard } from "../InstructionCard";
import { coerce } from "superstruct";
import { ParsedInfo } from "validators";
-import { IX_STRUCTS } from "./types";
+import { WriteInfo, FinalizeInfo } from "./types";
import { reportError } from "utils/sentry";
import { UnknownDetailsCard } from "../UnknownDetailsCard";
import { Address } from "components/common/Address";
@@ -24,13 +24,16 @@ type DetailsProps = {
export function BpfLoaderDetailsCard(props: DetailsProps) {
try {
const parsed = coerce(props.ix.parsed, ParsedInfo);
- const info = coerce(parsed.info, IX_STRUCTS[parsed.type]);
switch (parsed.type) {
- case "write":
+ case "write": {
+ const info = coerce(parsed.info, WriteInfo);
return ;
- case "finalize":
+ }
+ case "finalize": {
+ const info = coerce(parsed.info, FinalizeInfo);
return ;
+ }
default:
return ;
}
@@ -42,14 +45,14 @@ export function BpfLoaderDetailsCard(props: DetailsProps) {
}
}
-type Props = {
+type Props = {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: T;
};
-export function BpfLoaderWriteDetailsCard(props: Props) {
+export function BpfLoaderWriteDetailsCard(props: Props) {
const { ix, index, result, info } = props;
const bytes = wrap(info.bytes, 50);
return (
@@ -90,7 +93,7 @@ export function BpfLoaderWriteDetailsCard(props: Props) {
);
}
-export function BpfLoaderFinalizeDetailsCard(props: Props) {
+export function BpfLoaderFinalizeDetailsCard(props: Props) {
const { ix, index, result, info } = props;
return (
diff --git a/explorer/src/components/instruction/bpf-loader/types.ts b/explorer/src/components/instruction/bpf-loader/types.ts
index 1ec7b20d06..19b406f936 100644
--- a/explorer/src/components/instruction/bpf-loader/types.ts
+++ b/explorer/src/components/instruction/bpf-loader/types.ts
@@ -3,13 +3,15 @@
import { enums, number, pick, string, StructType } from "superstruct";
import { Pubkey } from "validators/pubkey";
-const Write = pick({
+export type WriteInfo = StructType;
+export const WriteInfo = pick({
account: Pubkey,
bytes: string(),
offset: number(),
});
-const Finalize = pick({
+export type FinalizeInfo = StructType;
+export const FinalizeInfo = pick({
account: Pubkey,
});
@@ -17,8 +19,3 @@ export type BpfLoaderInstructionType = StructType<
typeof BpfLoaderInstructionType
>;
export const BpfLoaderInstructionType = enums(["write", "finalize"]);
-
-export const IX_STRUCTS: { [id: string]: any } = {
- write: Write,
- finalize: Finalize,
-};
diff --git a/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx b/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx
index 425e0b2616..baa99694c1 100644
--- a/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/AuthorizeDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { AuthorizeInfo } from "./types";
export function AuthorizeDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AuthorizeInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx b/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx
index 27f0b4af75..d53495e9fc 100644
--- a/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/DeactivateDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { DeactivateInfo } from "./types";
export function DeactivateDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: DeactivateInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx b/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx
index 63bd40f4db..d1a3043f13 100644
--- a/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/DelegateDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { DelegateInfo } from "./types";
export function DelegateDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: DelegateInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx b/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx
index 556861cf6a..695a77bb18 100644
--- a/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/InitializeDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { InitializeInfo } from "./types";
export function InitializeDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: InitializeInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/stake/SplitDetailsCard.tsx b/explorer/src/components/instruction/stake/SplitDetailsCard.tsx
index f403a992ad..f70db3dc63 100644
--- a/explorer/src/components/instruction/stake/SplitDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/SplitDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { lamportsToSolString } from "utils";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { SplitInfo } from "./types";
export function SplitDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: SplitInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/stake/StakeDetailsCard.tsx b/explorer/src/components/instruction/stake/StakeDetailsCard.tsx
index 3abae17321..e5eeddd777 100644
--- a/explorer/src/components/instruction/stake/StakeDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/StakeDetailsCard.tsx
@@ -15,7 +15,14 @@ import { DeactivateDetailsCard } from "./DeactivateDetailsCard";
import { ParsedInfo } from "validators";
import { reportError } from "utils/sentry";
import { coerce } from "superstruct";
-import { IX_STRUCTS } from "./types";
+import {
+ AuthorizeInfo,
+ DeactivateInfo,
+ DelegateInfo,
+ InitializeInfo,
+ SplitInfo,
+ WithdrawInfo,
+} from "./types";
type DetailsProps = {
tx: ParsedTransaction;
@@ -27,21 +34,32 @@ type DetailsProps = {
export function StakeDetailsCard(props: DetailsProps) {
try {
const parsed = coerce(props.ix.parsed, ParsedInfo);
- const info = coerce(parsed.info, IX_STRUCTS[parsed.type]);
switch (parsed.type) {
- case "initialize":
+ case "initialize": {
+ const info = coerce(parsed.info, InitializeInfo);
return ;
- case "delegate":
+ }
+ case "delegate": {
+ const info = coerce(parsed.info, DelegateInfo);
return ;
- case "authorize":
+ }
+ case "authorize": {
+ const info = coerce(parsed.info, AuthorizeInfo);
return ;
- case "split":
+ }
+ case "split": {
+ const info = coerce(parsed.info, SplitInfo);
return ;
- case "withdraw":
+ }
+ case "withdraw": {
+ const info = coerce(parsed.info, WithdrawInfo);
return ;
- case "deactivate":
+ }
+ case "deactivate": {
+ const info = coerce(parsed.info, DeactivateInfo);
return ;
+ }
default:
return ;
}
diff --git a/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx b/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx
index 7f7faa75c4..7d06054f0a 100644
--- a/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx
+++ b/explorer/src/components/instruction/stake/WithdrawDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { lamportsToSolString } from "utils";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { WithdrawInfo } from "./types";
export function WithdrawDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: WithdrawInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/stake/types.ts b/explorer/src/components/instruction/stake/types.ts
index 5abb76cf7f..2b7cadad5e 100644
--- a/explorer/src/components/instruction/stake/types.ts
+++ b/explorer/src/components/instruction/stake/types.ts
@@ -3,7 +3,8 @@
import { enums, number, pick, string, StructType } from "superstruct";
import { Pubkey } from "validators/pubkey";
-const Initialize = pick({
+export type InitializeInfo = StructType;
+export const InitializeInfo = pick({
stakeAccount: Pubkey,
authorized: pick({
staker: Pubkey,
@@ -16,34 +17,39 @@ const Initialize = pick({
}),
});
-const Delegate = pick({
+export type DelegateInfo = StructType;
+export const DelegateInfo = pick({
stakeAccount: Pubkey,
voteAccount: Pubkey,
stakeAuthority: Pubkey,
});
-const Authorize = pick({
+export type AuthorizeInfo = StructType;
+export const AuthorizeInfo = pick({
authorityType: string(),
stakeAccount: Pubkey,
authority: Pubkey,
newAuthority: Pubkey,
});
-const Split = pick({
+export type SplitInfo = StructType;
+export const SplitInfo = pick({
stakeAccount: Pubkey,
stakeAuthority: Pubkey,
newSplitAccount: Pubkey,
lamports: number(),
});
-const Withdraw = pick({
+export type WithdrawInfo = StructType;
+export const WithdrawInfo = pick({
stakeAccount: Pubkey,
withdrawAuthority: Pubkey,
destination: Pubkey,
lamports: number(),
});
-const Deactivate = pick({
+export type DeactivateInfo = StructType;
+export const DeactivateInfo = pick({
stakeAccount: Pubkey,
stakeAuthority: Pubkey,
});
@@ -57,12 +63,3 @@ export const StakeInstructionType = enums([
"withdraw",
"deactivate",
]);
-
-export const IX_STRUCTS: { [id: string]: any } = {
- initialize: Initialize,
- delegate: Delegate,
- authorize: Authorize,
- split: Split,
- withdraw: Withdraw,
- deactivate: Deactivate,
-};
diff --git a/explorer/src/components/instruction/system/AllocateDetailsCard.tsx b/explorer/src/components/instruction/system/AllocateDetailsCard.tsx
index 135822de80..d7df2d8f1e 100644
--- a/explorer/src/components/instruction/system/AllocateDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/AllocateDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { AllocateInfo } from "./types";
export function AllocateDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AllocateInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/AllocateWithSeedDetailsCard.tsx b/explorer/src/components/instruction/system/AllocateWithSeedDetailsCard.tsx
index 88ca44b8e6..69ac69e25f 100644
--- a/explorer/src/components/instruction/system/AllocateWithSeedDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/AllocateWithSeedDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { InstructionCard } from "../InstructionCard";
import { Copyable } from "components/common/Copyable";
import { Address } from "components/common/Address";
+import { AllocateWithSeedInfo } from "./types";
export function AllocateWithSeedDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AllocateWithSeedInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/AssignDetailsCard.tsx b/explorer/src/components/instruction/system/AssignDetailsCard.tsx
index 40599e4e3f..6fb5d4f761 100644
--- a/explorer/src/components/instruction/system/AssignDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/AssignDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { AssignInfo } from "./types";
export function AssignDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AssignInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/AssignWithSeedDetailsCard.tsx b/explorer/src/components/instruction/system/AssignWithSeedDetailsCard.tsx
index 4123e254ab..6356dd748a 100644
--- a/explorer/src/components/instruction/system/AssignWithSeedDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/AssignWithSeedDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { InstructionCard } from "../InstructionCard";
import { Copyable } from "components/common/Copyable";
import { Address } from "components/common/Address";
+import { AssignWithSeedInfo } from "./types";
export function AssignWithSeedDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AssignWithSeedInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/CreateDetailsCard.tsx b/explorer/src/components/instruction/system/CreateDetailsCard.tsx
index 478d9173e8..7cfd9333be 100644
--- a/explorer/src/components/instruction/system/CreateDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/CreateDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { lamportsToSolString } from "utils";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { CreateAccountInfo } from "./types";
export function CreateDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: CreateAccountInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/CreateWithSeedDetailsCard.tsx b/explorer/src/components/instruction/system/CreateWithSeedDetailsCard.tsx
index 41ab86f0d8..c5d4588b77 100644
--- a/explorer/src/components/instruction/system/CreateWithSeedDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/CreateWithSeedDetailsCard.tsx
@@ -8,12 +8,13 @@ import { lamportsToSolString } from "utils";
import { InstructionCard } from "../InstructionCard";
import { Copyable } from "components/common/Copyable";
import { Address } from "components/common/Address";
+import { CreateAccountWithSeedInfo } from "./types";
export function CreateWithSeedDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: CreateAccountWithSeedInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx b/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx
index 942f3e468a..7b5bd5d3a4 100644
--- a/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/NonceAdvanceDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { AdvanceNonceAccountInfo } from "./types";
export function NonceAdvanceDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AdvanceNonceAccountInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx b/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx
index dddff72080..766f0aa262 100644
--- a/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/NonceAuthorizeDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { AuthorizeNonceAccountInfo } from "./types";
export function NonceAuthorizeDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: AuthorizeNonceAccountInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx b/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx
index dd1b1a0db3..da7c184879 100644
--- a/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/NonceInitializeDetailsCard.tsx
@@ -6,12 +6,13 @@ import {
} from "@solana/web3.js";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { InitializeNonceAccountInfo } from "./types";
export function NonceInitializeDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: InitializeNonceAccountInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx b/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx
index 605d4a94dd..26d3e09a30 100644
--- a/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/NonceWithdrawDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { lamportsToSolString } from "utils";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { WithdrawNonceAccountInfo } from "./types";
export function NonceWithdrawDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: WithdrawNonceAccountInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/SystemDetailsCard.tsx b/explorer/src/components/instruction/system/SystemDetailsCard.tsx
index 1e9b2d2c69..dee0d4b130 100644
--- a/explorer/src/components/instruction/system/SystemDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/SystemDetailsCard.tsx
@@ -20,7 +20,19 @@ import { NonceAuthorizeDetailsCard } from "./NonceAuthorizeDetailsCard";
import { ParsedInfo } from "validators";
import { coerce } from "superstruct";
import { reportError } from "utils/sentry";
-import { IX_STRUCTS } from "./types";
+import {
+ CreateAccountInfo,
+ CreateAccountWithSeedInfo,
+ AllocateInfo,
+ AllocateWithSeedInfo,
+ AssignInfo,
+ AssignWithSeedInfo,
+ TransferInfo,
+ AdvanceNonceAccountInfo,
+ AuthorizeNonceAccountInfo,
+ InitializeNonceAccountInfo,
+ WithdrawNonceAccountInfo,
+} from "./types";
type DetailsProps = {
tx: ParsedTransaction;
@@ -32,31 +44,51 @@ type DetailsProps = {
export function SystemDetailsCard(props: DetailsProps) {
try {
const parsed = coerce(props.ix.parsed, ParsedInfo);
- const info = coerce(parsed.info, IX_STRUCTS[parsed.type]);
-
switch (parsed.type) {
- case "createAccount":
+ case "createAccount": {
+ const info = coerce(parsed.info, CreateAccountInfo);
return ;
- case "createAccountWithSeed":
+ }
+ case "createAccountWithSeed": {
+ const info = coerce(parsed.info, CreateAccountWithSeedInfo);
return ;
- case "allocate":
+ }
+ case "allocate": {
+ const info = coerce(parsed.info, AllocateInfo);
return ;
- case "allocateWithSeed":
+ }
+ case "allocateWithSeed": {
+ const info = coerce(parsed.info, AllocateWithSeedInfo);
return ;
- case "assign":
+ }
+ case "assign": {
+ const info = coerce(parsed.info, AssignInfo);
return ;
- case "assignWithSeed":
+ }
+ case "assignWithSeed": {
+ const info = coerce(parsed.info, AssignWithSeedInfo);
return ;
- case "transfer":
+ }
+ case "transfer": {
+ const info = coerce(parsed.info, TransferInfo);
return ;
- case "advanceNonceAccount":
+ }
+ case "advanceNonceAccount": {
+ const info = coerce(parsed.info, AdvanceNonceAccountInfo);
return ;
- case "withdrawNonceAccount":
+ }
+ case "withdrawNonceAccount": {
+ const info = coerce(parsed.info, WithdrawNonceAccountInfo);
return ;
- case "authorizeNonceAccount":
+ }
+ case "authorizeNonceAccount": {
+ const info = coerce(parsed.info, AuthorizeNonceAccountInfo);
return ;
- case "initializeNonceAccount":
+ }
+ case "initializeNonceAccount": {
+ const info = coerce(parsed.info, InitializeNonceAccountInfo);
return ;
+ }
default:
return ;
}
diff --git a/explorer/src/components/instruction/system/TransferDetailsCard.tsx b/explorer/src/components/instruction/system/TransferDetailsCard.tsx
index bb3823238a..3b6da29cb8 100644
--- a/explorer/src/components/instruction/system/TransferDetailsCard.tsx
+++ b/explorer/src/components/instruction/system/TransferDetailsCard.tsx
@@ -7,12 +7,13 @@ import {
import { lamportsToSolString } from "utils";
import { InstructionCard } from "../InstructionCard";
import { Address } from "components/common/Address";
+import { TransferInfo } from "./types";
export function TransferDetailsCard(props: {
ix: ParsedInstruction;
index: number;
result: SignatureResult;
- info: any;
+ info: TransferInfo;
}) {
const { ix, index, result, info } = props;
diff --git a/explorer/src/components/instruction/system/types.ts b/explorer/src/components/instruction/system/types.ts
index 12ff1a9699..8f64821a0f 100644
--- a/explorer/src/components/instruction/system/types.ts
+++ b/explorer/src/components/instruction/system/types.ts
@@ -3,7 +3,8 @@
import { enums, number, pick, string, StructType } from "superstruct";
import { Pubkey } from "validators/pubkey";
-const CreateAccount = pick({
+export type CreateAccountInfo = StructType;
+export const CreateAccountInfo = pick({
source: Pubkey,
newAccount: Pubkey,
lamports: number(),
@@ -11,18 +12,23 @@ const CreateAccount = pick({
owner: Pubkey,
});
-const Assign = pick({
+export type AssignInfo = StructType;
+export const AssignInfo = pick({
account: Pubkey,
owner: Pubkey,
});
-const Transfer = pick({
+export type TransferInfo = StructType;
+export const TransferInfo = pick({
source: Pubkey,
destination: Pubkey,
lamports: number(),
});
-const CreateAccountWithSeed = pick({
+export type CreateAccountWithSeedInfo = StructType<
+ typeof CreateAccountWithSeedInfo
+>;
+export const CreateAccountWithSeedInfo = pick({
source: Pubkey,
newAccount: Pubkey,
base: Pubkey,
@@ -32,35 +38,49 @@ const CreateAccountWithSeed = pick({
owner: Pubkey,
});
-const AdvanceNonceAccount = pick({
+export type AdvanceNonceAccountInfo = StructType<
+ typeof AdvanceNonceAccountInfo
+>;
+export const AdvanceNonceAccountInfo = pick({
nonceAccount: Pubkey,
nonceAuthority: Pubkey,
});
-const WithdrawNonceAccount = pick({
+export type WithdrawNonceAccountInfo = StructType<
+ typeof WithdrawNonceAccountInfo
+>;
+export const WithdrawNonceAccountInfo = pick({
nonceAccount: Pubkey,
destination: Pubkey,
nonceAuthority: Pubkey,
lamports: number(),
});
-const InitializeNonceAccount = pick({
+export type InitializeNonceAccountInfo = StructType<
+ typeof InitializeNonceAccountInfo
+>;
+export const InitializeNonceAccountInfo = pick({
nonceAccount: Pubkey,
nonceAuthority: Pubkey,
});
-const AuthorizeNonceAccount = pick({
+export type AuthorizeNonceAccountInfo = StructType<
+ typeof AuthorizeNonceAccountInfo
+>;
+export const AuthorizeNonceAccountInfo = pick({
nonceAccount: Pubkey,
nonceAuthority: Pubkey,
newAuthorized: Pubkey,
});
-const Allocate = pick({
+export type AllocateInfo = StructType;
+export const AllocateInfo = pick({
account: Pubkey,
space: number(),
});
-const AllocateWithSeed = pick({
+export type AllocateWithSeedInfo = StructType;
+export const AllocateWithSeedInfo = pick({
account: Pubkey,
base: Pubkey,
seed: string(),
@@ -68,14 +88,16 @@ const AllocateWithSeed = pick({
owner: Pubkey,
});
-const AssignWithSeed = pick({
+export type AssignWithSeedInfo = StructType;
+export const AssignWithSeedInfo = pick({
account: Pubkey,
base: Pubkey,
seed: string(),
owner: Pubkey,
});
-const TransferWithSeed = pick({
+export type TransferWithSeedInfo = StructType;
+export const TransferWithSeedInfo = pick({
source: Pubkey,
sourceBase: Pubkey,
destination: Pubkey,
@@ -97,19 +119,5 @@ export const SystemInstructionType = enums([
"withdrawNonceAccount",
"authorizeNonceAccount",
"initializeNonceAccount",
+ // "transferWithSeed", TODO: Add support for transfer with seed
]);
-
-export const IX_STRUCTS: { [id: string]: any } = {
- createAccount: CreateAccount,
- createAccountWithSeed: CreateAccountWithSeed,
- allocate: Allocate,
- allocateWithSeed: AllocateWithSeed,
- assign: Assign,
- assignWithSeed: AssignWithSeed,
- transfer: Transfer,
- advanceNonceAccount: AdvanceNonceAccount,
- withdrawNonceAccount: WithdrawNonceAccount,
- authorizeNonceAccount: AuthorizeNonceAccount,
- initializeNonceAccount: InitializeNonceAccount,
- transferWithSeed: TransferWithSeed, // TODO: Add support for transfer with seed
-};