/** * @pwngh/economy-lab * * Copyright (c) Preston Neal * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ import { encodeAmount } from '../money.js'; import type { Amount } from '../money.js'; import type { Transaction } from '../contract.js'; import type { Attempt, InboxMessage, Lot, Movement, Posting, PromoGrant, Saga, Sale, Statement, StoredLink, Subscription, Velocity } from '../ports.js'; type WireLeg = { account: string; amount: string; }; /** * Encoders to the JSON wire shape, one per record type the adapter sends. * * @see {@link https://economy-lab-docs.pages.dev/economy/ports/storage/ Storage} for how the store adapter ports move records over the wire. */ export declare const encodeWire: { amount: typeof encodeAmount; movement: (movement: Movement) => unknown; posting: (posting: Posting) => { txnId: string; legs: WireLeg[]; meta: Record; }; storedLink: (link: StoredLink) => unknown; transaction: (transaction: Transaction) => unknown; sale: (sale: Sale) => unknown; saga: (saga: Saga) => unknown; sagaPatch: (patch: Partial) => unknown; subscription: (sub: Subscription) => unknown; promoGrant: (grant: PromoGrant) => unknown; attempt: (attempt: Attempt) => unknown; inboxMessage: (entry: InboxMessage) => unknown; }; /** * Decoders back to typed domain records, one per record type the adapter receives (reverse of * `encodeWire`). Plain wire strings that are branded id types in the domain are cast back here. */ export declare const decodeWire: { amount: (wire: unknown) => Amount; movement: (wire: unknown) => Movement; posting: (wire: unknown) => Posting; transaction: (wire: unknown) => Transaction; claim: (wire: unknown) => { claimed: true; } | { claimed: false; transaction: Transaction; }; sale: (wire: unknown) => Sale; saga: (wire: unknown) => Saga; subscription: (wire: unknown) => Subscription; promoGrant: (wire: unknown) => PromoGrant; inboxMessage: (wire: unknown) => InboxMessage; velocity: (wire: unknown) => Velocity; lot: (wire: unknown) => Lot; statement: (wire: unknown) => Statement; storedLink: (wire: unknown) => StoredLink; }; export {};