novy-syndicate/src/protocol.ts

18 lines
551 B
TypeScript

import { Attenuation } from './gen/sturdy.js';
import * as IO from './gen/protocol.js';
import { Ref } from './actor.js';
export type WireSymbol = { oid: IO.Oid, ref: Ref, count: number };
export type WireRef =
| { loc: "mine", oid: IO.Oid }
| { loc: "your", oid: IO.Oid, attenuation: Attenuation };
export function myRef(oid: IO.Oid): WireRef & { loc: "mine" } {
return { loc: 'mine', oid };
}
export function yourRef(oid: IO.Oid, attenuation: Attenuation): WireRef & { loc: "your" } {
return { loc: 'your', oid, attenuation };
}