laconic-wallet/src/types.ts
shreerang6921 3809ce88b1 Update keystore data structure (#88)
* Update keystore data structure (#83)

* Update create wallet and retrieve accounts functionality for updated data structure

* Refactor accounts state

* Use constant variable for cosmos

* Update add accounts incrementally and with custom HD path for updated data structure (#85)

* Change data structure

* Reset wallet change

* Fix signEthMessage

* Fix sign request

* Fix pairing with laconic pay dApp and sending tokens

* Add accounts to configured networks

* Update add account from hd path flow

* Handle review changes

---------

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>

* Remove network type state

* Refactor create wallet code (#89)

* Refactor create wallet code

* Create cosmos accounts with correct address prefix

* Use networks data from state while creating wallet

* Refactor code and add network id in types (#91)

* Refactor add new networks component

* Add selected network state in context

* Remove returning account from create wallet

---------

Co-authored-by: IshaVenikar <145848618+IshaVenikar@users.noreply.github.com>
2024-04-25 17:08:27 +05:30

125 lines
2.7 KiB
TypeScript

import { PopulatedTransaction } from 'ethers';
import { SignClientTypes, SessionTypes } from '@walletconnect/types';
import { Web3WalletTypes } from '@walletconnect/web3wallet';
export type StackParamsList = {
Laconic: undefined;
SignMessage: {
selectedNamespace: string;
selectedChainId: string;
accountInfo: Account;
};
SignRequest: {
namespace: string;
address: string;
message: string;
requestEvent?: Web3WalletTypes.SessionRequest;
requestSessionData?: SessionTypes.Struct;
};
ApproveTransaction: {
transaction: PopulatedTransaction;
requestEvent: Web3WalletTypes.SessionRequest;
requestSessionData: SessionTypes.Struct;
};
InvalidPath: undefined;
WalletConnect: undefined;
AddSession: undefined;
AddNetwork: undefined;
};
export type Account = {
index: number;
pubKey: string;
address: string;
hdPath: string;
};
export type AccountsProps = {
currentIndex: number;
updateIndex: (index: number) => void;
};
export type NetworkDropdownProps = {
updateNetwork: (networksData: NetworksDataState) => void;
};
export type NetworksFormData = {
networkName: string;
rpcUrl: string;
chainId: string;
currencySymbol?: string;
blockExplorerUrl?: string;
namespace: string;
nativeDenom?: string;
addressPrefix?: string;
coinType?: string;
isDefault: boolean;
};
export interface NetworksDataState extends NetworksFormData {
networkId: string;
}
export type SignMessageParams = {
message: string;
namespace: string;
chainId: string;
accountId: number;
};
export type CreateWalletProps = {
isWalletCreating: boolean;
createWalletHandler: () => Promise<void>;
};
export type ResetDialogProps = {
visible: boolean;
hideDialog: () => void;
onConfirm: () => void;
};
export type HDPathDialogProps = {
pathCode: string;
visible: boolean;
hideDialog: () => void;
updateIndex: (index: number) => void;
updateAccounts: (account: Account) => void;
};
export type CustomDialogProps = {
visible: boolean;
hideDialog: () => void;
contentText: string;
titleText?: string;
};
export type GridViewProps = {
words: string[];
};
export type PathState = {
firstNumber: string;
secondNumber: string;
thirdNumber: string;
};
export interface PairingModalProps {
visible: boolean;
setModalVisible: (arg1: boolean) => void;
currentProposal:
| SignClientTypes.EventArguments['session_proposal']
| undefined;
setCurrentProposal: (
arg1: SignClientTypes.EventArguments['session_proposal'] | undefined,
) => void;
setToastVisible: (arg1: boolean) => void;
}
export interface WalletConnectContextProps {
activeSessions: Record<string, SessionTypes.Struct>;
setActiveSessions: (
activeSessions: Record<string, SessionTypes.Struct>,
) => void;
}