@aut-labs/d-aut
Version:
## Web Component - what it does
86 lines (85 loc) • 2.5 kB
TypeScript
import { MultiSigner } from '@aut-labs/sdk';
import { IAutButtonConfig } from '../components/AutButtonMenu/AutMenuUtils';
import { CamelCase } from './camel-case';
import { NetworkConfig } from './network';
export type S = {
address: string;
isConnecting: boolean;
isConnected: boolean;
chainId: number;
status: 'connected' | 'connecting' | 'disconnected' | 'reconnecting';
multiSigner: MultiSigner;
multiSignerId: string;
error?: string;
};
export type Connector = {
id: string;
name: string;
type?: string;
uid?: string;
icon?: string;
};
export interface EthersConnector {
state: S;
connectors: Connector[];
networks: NetworkConfig[];
connect: (c: Connector, network?: NetworkConfig) => Promise<S>;
setStateChangeCallback: (callback: (s: S) => void) => void;
disconnect: () => Promise<void>;
}
export interface EnvConfig {
API_URL: string;
GRAPH_API_URL: string;
IPFS_API_KEY: string;
IPFS_API_SECRET: string;
IPFS_GATEWAY_URL: string;
ENV: 'development' | 'production';
}
export interface SwAuthConfig<CSSObject> {
container?: HTMLElement;
config: IAutButtonConfig;
containerStyles?: CSSObject;
connector?: EthersConnector;
envConfig: EnvConfig;
subscribeToStore?: (state: any) => void;
}
export declare enum FlowConfigMode {
SignIn = "signin",
SignUp = "signup",
FreeMode = "freeMode"
}
export interface FlowConfig {
mode?: FlowConfigMode;
customCongratsMessage?: string;
}
export declare enum AttributesDefinitions {
'use-dev' = "boolean",
'hub-address' = "string",
'hide-button' = "boolean",
'ipfs-gateway' = "string",
'menu-items' = "object",
'network' = "object",
'flow-config' = "object",
'allowed-role-id' = "string"
}
type EnumKeys = keyof typeof AttributesDefinitions;
export type SwElementAttributes = {
[key in EnumKeys]: unknown | boolean | string | number;
};
export type SwAttributes = {
[K in keyof SwElementAttributes as CamelCase<K>]: SwElementAttributes[K];
};
export interface ShadowRootConfig<EmotionCache> {
cache: EmotionCache;
root: HTMLElement;
shadowRoot: HTMLElement;
mountPoint: HTMLElement;
}
export type AttributeCallbackFn = (name: string, value: string, newVal: string) => void;
export interface AutButtonProps {
attributes: SwAttributes;
container: HTMLElement;
config: IAutButtonConfig;
setAttrCallback: (fn: AttributeCallbackFn) => void;
}
export {};