novy-syndicate/src/protocol.ts

18 lines
551 B
TypeScript
Raw Normal View History

import { Attenuation } from './gen/sturdy.js';
import * as IO from './gen/protocol.js';
import { Ref } from './actor.js';
2021-03-02 08:50:23 +00:00
export type WireSymbol = { oid: IO.Oid, ref: Ref, count: number };
2021-03-03 14:45:35 +00:00
export type WireRef =
| { loc: "mine", oid: IO.Oid }
| { loc: "your", oid: IO.Oid, attenuation: Attenuation };
2021-03-03 14:45:35 +00:00
export function myRef(oid: IO.Oid): WireRef & { loc: "mine" } {
2021-03-03 14:45:35 +00:00
return { loc: 'mine', oid };
}
export function yourRef(oid: IO.Oid, attenuation: Attenuation): WireRef & { loc: "your" } {
2021-03-03 14:45:35 +00:00
return { loc: 'your', oid, attenuation };
}