UNPKG

@wormhole-foundation/sdk-sui

Version:

SDK for Sui chains, used in conjunction with @wormhole-foundation/sdk

33 lines 1.13 kB
import { normalizeSuiType } from "./address.js"; export const _platform = "Sui"; export const getFieldsFromObjectResponse = (object) => { const content = object.data?.content; return content && content.dataType === "moveObject" ? content.fields : null; }; export const isSameType = (a, b) => { try { return normalizeSuiType(a) === normalizeSuiType(b); } catch { return false; } }; // Event typeguard helpers export const isSuiCreateEvent = (event) => event?.type === "created"; export const isSuiPublishEvent = (event) => event?.type === "published"; // // MoveStruct typeguard helpers // export function isMoveStructArray(value) { return Array.isArray(value); } export function isMoveStructStruct(value) { return !Array.isArray(value) && typeof value === "object" && "fields" in value && "type" in value; } export function isMoveStructObject(value) { return typeof value === "object" && !isMoveStructArray(value) && !isMoveStructStruct(value); } export function isMoveStructId(value) { return typeof value === "object" && "id" in value; } //# sourceMappingURL=types.js.map