UNPKG

@stable-io/cctp-sdk-definitions

Version:

Definitions for the CCTP SDK

15 lines 944 B
// Copyright (c) 2025 Stable Technologies Inc // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. import { column, entries, zip, spread, nest } from "@stable-io/map-utils"; export function transform(layout, to, from) { return { binary: "bytes", layout, custom: { to, from } }; } export function unwrap(layout, item) { return transform(layout, derived => spread(derived, item.name), transformed => nest(transformed, item.name, item.layout.map(i => i.name))); } export const enumSwitchVariants = (variants) => zip([entries(column(variants, 0)), column(variants, 1)]); export const byteSwitchLayout = (idTag, layouts) => ({ binary: "switch", idSize: 1, idTag, layouts: layouts }); export const arrayLayout = (layout) => ({ binary: "array", layout }); //# sourceMappingURL=layouting.js.map