Files
tom goriunovandGitHub 401dc58402 Smart wallet auth (#3220)
* basic login button implementation

* refactoring and add dynamic auth button to the other pages

* connect wallet without authenticating an user

* login and logout user in blockscout account

* refactoring and RPC overrides

* authenticate user with connected wallet

* add ENS to profile button

* override evm chains and fix contract write with waas wallet

* disconnect wallet and fix docker build

* add dynamic imports to components that use web3 wallet packages

* refactor user profile directory

* clean up

* tweaks

* update pw ci script

* fix "connect wallet" button behavior

* handle linking email to profile with dynamic provider

* fix test

* async loading web3 hooks and remove dynamic loading from components that use them

* fix pw tests

* add account navigation in horizontal layout when auth provider is dynamic

* fix address verification modal

* review fixes

* spelling fixes
2026-02-18 19:42:44 +01:00

78 lines
2.2 KiB
TypeScript

import type { ApiResource } from '../../types';
import type { AddressTagsResponse, ApiKeys, CustomAbis, TransactionTagsResponse, UserInfo, WatchlistResponse } from 'types/api/account';
export const GENERAL_API_ACCOUNT_RESOURCES = {
// ACCOUNT
csrf: {
path: '/api/account/v2/get_csrf',
},
user_info: {
path: '/api/account/v2/user/info',
},
custom_abi: {
path: '/api/account/v2/user/custom_abis{/:id}',
pathParams: [ 'id' as const ],
},
watchlist: {
path: '/api/account/v2/user/watchlist{/:id}',
pathParams: [ 'id' as const ],
filterFields: [ ],
paginated: true,
},
private_tags_address: {
path: '/api/account/v2/user/tags/address{/:id}',
pathParams: [ 'id' as const ],
filterFields: [ ],
paginated: true,
},
private_tags_tx: {
path: '/api/account/v2/user/tags/transaction{/:id}',
pathParams: [ 'id' as const ],
filterFields: [ ],
paginated: true,
},
api_keys: {
path: '/api/account/v2/user/api_keys{/:id}',
pathParams: [ 'id' as const ],
},
// AUTH
auth_send_otp: {
path: '/api/account/v2/send_otp',
},
auth_confirm_otp: {
path: '/api/account/v2/confirm_otp',
},
auth_siwe_message: {
path: '/api/account/v2/siwe_message',
},
auth_siwe_verify: {
path: '/api/account/v2/authenticate_via_wallet',
},
auth_link_email: {
path: '/api/account/v2/email/link',
},
auth_link_address: {
path: '/api/account/v2/address/link',
},
auth_logout: {
path: '/api/account/auth/logout',
},
auth_dynamic: {
path: '/api/account/v2/authenticate_via_dynamic',
},
} satisfies Record<string, ApiResource>;
export type GeneralApiAccountResourceName = `general:${ keyof typeof GENERAL_API_ACCOUNT_RESOURCES }`;
/* eslint-disable @stylistic/indent */
export type GeneralApiAccountResourcePayload<R extends GeneralApiAccountResourceName> =
R extends 'general:user_info' ? UserInfo :
R extends 'general:custom_abi' ? CustomAbis :
R extends 'general:private_tags_address' ? AddressTagsResponse :
R extends 'general:private_tags_tx' ? TransactionTagsResponse :
R extends 'general:api_keys' ? ApiKeys :
R extends 'general:watchlist' ? WatchlistResponse :
never;
/* eslint-enable @stylistic/indent */