-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
39 lines (32 loc) · 1.26 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { IProvider, ProviderInput, EIP6963ProviderInfo } from "./types";
import { AbstractionProvider } from "./provider";
const announceProvider: Function = (provider: IProvider) => {
const info: EIP6963ProviderInfo = {
uuid: Math.random().toString(36).substring(2),
name: "Abstraction Wallet",
icon: "https://raw.githubusercontent.com/abstraction-hq/abstraction-wallet-extension/main/assets/logo.svg",
rdns: "world.abstraction.wallet",
};
window.dispatchEvent(
new CustomEvent("eip6963:announceProvider", {
detail: Object.freeze({ info, provider: provider }),
})
);
window.removeEventListener("eip6963:requestProvider", () => {})
};
const initAbstractionWallet: Function = (providerInput?: ProviderInput) => {
const provider = new AbstractionProvider(providerInput);
window.addEventListener("eip6963:requestProvider", () => {
announceProvider(provider);
});
};
const createAbstractionProvider: Function = (providerInput?: ProviderInput): IProvider => {
const provider = new AbstractionProvider(providerInput);
return provider;
};
export { initAbstractionWallet, createAbstractionProvider };
export * from "./communicator"
export * from "./types"
export * from "./constants"
export * from "./provider"
export * from "./utils"