Key | Type | Comment |
---|---|---|
name | WalletName = string |
identifier |
prettyName | string |
display name |
mode | WalletMode = 'extension' | 'wallet-connect' |
wallet client type |
mobileDisabled* | boolean |
display on mobile or not |
* <span style={{fontSize: '0.85rem'}}> Usually true
when mode is wallet-connect
, false
when mode is extension
.
Key | Type | Comment |
---|---|---|
rejectMessage | string |
error message when reject permission to wallet app/extension |
connectEventNames | string[] |
window event names to fire auto-connect |
downloads | Downloads |
wallet app/extension download information |
logo | string |
wallet logo url, display on default modal |
MainWallet
is a class organizing all ChainWallet
s. It should extend MainWalletBase
class, in which protected _chainWallets
property stores all ChainWallet
s.
Key | Type |
---|---|
getAccount | (chainId: string) => Promise<WalletAccount> * |
getOfflineSigner | (chainId: string) => Promise<OfflineSigner> | OfflineSigner |
* Type WalletAccount
interface WalletAccount {
name?: string; // username
address: string;
}
Key | Type | Comment |
---|---|---|
enable | (chainIds: string | string[]) => Promise<void> |
give permission for the webpage to access wallet |
addChain | (chainInfo: ChainRecord) => Promise<void> |
add new Cosmos-SDK based blockchains that isn't natively integrated to wallet app/extension |
Create a ChainWallet
class that extends ChainWalletBase
. ChainWallet
provides wallet information for a particular chain, e.g. address
, offlineSigner
, etc.
ChainWalletBase
has implemented a bunch of methods such as wallet connection, sign, broadcast, etc. [learn more]. Therefore, normally you don't need to do any extra work inside ChainWallet
. But feel free to overwrite these methods or add new methods/properties if customization is needed to meet new demand.
Create a MainWallet
class that extends MainWalletBase
. MainWallet
organizes all ChainWallet
s, which are stored in protected member _chainWallets
.
Note: Class
ChainWallet
created in Step 3 is required inMainWalletBase
construction.
Key | Type |
---|---|
fetchClient | () => WalletClient | undefined | Promise<WalletClient | undefined> * |
* <span style={{fontSize: '0.85rem'}}> WalletClient
is the one implemented in Step 2.
Also, feel free to overwrite methods in MainWalletBase
or add new methods/properties if necessary.
You can construct your MainWallet
Instance according to your MainWallet
construct method now. Usually the walletInfo
object prepared in Step 1 is imported here as a construction argument.
Last but not least, append this instance to the wallets
property of WalletProvider.