Library to make it easy to work with metamask in typescript
@raydeck/metamask-ts - v1.0.2
- AddEthereumChainParameter
- ConnectInfo
- ProviderMessage
- ProviderRpcError
- RequestedPermissions
- SwitchEthereumChainParameter
- WatchAssetParams
- Web3WalletPermission
- eth_accounts
- eth_chainId
- eth_decrypt
- eth_getEncryptionPublicKey
- eth_requestAccounts
- isConnected
- listen
- onAccountsChanged
- onChainChanged
- onConnect
- onDisconnect
- onMessage
- wallet_addEthereumChain
- wallet_getPermissions
- wallet_registerOnboardingCompleted
- wallet_requestPermissions
- wallet_scanQRCode
- wallet_switchEthereumChain
- wallet_watchAsset
Ƭ MetamaskEvents: "accountsChanged"
| "chainChanged"
| "connect"
| "disconnect"
| "message"
• isEthereum: true
▸ Const
eth_accounts(): Promise
<string
[]>
Promise
<string
[]>
▸ Const
eth_chainId(): Promise
<string
>
Promise
<string
>
▸ Const
eth_decrypt(message
, accountId?
): Promise
<string
>
Name | Type |
---|---|
message |
string |
accountId? |
string |
Promise
<string
>
▸ Const
eth_getEncryptionPublicKey(accountId
): Promise
<string
>
Name | Type |
---|---|
accountId |
string |
Promise
<string
>
▸ Const
eth_requestAccounts(): Promise
<string
[]>
Promise
<string
[]>
▸ Const
isConnected(): boolean
boolean
▸ Const
listen<T
>(event
, handler
): () => void
Name |
---|
T |
Name | Type |
---|---|
event |
MetamaskEvents |
handler |
(args : T ) => void |
fn
▸ (): void
void
▸ Const
onAccountsChanged(handler
): () => void
Name | Type |
---|---|
handler |
(accounts : string []) => void |
fn
▸ (): void
void
▸ Const
onChainChanged(handler
): () => void
Name | Type |
---|---|
handler |
(chain : string ) => void |
fn
▸ (): void
void
▸ Const
onConnect(handler
): () => void
Name | Type |
---|---|
handler |
(connectInfo : ConnectInfo ) => void |
fn
▸ (): void
void
▸ Const
onDisconnect(handler
): () => void
Name | Type |
---|---|
handler |
(error : ProviderRpcError ) => void |
fn
▸ (): void
void
▸ Const
onMessage(handler
): () => void
Name | Type |
---|---|
handler |
(message : ProviderMessage ) => void |
fn
▸ (): void
void
▸ Const
wallet_addEthereumChain(chainParameter
): Promise
<null
>
Name | Type |
---|---|
chainParameter |
AddEthereumChainParameter |
Promise
<null
>
▸ Const
wallet_getPermissions(): Promise
<Web3WalletPermission
[]>
Promise
<Web3WalletPermission
[]>
▸ Const
wallet_registerOnboardingCompleted(): Promise
<boolean
>
Promise
<boolean
>
▸ Const
wallet_requestPermissions(permissions
): Promise
<Web3WalletPermission
[]>
Name | Type |
---|---|
permissions |
RequestedPermissions |
Promise
<Web3WalletPermission
[]>
▸ Const
wallet_scanQRCode(regex?
): Promise
<string
>
Name | Type |
---|---|
regex? |
string |
Promise
<string
>
▸ Const
wallet_switchEthereumChain(chainId
): Promise
<null
>
Name | Type |
---|---|
chainId |
string |
Promise
<null
>
▸ Const
wallet_watchAsset(params
): Promise
<boolean
>
Name | Type |
---|---|
params |
WatchAssetParams |
Promise
<boolean
>
@raydeck/metamask-ts - v1.0.2 / AddEthereumChainParameter
• Optional
blockExplorerUrls: string
[]
• chainId: string
• chainName: string
• Optional
iconUrls: string
[]
• nativeCurrency: Object
Name | Type |
---|---|
decimals |
18 |
name |
string |
symbol |
string |
• rpcUrls: string
[]
@raydeck/metamask-ts - v1.0.2 / ConnectInfo
• chainId: string
@raydeck/metamask-ts - v1.0.2 / ProviderMessage
• data: unknown
• type: string
@raydeck/metamask-ts - v1.0.2 / ProviderRpcError
-
Error
↳
ProviderRpcError
• code: number
• Optional
data: unknown
• message: string
Error.message
• name: string
Error.name
node_modules/typescript/lib/lib.es5.d.ts:973
• Optional
stack: string
Error.stack
node_modules/typescript/lib/lib.es5.d.ts:975
@raydeck/metamask-ts - v1.0.2 / RequestedPermissions
▪ [methodName: string
]: {}
@raydeck/metamask-ts - v1.0.2 / SwitchEthereumChainParameter
• chainId: string
@raydeck/metamask-ts - v1.0.2 / WatchAssetParams
• options: Object
Name | Type |
---|---|
address |
string |
decimals |
number |
image |
string |
symbol |
string |
• type: "ERC20"
@raydeck/metamask-ts - v1.0.2 / Web3WalletPermission
• Optional
date: number
• parentCapability: string