// global.d.ts type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject export interface JsonObject { [key: string]: JsonValue } interface DeploymentContractParams { name?: string body: string widl: string init_args?: string } interface ExecutionContractParams { address: string method: string arguments: JsonObject } export interface SubmitTransactionParams { toAddress: string contract: | ({ type: 'SmartContractCreator' } & DeploymentContractParams & { pod: string }) | ({ type: 'SmartContractExecutor' } & ExecutionContractParams) nonce?: number } interface AccountsRequestParams { method: 'weil_requestAccounts' } interface AccountRequestParams { method: 'weil_accounts' } interface CheckConnectionRequestParams { method: 'check_connection' } interface DisconnectRequestParams { method: 'wallet_disconnect' } interface GetRegistryRequestParams { method: 'wallet_getRegistry' } interface UpdateRegistryRequestParams { method: 'wallet_updateRegistry' params: Record> } interface PermissionsRequestParams { method: 'wallet_requestPermissions' } interface SettingsRequestParams { method: 'wallet_getSettings' } interface SendTransactionRequestParams { method: 'weil_sendTransaction' params: SubmitTransactionParams[] } interface UnlockWalletRequestParams { method: 'wallet_unlock' } interface OpenWalletRequestParams { method: 'wallet_open' } type WalletRequest = ( params: | AccountsRequestParams | AccountRequestParams | CheckConnectionRequestParams | DisconnectRequestParams | GetRegistryRequestParams | UpdateRegistryRequestParams | PermissionsRequestParams | SettingsRequestParams | SendTransactionRequestParams | UnlockWalletRequestParams | OpenWalletRequestParams, ) => any export type WeilWalletProvider = { request: WalletRequest on: (eventName: string, callback: any) => void off: (eventName: string, callback: any) => void onResponse: (requestId: string, callback: any) => void offResponse: (requestId: string, callback: any) => void isConnected: () => boolean isSetUp: () => Promise isUnlocked: () => Promise } declare global { interface Window { WeilWallet: WeilWalletProvider } } export {}