UNPKG

@scaffold-stark/stark-burner

Version:
51 lines (46 loc) 2.02 kB
import { InjectedConnector } from '@starknet-react/core'; import { AccountInterface } from 'starknet'; import { ConnectorIcons, ConnectorData } from '@starknet-react/core/src/connectors/base'; import { Chain } from '@starknet-react/chains'; import { RpcMessage, RequestFnCall, RpcTypeToMessageMap } from '@starknet-io/types-js'; type BurnerAccount = { accountAddress: string; privateKey: string; publicKey: string; }; declare const burnerAccounts: BurnerAccount[]; declare const burnerWalletId = "burner-wallet"; declare const burnerWalletName = "Burner Wallet"; declare class BurnerConnector extends InjectedConnector { chain: Chain; burnerAccount: BurnerAccount; constructor(); get id(): string; get name(): string; account(): Promise<AccountInterface>; available(): boolean; chainId(): Promise<bigint>; get icon(): ConnectorIcons; ready(): Promise<boolean>; request<T extends RpcMessage["type"]>(call: RequestFnCall<T>): Promise<RpcTypeToMessageMap[T]["result"]>; connect(): Promise<ConnectorData>; disconnect(): Promise<void>; } /** * Error list used by {@link BurnerConnectorError} */ declare const BurnerConnectorErrorList: { readonly accountNotFound: "Account not found"; readonly couldNotConnect: "Could not connect to network"; readonly unsupportedBurnerChain: "This network is not supported for burner connector"; readonly chainIdNotResolved: "Could not resolve chainId"; readonly chainNotSupported: "Chain is not supported, check burner wallet config"; }; /** * A union of all the BurnerConnectorErrorList */ type BurnerConnectorErrorTypes = (typeof BurnerConnectorErrorList)[keyof typeof BurnerConnectorErrorList]; declare class BurnerConnectorError extends Error { constructor(errorType: BurnerConnectorErrorTypes, message?: string); } export { type BurnerAccount, BurnerConnector, BurnerConnectorError, BurnerConnectorErrorList, type BurnerConnectorErrorTypes, burnerAccounts, burnerWalletId, burnerWalletName };