Use engine-version of resolveInivitationReferences

This commit is contained in:
2026-06-29 21:03:42 +10:00
parent cfcba02bb3
commit 051fc0c9ac
4 changed files with 9 additions and 755 deletions
+8 -11
View File
@@ -7,8 +7,10 @@ import {
generateTemplateIdentifier,
hasInvitationExpired,
mergeInvitationCommits,
resolveCommitReferences,
serializeInvitation,
deserializeInvitation,
type ResolvedInvitationData,
} from "@xo-cash/engine";
import type {
XOInvitation,
@@ -35,13 +37,9 @@ import type { BlockchainService } from "./electrum.js";
import { EventEmitter } from "../utils/event-emitter.js";
import { decodeExtendedJsonObject } from "../utils/ext-json.js";
import {
resolveCommitReferences,
type ResolvedInvitationData,
} from "../utils/resolve-invitation-data.js";
import { compileCashAssemblyString } from "@xo-cash/engine";
export type { ResolvedInvitationData } from "../utils/resolve-invitation-data.js";
export type { ResolvedInvitationData } from "@xo-cash/engine";
export type InvitationEventMap = {
"invitation-updated": XOInvitation;
@@ -613,10 +611,7 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
// Append the commit to the invitation
this.updateInvitationData(
await this.engine.appendInvitation(
this.data.invitationIdentifier,
data,
),
await this.engine.appendInvitation(this.data.invitationIdentifier, data),
);
// Sync the invitation to the sync server
@@ -894,13 +889,15 @@ export class Invitation extends EventEmitter<InvitationEventMap> {
/**
* Removes the invitation from the Local SQLite db as well as the Engine's internal DB
* NOTE: This uses methods that are marked "DANGEROUSLY" inside the engine and behaviour may change
*/
*/
public async delete() {
// Remove the invitation from our local db
this.storage.remove(this.data.invitationIdentifier);
// Remove the invitation from the engine's internal db
await this.engine.DANGEROUS_deleteStoredInvitation(this.data.invitationIdentifier);
await this.engine.DANGEROUS_deleteStoredInvitation(
this.data.invitationIdentifier,
);
this.emit("invitation-removed", this.data.invitationIdentifier);