UNPKG

@bridgesplit/rwa-token-sdk

Version:

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

63 lines (62 loc) 2.86 kB
/// <reference types="@coral-xyz/anchor/node_modules/@solana/web3.js" /> import { type TransactionInstruction } from "@solana/web3.js"; import { type CommonArgs, type IxReturn } from "../utils"; import { type PolicyType, type IdentityFilter } from "./types"; import { type AnchorProvider } from "@coral-xyz/anchor"; /** Represents the arguments required to create a policy engine account. */ export type CreatePolicyEngineArgs = { authority: string; signer: string; } & CommonArgs; /** * Generate instructions to create a new policy account. * @param args {@link CreatePolicyEngineArgs}. * @returns Create policy engine transaction instruction. */ export declare function getCreatePolicyEngineIx(args: CreatePolicyEngineArgs, provider: AnchorProvider): Promise<TransactionInstruction>; /** Represents the arguments required to attach a policy to an asset. */ export type AttachPolicyArgs = { authority: string; assetMint: string; payer: string; identityFilter: IdentityFilter; policyType: PolicyType; }; /** Represents the arguments required to detach a policy from an asset. */ export type DetachPolicyArgs = { authority: string; owner: string; assetMint: string; payer: string; hash: string; }; /** * Generate instructions to connect am policy to an asset. * * This function constructs an instruction to attach a policy account to an asset * using the provided arguments. It calls the policy engine program to attach the policy account, * and returns the generated instruction along with the required signers. * * @param args {@link AttachPolicyArgs} * @returns - {@link IxReturn}, a list of transaction instructions and a new key pair responsible to sign it. */ export declare function getAttachToPolicyAccountIx(args: AttachPolicyArgs, provider: AnchorProvider): Promise<IxReturn>; /** * Generate instructions to detach an identity policy account to an asset. * * This function constructs an instruction to attach a policy account to an asset * using the provided arguments. It creates a new policy account, calls the policy * engine program to attach the policy account, and returns the generated instruction * along with the required signers. * * @param args {@link AttachPolicyArgs} * @returns - {@link IxReturn}, a list of transaction instructions and a new key pair responsible to sign it. */ export declare function getDetachFromPolicyAccountIx(args: DetachPolicyArgs, provider: AnchorProvider): Promise<IxReturn>; export declare function getCreatePolicyAccountIx(args: AttachPolicyArgs, provider: AnchorProvider): Promise<IxReturn>; export interface CreateTrackerAccountArgs { payer: string; owner: string; assetMint: string; } export declare function getCreateTrackerAccountIx(args: CreateTrackerAccountArgs, provider: AnchorProvider): Promise<TransactionInstruction>;