UNPKG

@bridgesplit/rwa-token-sdk

Version:

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

35 lines 2.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.POLICY_SKIP_LEVEL = exports.getIdentityMetadataPda = exports.getIdentityAccountPda = exports.getIdentityRegistryPda = exports.getIdentityRegistryProgram = exports.identityRegistryProgramId = void 0; const anchor_1 = require("@coral-xyz/anchor"); const idls_1 = require("../programs/idls"); const web3_js_1 = require("@solana/web3.js"); /** Address of the identity registry program. */ exports.identityRegistryProgramId = new web3_js_1.PublicKey("idtynCMYbdisCTv4FrCWPSQboZb1uM4TV2cPi79yxQf"); const getIdentityRegistryProgram = (provider) => new anchor_1.Program(idls_1.IdentityRegistryIdl, provider); exports.getIdentityRegistryProgram = getIdentityRegistryProgram; /** * Retrieves the identity registry pda public key for a specific asset mint. * @param assetMint - The string representation of the asset's mint address. * @returns The identity registry pda. */ const getIdentityRegistryPda = (assetMint) => web3_js_1.PublicKey.findProgramAddressSync([new web3_js_1.PublicKey(assetMint).toBuffer()], exports.identityRegistryProgramId)[0]; exports.getIdentityRegistryPda = getIdentityRegistryPda; /** * 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. */ const getIdentityAccountPda = (assetMint, owner) => web3_js_1.PublicKey.findProgramAddressSync([(0, exports.getIdentityRegistryPda)(assetMint).toBuffer(), new web3_js_1.PublicKey(owner).toBuffer()], exports.identityRegistryProgramId)[0]; exports.getIdentityAccountPda = getIdentityAccountPda; /** * Retrieves the identity metadata account pda public key for a specific asset mint. * @param assetMint - The string representation of the asset's mint address. * @param level - The level of the identity account. * @returns The identity metadata pda. */ const getIdentityMetadataPda = (assetMint, level) => web3_js_1.PublicKey.findProgramAddressSync([Buffer.from([level]), (0, exports.getIdentityRegistryPda)(assetMint).toBuffer()], exports.identityRegistryProgramId)[0]; exports.getIdentityMetadataPda = getIdentityMetadataPda; exports.POLICY_SKIP_LEVEL = 255; //# sourceMappingURL=utils.js.map