This package is used to interact with Safle smart contracts. Registered Registrars can use this package to set and update safleId for the user.
Anyone can use this for SafleId Resolution.
For now the registrar process is manual, if you want to become one, drop us an email or engage on our social media channels. We will be making it democratic and decentralized soon, it's already in the smart contracts [Hint: You can build on it by yourself too!].
Disclaimer - This is WIP, and release in alpha.
Installation
Install the package by running the command,
npm install @getsafle/safle-identity-wallet
Import the package into your project using,
const safleId = require('@getsafle/safle-identity-wallet').SafleID;
Initialising
Initialise the constructor using your Infura secret key or RPC URL like this,
const safle = new safleId(env, rpcUrl);
env
- The network to perform the blockchain queries. (valid values -mainnet
ortestnet
).rpcUrl
- RPC URL for the specified network env.
Set SafleId
setSafleId()
userAddress
- Address of the user.
safleId
- SafleId to be set.
from
- Address of the registrar.
privateKey
- Private Key of the registrar.
Transaction details.
Update SafleId
updateSafleId()
userAddress
- Address of the user.
newSafleId
- New SafleId to be set.
from
- Address of the registrar.
privateKey
- Private Key of the registrar.
Transaction details.
Check if SafleId registration is paused,
isRegistrationPaused()
No inputs.
If registration is paused - true
If registration is not paused - false
SafleId update count
getUpdateCount()
address
- Address of the user to check the SafleId update count.
update count
If invalid or wrong address - Invalid address.
Retrieve the SafleId of a particular address
getSafleId()
userAddress
- Address of the user to get the SafleId.
SafleId of the user
If invalid or wrong address - Invalid address.
Retrieve the address of a particular SafleId
getAddress()
safleId
- SafleId of the user to get the address.
Address of the user.
Get the current SafleId registration fees
safleIdFees()
SafleId registration fees.
Resolve old safleIds of a user
resolveOldSafleId()
address
- Address of the user.
index
- Index of the old SafleId.
Old safleId of the user at that index.
Resolve safleId from coin address
coinAddressToSafleId()
coinAddress
- Coin address of the user.
safleId mapped to that coin address
Resolve coin address from safleId and chainId
safleIdToCoinAddress()
safleId
- SafleId of the user.
chainId
- ChainId of the chain for which the address has to be resolved.
Coin address for that particular safleId and chainId.
Want to contribute, we would ❤️ that!
We are a Global 🌏🌍🌎 team! 💪
Write to [email protected], or follow us on twitter, https://twitter.com/getsafle