UNPKG

@bridgesplit/rwa-token-sdk

Version:

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

166 lines (165 loc) 6.42 kB
/// <reference types="@coral-xyz/anchor/node_modules/@solana/web3.js" /> import { TransactionInstruction } from "@solana/web3.js"; import { type CommonArgs, type IxReturn } from "../utils"; import { type AnchorProvider } from "@coral-xyz/anchor"; /** Represents arguments for creating an on chain asset controller. */ export type CreateAssetControllerIx = { decimals: number; authority: string; name: string; uri: string; symbol: string; interestRate?: number; } & CommonArgs; /** * Builds the transaction instruction to create an Asset Controller. * @param args - {@link CreateAssetControllerIx} * @returns Create asset controller transaction instruction */ export declare function getCreateAssetControllerIx(args: CreateAssetControllerIx, provider: AnchorProvider): Promise<TransactionInstruction>; /** Represents arguments for update an on chain asset metadata. */ export type UpdateAssetMetadataArgs = { authority: string; name?: string; uri?: string; symbol?: string; } & CommonArgs; /** * Builds the transaction instruction to create an Asset Controller. * @param args - {@link UpdateAssetMetadataArgs} * @returns Create asset controller transaction instruction */ export declare function getUpdateAssetMetadataIx(args: UpdateAssetMetadataArgs, provider: AnchorProvider): Promise<TransactionInstruction>; /** Represents arguments for issuing an on chain asset/token. */ export type IssueTokenArgs = { amount: number; authority: string; owner: string; } & CommonArgs; /** * Creates transaction instruction to issue tokens for a specific amount for a specific asset. * @param args {@link IssueTokenArgs} * @returns A transaction instruction distributing the specified amount for the specific asset. */ export declare function getIssueTokensIx(args: IssueTokenArgs, provider: AnchorProvider): Promise<TransactionInstruction[]>; export type VoidTokensArgs = { amount: number; owner: string; } & CommonArgs; export declare function getVoidTokensIx(args: VoidTokensArgs, provider: AnchorProvider): Promise<TransactionInstruction>; export type TransferTokensArgs = { from: string; to: string; amount: number; assetMint: string; decimals: number; message?: string; createTa?: boolean; }; /** * Creates a transaction instruction to transfer a token between addresses with transfer controls. * @param args {@link TransferTokensArgs} * @returns Transaction instruction to transfer RWA token. */ export declare function getTransferTokensIxs(args: TransferTokensArgs, provider: AnchorProvider): Promise<TransactionInstruction[]>; /** Args used to generate new asset controller */ export type SetupAssetControllerArgs = { authority: string; decimals: number; payer: string; delegate?: string; name: string; uri: string; symbol: string; interestRate?: number; }; /** * Generates a new asset controller. * This includes generation of a new key pair, a new asset registry, policy registry, data registry, identity registry. * @param args - {@link SetupAssetControllerArgs} * @returns - {@link IxReturn}, an object of the initialize transaction instructions and a new keypair. */ export declare function getSetupAssetControllerIxs(args: SetupAssetControllerArgs, provider: AnchorProvider): Promise<IxReturn>; /** Args used to setup user */ export type SetupUserArgs = { payer: string; owner: string; signer: string; assetMint: string; levels: number[]; }; /** * Generate instructions to set up a user for permissioned based assets. * This function constructs the instructions necessary for setting up a user, which includes * creating an identity account, indicating permissions, and a token account for the user. * @param args {@link SetupUserArgs} * @returns - {@link IxReturn}, a promise that resolves to a list of generated transaction instructions. */ export declare function getSetupUserIxs(args: SetupUserArgs, provider: AnchorProvider): Promise<IxReturn>; export type InterestBearingMintArgs = { rate: number; authority: string; } & CommonArgs; /** * Generate Instructions to update interest rate * @param args - {@link InterestRateArgs} * @returns - {@link TransactionInstruction} * */ export declare function getUpdateInterestBearingMintRateIx(args: { rate: number; authority: string; } & CommonArgs, provider: AnchorProvider): Promise<TransactionInstruction>; export type MemoTranferArgs = { owner: string; tokenAccount: string; assetMint: string; }; /** * Generate Instructions to disable memo transfer * @param args - {@link MemoTranferArgs} * @returns - {@link TransactionInstruction} * */ export declare function getEnableMemoTransferIx(args: MemoTranferArgs, provider: AnchorProvider): Promise<TransactionInstruction>; /** * Generate Instructions to disable memo transfer * @param args - {@link MemoTranferArgs} * @returns - {@link TransactionInstruction} * */ export declare function getDisableMemoTransferIx(args: MemoTranferArgs, provider: AnchorProvider): Promise<TransactionInstruction>; export type CloseMintArgs = { authority: string; } & CommonArgs; /** * Generate Instructions to close a mint * @param args - {@link CloseMintArgs} * @returns - {@link TransactionInstruction} */ export declare function getCloseMintIx(args: CloseMintArgs, provider: AnchorProvider): Promise<TransactionInstruction>; export type FreezeTokenArgs = { authority: string; owner: string; } & CommonArgs; /** * Generate Instructions to freeze token account * @param args - {@link FreezeTokenArgs} * @returns - {@link TransactionInstruction} */ export declare function getFreezeTokenIx(args: FreezeTokenArgs, provider: AnchorProvider): Promise<TransactionInstruction>; /** * Generate Instructions to thaw token account * @param args - {@link FreezeTokenArgs} * @returns - {@link TransactionInstruction} * */ export declare function getThawTokenIx(args: FreezeTokenArgs, provider: AnchorProvider): Promise<TransactionInstruction>; export type RevokeTokensArgs = { amount: number; owner: string; authority: string; assetMint: string; }; /** * Revoke tokens from a user * @param args - {@link RevokeTokensArgs} * @returns - {@link TransactionInstruction} * */ export declare function getRevokeTokensIx(args: RevokeTokensArgs, provider: AnchorProvider): Promise<TransactionInstruction[]>;