UNPKG

@bridgesplit/rwa-token-sdk

Version:

RWA Token SDK for the development of permissioned tokens on SVM blockchains.

94 lines 4.2 kB
"use strict"; 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.AssetController = void 0; const asset_controller_1 = require("../asset-controller"); const policy_engine_1 = require("../policy-engine"); /** * Represents the client for Asset Controller for an RWA. */ class AssetController { constructor(rwaClient) { this.rwaClient = rwaClient; } /** * Asynchronously generates instructions to setup a new asset controller. * @param - {@link SetupAssetControllerArgs} * @returns A Promise that resolves to the instructions to create an asset controller. */ setupNewRegistry(createAssetControllerArgs) { return __awaiter(this, void 0, void 0, function* () { const setupControllerIx = yield (0, asset_controller_1.getSetupAssetControllerIxs)(createAssetControllerArgs, this.rwaClient.provider); return setupControllerIx; }); } /** * Update the asset controller's metadata. * @param - {@link UpdateAssetMetadataArgs} * @returns A Promise that resolves to the instructions to update the asset controller's metadata. * */ updateAssetMetadata(updateAssetControllerArgs) { return __awaiter(this, void 0, void 0, function* () { const updateMetadataIx = yield (0, asset_controller_1.getUpdateAssetMetadataIx)(updateAssetControllerArgs, this.rwaClient.provider); return updateMetadataIx; }); } /** * Asynchronously generates instructions to issue tokens. * @param - {@link IssueTokenArgs} * @returns A Promise that resolves to the instructions to issue tokens. */ issueTokenIxns(IssueArgs) { return __awaiter(this, void 0, void 0, function* () { const issueTokensIxs = yield (0, asset_controller_1.getIssueTokensIx)(IssueArgs, this.rwaClient.provider); return issueTokensIxs; }); } /** * Asynchronously generates instructions to revoke assets. * @param - {@link VoidTokensArgs} * @returns A Promise that resolves to the instructions to revoke assets. */ voidTokenIxns(voidTokenArgs) { return __awaiter(this, void 0, void 0, function* () { const voidTokenIx = yield (0, asset_controller_1.getVoidTokensIx)(voidTokenArgs, this.rwaClient.provider); return voidTokenIx; }); } /** * Executes a token transfer. * @returns A promise that resolves to transaction instruction. */ transfer(transferArgs) { return __awaiter(this, void 0, void 0, function* () { const transferIxs = yield (0, asset_controller_1.getTransferTokensIxs)(transferArgs, this.rwaClient.provider); return transferIxs; }); } /** * Retrieves the asset controller pda account for a specific asset mint. * @param assetMint - The string representation of the asset's mint address. * @returns The asset controllers pda as a public key. */ getAssetControllerPda(assetMint) { return (0, asset_controller_1.getAssetControllerPda)(assetMint); } /** * Retrieves the asset controller's metadata pda account for a specific asset mint. * @param assetMint - The string representation of the asset's mint address. * @returns The asset controller's extra metadata pda. */ getExtraMetasListPda(assetMint) { return (0, policy_engine_1.getExtraMetasListPda)(assetMint); } } exports.AssetController = AssetController; //# sourceMappingURL=AssetController.js.map