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!].
Clone
Clone the repo by running the command,
git clone https://github.com/getsafle/safleid-rootstock-sdk.git
Import the package into your project using,
const { SafleID } = require("./src/index");
Initialising
Initialise the constructor using your rootstock RPC URL like this,
const safleID = new SafleID(env, rpcUrl);
env
- The network to perform the blockchain queries. (valid values -mainnet
ortestnet
).rpcUrl
- RPC URL for the specified network env.
userAddress
- Address of the user.
safleId
- SafleId to be set.
from
- Address of the registrar.
privateKey
- Private Key of the registrar.
const response = await safleID.setSafleId({
userAddress: userAddress,
safleId,
from: registrarAddress,
privateKey, // registrar's private key
});
Transaction details.
userAddress
- Address of the user.
newSafleId
- New SafleId to be set.
from
- Address of the registrar.
privateKey
- Private Key of the registrar.
const response = await safleID.updateSafleId({
userAddress: userAddress,
newSafleId,
from: registrarAddress,
privateKey, // registrar's private key
});
Transaction details.
No inputs.
const isRegistrationPaused = await safleID.isRegistrationPaused();
If registration is paused - true
If registration is not paused - false
SafleId update count
address
- Address of the user to check the SafleId update count.
const updateCount = await safleID.getUpdateCount(address);
update count
If invalid or wrong address - Invalid address.
Retrieve the SafleId of a particular address
userAddress
- Address of the user to get the SafleId.
const safleId = await safleID.getSafleId(userAddress);
SafleId of the user
If invalid or wrong address - Invalid address.
safleId
- SafleId of the user to get the address.
const address = await safleID.getAddress(safleId);
Address of the user.
No inputs.
const fees = await safleID.safleIdFees();
SafleId registration fees.
address
- Address of the user.
index
- Index of the old SafleId.
const oldSafleId = await safleID.resolveOldSafleId(address, index);
Old safleId of the user at that index.