Identity
The capabilities of Newcoin SDK fall into three categories: Identity, Markets, and Governance.
createUser
This function creates user and his root collection - for holding profiles and SBT
async createUser(inpt: NCCreateUser): Promise<void>
Parameters
- `inpt`: An object of type `NCCreateUser` containing the following fields:
- `newUser`: A string specifying the name of the account to create.
- `newacc_pub_active_key`: A string specifying the public key to use for the account's active key.
- `newacc_pub_owner_key`: A string specifying the public key to use for the account's owner key.
- `payer`: A string specifying the name of the account that will pay for the creation of the new account.
- `payer_prv_key`: A string specifying the private key of the payer account.
Example
const api = new NearAPI(nearConfig);
const name = "user.testnet";
const prv_key_active = "ed25519:...";
const prv_key_owner = "ed25519:...";
const newUser: string = `user.${Date.now()}`;
const newacc_pub_active_key = "ed25519:...";
const newacc_pub_owner_key = "ed25519:...";
const payer = name;
const payer_prv_key = prv_key_active;
const inpt: NCCreateUser = {
newUser,
newacc_pub_active_key,
newacc_pub_owner_key,
payer,
payer_prv_key
};
await api.createUser(inpt);
mintBadge
This function mints a new badge with the specified parameters.
async function mintBadge(n: NCMintBadge): Promise<NCReturnTxs>;
Parameters
- `n: NCMintBadge`: an object containing the following properties:
- `issuer: string`: the name of the badge issuer.
- `payer: string`: the name of the badge payer.
- `payer_prv_key: string`: the private key of the badge payer.
- `badge_name: string`: the name of the badge to be minted.
- `subj_name: string`: the name of the subject who will receive the badge.
- `weight: string`: the weight or value of the badge.
Return Value
- `Promise<NCReturnTxs>`: a promise that resolves with an object containing the following properties:
- `TxID_mintAsset: string`: the ID of the transaction that minted the badge.
Example
let n: NCMintBadge = {
issuer: name,
payer: name,
payer_prv_key: prv_key_active,
badge_name:"BestOfAll",
subj_name: "io",
weight: "99"
};
let resp : NCReturnTxs = await api.mintBadge(n) as NCReturnTxs;
convertBadge
To be provided
createBadgeTemplate
To be provided
sendEncryptedMessage
To be provided