Skip to content

Commit

Permalink
feat: add ain wallet signer
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonwoong committed Aug 21, 2023
1 parent 5743f4e commit 9f335a5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/signer/ain-wallet-signer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {Signer} from "./signer";

export class AinWalletSigner implements Signer {
private ainetwork: Signer;
constructor() {
if (window.ainetwork) {
this.ainetwork = window.ainetwork;
} else {
throw new Error("Not found ain wallet object");
}
}
getAddress(address?: string): string {
return this.ainetwork.getAddress(address);
}

signMessage(message: any, address?: string): Promise<string> | string {
return this.ainetwork.signMessage(message, address);
}
}
7 changes: 7 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { AxiosRequestConfig } from "axios";
import {Signer} from "./signer/signer";

declare global {
interface Window {
ainetwork: Signer;
}
}

export interface Account {
address: string;
Expand Down

0 comments on commit 9f335a5

Please sign in to comment.