Skip to content

Commit

Permalink
refactor(frontend): destruct actor (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker authored Oct 26, 2023
1 parent 3bea6be commit efd6ed1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/frontend/src/lib/api/backend.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { OptionIdentity } from '$lib/types/identity';
import { getBackendActor } from '$lib/utils/actor.utils';

export const getEthAddress = async (identity: OptionIdentity): Promise<ECDSA_PUBLIC_KEY> => {
const actor = await getBackendActor(identity);
return actor.caller_eth_address();
const { caller_eth_address } = await getBackendActor(identity);
return caller_eth_address();
};

export const signTransaction = async ({
Expand All @@ -15,8 +15,8 @@ export const signTransaction = async ({
transaction: SignRequest;
identity: OptionIdentity;
}): Promise<string> => {
const actor = await getBackendActor(identity);
return actor.sign_transaction(transaction);
const { sign_transaction } = await getBackendActor(identity);
return sign_transaction(transaction);
};

export const signMessage = async ({
Expand All @@ -26,8 +26,8 @@ export const signMessage = async ({
message: string;
identity: OptionIdentity;
}): Promise<string> => {
const actor = await getBackendActor(identity);
return actor.personal_sign(message);
const { personal_sign } = await getBackendActor(identity);
return personal_sign(message);
};

export const signPrehash = async ({
Expand All @@ -37,6 +37,6 @@ export const signPrehash = async ({
hash: string;
identity: OptionIdentity;
}): Promise<string> => {
const actor = await getBackendActor(identity);
return actor.sign_prehash(hash);
const { sign_prehash } = await getBackendActor(identity);
return sign_prehash(hash);
};

0 comments on commit efd6ed1

Please sign in to comment.