@bridgesplit/rwa-token-sdk
Version:
RWA Token SDK for the development of permissioned tokens on SVM blockchains.
76 lines • 3.51 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.IdentityRegistry = void 0;
const asset_controller_1 = require("../asset-controller");
const identity_registry_1 = require("../identity-registry");
/**
* Represents the client for Identity Registry for an RWA.
*/
class IdentityRegistry {
constructor(rwaClient) {
this.rwaClient = rwaClient;
}
/**
* Asynchronously generates instructions to setup a user.
* @param - {@link SetupUserArgs}
* @returns A Promise that resolves to the instructions to setup a user.
*
* It is required for at least a single user to be setup before issuing tokens.
*/
setupUserIxns(setupUserArgs) {
return __awaiter(this, void 0, void 0, function* () {
const setupUserIx = yield (0, asset_controller_1.getSetupUserIxs)(setupUserArgs, this.rwaClient.provider);
return setupUserIx;
});
}
/**
* Asynchronously update user account identity
* @param - {@link AddLevelToIdentityAccountArgs}
* @returns A Promise that resolves to the instructions to update user account identity.
* */
addIdentityLevelToUserAccount(addLevelArgs) {
return __awaiter(this, void 0, void 0, function* () {
const addLevelIx = yield (0, identity_registry_1.getAddLevelToIdentityAccount)(addLevelArgs, this.rwaClient.provider);
return addLevelIx;
});
}
/**
* Asynchronously reduces a user identity account level
* @param - {@link RemoveLevelFromIdentityAccount}
* @returns A Promise that resolves to the instructions to reduce the level of a user identity account.
*/
removeIdentityLevelFromUserAccount(removeLevelArgs) {
return __awaiter(this, void 0, void 0, function* () {
const reduceLevelIx = yield (0, identity_registry_1.getRemoveLevelFromIdentityAccount)(removeLevelArgs, this.rwaClient.provider);
return reduceLevelIx;
});
}
/**
* Retrieves the identity registry pda account for a specific asset mint.
* @param assetMint - The string representation of the asset's mint address.
* @returns The identity registry pda as a public key.
*/
getIdentityRegistryPda(assetMint) {
return (0, identity_registry_1.getIdentityRegistryPda)(assetMint);
}
/**
* Retrieves the identity account pda public key for a specific asset mint.
* @param assetMint - The string representation of the asset's mint address.
* @param owner - The string representation of the asset's owner.
* @returns The identity account pda.
*/
getIdentityAccountPda(assetMint, owner) {
return (0, identity_registry_1.getIdentityAccountPda)(assetMint, owner);
}
}
exports.IdentityRegistry = IdentityRegistry;
//# sourceMappingURL=IdentityRegistry.js.map