Graphite Web3 Documentation
Basic Usage
Detect the provider (
window.graphite
)Call the
window.graphite.enable()
methodIf access is granted, use the available api
Available methods
graphite.enable(): Promise<bool>
Calling this method triggers a user interface that allows a user to approve or reject account access for a given dApp. This method returns a Promise that is resolved with an account if the user approves access or is rejected with an Error if the user rejects access.
graphite.isEnabled(): Promise<bool>
Returns true if the dApp is already connected to a user's wallet, or if requesting access would return true without user confirmation (e.g. the dApp is whitelisted), and false otherwise.
graphite.request(): Promise<Object>
JSON-RPC request to interact with the Graphite node.
graphite.getBalance(): Promise<number>
JSON-RPC request to interact with the Graphite node.
graphite.getAddress(): Promise<string>
Returns the active account.
graphite.getAccountInfo(): Promise<object>
Returns basic account information, such as balance, activation status, KYC level and KYC filter.
graphite.sendTx(params): Promise<string>
To send a transaction, use the sendTx
method where params
is a options object. The wallet should ask the user for permission, and if given, try to sign and send transactions. This returns the transaction hash, if the transaction was submitted successfully, otherwise throws an error
.
graphite.activateAccount(): Promise<string>
To send transactions on Graphite, a user needs to activate their account. This can be done using the method activateAccount
. The wallet should ask the user for permission to activate. This returns the transaction hash, if the transaction was submitted successfully, otherwise throws an error
. The account balance must be non-zero.
graphite.updateKycLevel(level): Promise<string>
To change the KYC level, use the method updateKycLevel
. The wallet should ask the user for permission to change the level. Returns the transaction hash, if transaction was submitted successfully, otherwise throws an error
. The account must already be activated and have a non-zero balance. The parameter level
can be from 1 to 3.
graphite.updateKycFilter(filter): Promise<string>
To change the KYC filter, use the method updateKycFilter
. The wallet should ask the user for permission to change the filter. Returns the transaction hash, if transaction was submitted successfully, otherwise throws an error
. The account must already be activated and have a non-zero balance. The parameter filter
can be from 1 to 3.
graphite.getLastKycRequest(): Promise<Object>
Returns the latest KYC request data for the user based on the active network.
Events
graphite.onNetworkChange(network)
Returns the network id (1 or 0) when the network was changed.
Last updated