explorer: wrap bytes on bpf-loader-2 write instruction (#13253)
This commit is contained in:
@ -1,15 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { TransactionInstruction } from "@solana/web3.js";
|
import { TransactionInstruction } from "@solana/web3.js";
|
||||||
import { Address } from "components/common/Address";
|
import { Address } from "components/common/Address";
|
||||||
|
import { wrap } from "utils";
|
||||||
function wrap(input: string, length: number): string {
|
|
||||||
var result = [];
|
|
||||||
while (input.length) {
|
|
||||||
result.push(input.substr(0, length));
|
|
||||||
input = input.substr(length);
|
|
||||||
}
|
|
||||||
return result.join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
export function RawDetails({ ix }: { ix: TransactionInstruction }) {
|
export function RawDetails({ ix }: { ix: TransactionInstruction }) {
|
||||||
const data = wrap(ix.data.toString("hex"), 50);
|
const data = wrap(ix.data.toString("hex"), 50);
|
||||||
|
@ -12,6 +12,7 @@ import { IX_STRUCTS } from "./types";
|
|||||||
import { reportError } from "utils/sentry";
|
import { reportError } from "utils/sentry";
|
||||||
import { UnknownDetailsCard } from "../UnknownDetailsCard";
|
import { UnknownDetailsCard } from "../UnknownDetailsCard";
|
||||||
import { Address } from "components/common/Address";
|
import { Address } from "components/common/Address";
|
||||||
|
import { wrap } from "utils";
|
||||||
|
|
||||||
type DetailsProps = {
|
type DetailsProps = {
|
||||||
tx: ParsedTransaction;
|
tx: ParsedTransaction;
|
||||||
@ -50,7 +51,7 @@ type Props = {
|
|||||||
|
|
||||||
export function BpfLoaderWriteDetailsCard(props: Props) {
|
export function BpfLoaderWriteDetailsCard(props: Props) {
|
||||||
const { ix, index, result, info } = props;
|
const { ix, index, result, info } = props;
|
||||||
|
const bytes = wrap(info.bytes, 50);
|
||||||
return (
|
return (
|
||||||
<InstructionCard
|
<InstructionCard
|
||||||
ix={ix}
|
ix={ix}
|
||||||
@ -77,7 +78,7 @@ export function BpfLoaderWriteDetailsCard(props: Props) {
|
|||||||
Bytes <span className="text-muted">(base 64)</span>
|
Bytes <span className="text-muted">(base 64)</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="text-lg-right">
|
<td className="text-lg-right">
|
||||||
<code className="d-inline-block">{info.bytes}</code>
|
<pre className="d-inline-block text-left mb-0">{bytes}</pre>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ const Initialize = pick({
|
|||||||
withdrawer: Pubkey,
|
withdrawer: Pubkey,
|
||||||
}),
|
}),
|
||||||
lockup: pick({
|
lockup: pick({
|
||||||
epoch: number(),
|
|
||||||
unixTimestamp: number(),
|
unixTimestamp: number(),
|
||||||
|
epoch: number(),
|
||||||
custodian: Pubkey,
|
custodian: Pubkey,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -90,3 +90,12 @@ export function slotsToHumanString(
|
|||||||
): string {
|
): string {
|
||||||
return HUMANIZER.humanize(slots * slotTime);
|
return HUMANIZER.humanize(slots * slotTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function wrap(input: string, length: number): string {
|
||||||
|
var result = [];
|
||||||
|
while (input.length) {
|
||||||
|
result.push(input.substr(0, length));
|
||||||
|
input = input.substr(length);
|
||||||
|
}
|
||||||
|
return result.join("\n");
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user