Skip to content

Commit

Permalink
Update asset validation
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Apr 5, 2024
1 parent 76e9c89 commit cc5c6b8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/validate/methods/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import { assetCode } from "./assetCode";
import { publicKey } from "./publicKey";
import { AssetObjectValue } from "@/types/types";

export const asset = (
asset: AssetObjectValue | undefined,
isRequired?: boolean,
) => {
export const asset = (asset: AssetObjectValue | undefined) => {
if (asset?.type && asset.type === "native") {
return false;
}

const invalid = Object.entries({
code: assetCode(asset?.code || "", asset?.type, isRequired),
issuer: publicKey(asset?.issuer || "", isRequired),
code: assetCode(asset?.code || "", asset?.type),
issuer: publicKey(asset?.issuer || ""),
}).reduce((res, cur) => {
const [key, value] = cur;

Expand Down

0 comments on commit cc5c6b8

Please sign in to comment.