1
0
forked from a/lifeto-shop
lifeto-shop/src/lib/lifeto/api.ts

41 lines
994 B
TypeScript
Raw Normal View History

2022-07-06 07:48:11 +00:00
import { trace } from "loglevel"
import { TricksterAccount, TricksterInventory } from "../trickster"
import { v4 as uuidv4 } from 'uuid';
export interface LTOApi {
GetInventory:(path:string)=>Promise<TricksterInventory>
GetAccounts:() =>Promise<Array<TricksterAccount>>
GetLoggedin: ()=>Promise<boolean>
}
export const TxnStates = ["PENDING","INFLIGHT","WAITING","ERROR","SUCCESS"] as const
export type TxnState = typeof TxnStates[number]
export interface TxnDetails {
item_uid: string | "galders"
count:number
origin:string
target:string
}
export abstract class BankReceipt {
action_id: string
details:TxnDetails
created:Date
constructor(details:TxnDetails) {
this.details = details
this.created = new Date()
this.action_id = uuidv4();
}
abstract state():Promise<TxnState>
abstract status():string
abstract progress():[number, number]
abstract error():string
}
export interface BankApi {
SendTxn: (txn:TxnDetails) => Promise<BankReceipt>
}