@mirrorworld/library.assetminting.new
Version:
asset minting SDK
199 lines • 10.5 kB
TypeScript
/// <reference types="node" />
import { BN, Program, Wallet } from '@project-serum/anchor';
import web3, { Connection, PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
import { AssetMinting } from './types/asset_minting';
import { AssetEvent, CollectionEvent, MintEvent, SubCollectionEvent } from './events-types';
export declare class AssetMintingLib {
program: Program<AssetMinting>;
connection: Connection;
constructor(programId: PublicKey, connection: Connection, wallet: Wallet);
/**
* Sign the transaction and add the signature in the transaction.
* @param tx Transaction object which needs to sign.
* @param secretKey Transaction signer secret key (secret key in base58 string).
*/
signTransaction(tx: Transaction, secretKey: string): Transaction;
/**
* Add signature in the transaction.
* @param tx Transaction object where signature needs to add.
* @param signerAddress Signer public key from which secret key transaction is signed.
* @param signature Signed transaction message signature.
*/
addSignatureInTransaction(tx: Transaction, signerAddress: PublicKey, signature: Buffer): Transaction;
/**
* Add signature in the transaction.
* @param tx Transaction object where signature needs to add.
* @param feePayer public key of the address which going to pay the fee.
*/
addFeePayerAndRecentBlockHashInTransaction(tx: Transaction, feePayer: PublicKey): Promise<Transaction>;
/**
* Is pda address initialize.
*/
isPdaAddressInitialize(pdaAddress: PublicKey): Promise<boolean>;
/**
* get the config account pda and bump.
* @param name seed for the config account.
*/
getConfigAccountPdaAndBump(name?: String): Promise<[PublicKey, number]>;
/**
* get the mint account pda and bump.
* @param uuid seed for the mint account.
*/
getMintAccountPdaAndBump(uuid: String): Promise<[PublicKey, number]>;
/**
* Get metadata account pda.
* @param mintAccountPda token mint account
* @param mplProgramId metadata program id
*/
getMetadataAccountPda(mintAccountPda: PublicKey, mplProgramId?: PublicKey): Promise<[PublicKey, number]>;
/**
* Get master edition account pda.
* @param mintAccountPda token mint account
* @param mplProgramId metadata program id
*/
getMasterEditionAccountPda(mintAccountPda: PublicKey, mplProgramId?: PublicKey): Promise<[PublicKey, number]>;
/**
* Get config account pda data
* @param configAccountPda pda address for data
*/
getConfigAccountData(configAccountPda: PublicKey): Promise<any>;
/**
* Get current block time
*/
getCurrentBlockTime(): Promise<BN>;
/**
* Create initialize config transaction
* @param payer transaction fee payer public key
* @param signingAuthority signing authority public key
* @param configName config account seed for pda
* @param systemProgram system program id
* @param rent rent program id
*/
createInitializeConfigTransaction(payer: PublicKey, signingAuthority: PublicKey, configName?: string, systemProgram?: PublicKey, rent?: PublicKey): Promise<Transaction>;
/**
* Create mint token transaction
* @param assetUuid seed for the mint account
* @param payer transaction fee payer public key
* @param signingAuthority signing authority public key
* @param mintAuthority token mint authority
* @param configName config account seed for pda
* @param tokenProgram token program id
* @param associatedTokenProgram associated token program id
* @param systemProgram system program id
* @param rent rent program id
*/
createMintTokenTransaction(assetUuid: string, payer: PublicKey, signingAuthority: PublicKey, mintAuthority: PublicKey, configName?: string, systemProgram?: PublicKey, rent?: PublicKey, associatedTokenProgram?: PublicKey, tokenProgram?: PublicKey): Promise<Transaction>;
/**
* Create collection token transaction
* @param collectionUuid seed for the collection mint account
* @param payer transaction fee payer public key
* @param signingAuthority signing authority public key
* @param collectionMintAuthority collection mint authority public key
* @param collectionOwner collection owner
* @param tokenName token name
* @param tokenSymbol token symbol
* @param tokenUrl token url
* @param tokenIsMutable token is mutable
* @param tokenSellerPoint token seller point
* @param creators List of the creators
* @param configName config account seed for pda
* @param tokenProgram token program id
* @param associatedTokenProgram associated token program id
* @param systemProgram system program id
* @param rent rent program id
* @param mplProgram Metadata program id
*/
createCollectionTokenTransaction(collectionUuid: string, payer: PublicKey, signingAuthority: PublicKey, collectionMintAuthority: PublicKey, collectionOwner: PublicKey, tokenName: string, tokenSymbol: string, tokenUrl: string, tokenIsMutable: boolean, tokenSellerPoint: number, creators: CreatorType[], configName?: string, systemProgram?: PublicKey, rent?: PublicKey, associatedTokenProgram?: PublicKey, tokenProgram?: PublicKey, mplProgram?: PublicKey): Promise<Transaction>;
/**
* Create sub collection token transaction
* @param collectionUuid seed for the collection mint account
* @param subCollectionUuid seed for the sub collection mint account
* @param payer transaction fee payer public key
* @param signingAuthority signing authority public key
* @param subCollectionMintAuthority sub collection mint authority public key
* @param subCollectionOwner sub collection owner public key
* @param tokenName token name
* @param tokenSymbol token symbol
* @param tokenUrl token url
* @param tokenIsMutable token is mutable
* @param tokenSellerPoint token seller point
* @param creators List of the creators
* @param configName config account seed for pda
* @param collectionUpdateAuthority collection update authority (By default it's singing authority)
* @param tokenProgram token program id
* @param associatedTokenProgram associated token program id
* @param systemProgram system program id
* @param rent rent program id
* @param mplProgram Metadata program id
*/
createSubCollectionTokenTransaction(collectionUuid: string, subCollectionUuid: string, payer: PublicKey, signingAuthority: PublicKey, subCollectionMintAuthority: PublicKey, subCollectionOwner: PublicKey, tokenName: string, tokenSymbol: string, tokenUrl: string, tokenIsMutable: boolean, tokenSellerPoint: number, creators: CreatorType[], configName?: string, collectionUpdateAuthority?: PublicKey, systemProgram?: PublicKey, rent?: PublicKey, associatedTokenProgram?: PublicKey, tokenProgram?: PublicKey, mplProgram?: PublicKey): Promise<Transaction>;
/**
* Create asset token transaction
* @param assetUuid asset uuid
* @param collectionUuid seed for the collection mint account
* @param payer transaction fee payer public key
* @param signingAuthority signing authority public key
* @param user user public key
* @param assetMintAuthority: asset mint authority
* @param tokenName token name
* @param tokenSymbol token symbol
* @param tokenUrl token url
* @param tokenIsMutable token is mutable
* @param tokenSellerPoint token seller point
* @param creators List of the creators
* @param configName config account seed for pda
* @param collectionUpdateAuthority collection update authority (by default it's singing )
* @param tokenProgram token program id
* @param associatedTokenProgram associated token program id
* @param systemProgram system program id
* @param rent rent program id
* @param mplProgram Metadata program id
*/
createAssetTokenTransaction(assetUuid: string, collectionUuid: string, payer: PublicKey, signingAuthority: PublicKey, user: PublicKey, assetMintAuthority: PublicKey, tokenName: string, tokenSymbol: string, tokenUrl: string, tokenIsMutable: boolean, tokenSellerPoint: number, creators: CreatorType[], configName?: string, collectionUpdateAuthority?: PublicKey, systemProgram?: PublicKey, rent?: PublicKey, associatedTokenProgram?: PublicKey, tokenProgram?: PublicKey, mplProgram?: PublicKey): Promise<Transaction>;
/**
* Remove event listener.
* @param eventId Event id which need to remove.
*/
removeEventListener(eventId: number): Promise<void>;
/**
* Add mint event listener.
* @param callback Callback for the event to manage the event response on emit.
*/
addMintEventListener(callback: (event: MintEvent) => void): number;
/**
* Add collection event listener.
* @param callback Callback for the event to manage the event response on emit.
*/
addCollectionEventListener(callback: (event: CollectionEvent) => void): number;
/**
* Add sub collection event listener.
* @param callback Callback for the event to manage the event response on emit.
*/
addSubCollectionEventListener(callback: (event: SubCollectionEvent) => void): number;
/**
* Add asset event listener.
* @param callback Callback for the event to manage the event response on emit.
*/
addAssetEventListener(callback: (event: AssetEvent) => void): number;
/**
* Creator sign metadata instruction.
* @param uuid Seed for the mint account
* @param creatorPublicKey Creator public key
* @param mplProgram Metadata program id
*/
creatorSignMetadataInstruction(uuid: string, creatorPublicKey: PublicKey, mplProgram?: PublicKey): Promise<TransactionInstruction>;
/**
* Create and add creator sign metadata instruction.
* @param tx Transaction object where instruction needs to add.
* @param uuid Seed for the mint account
* @param creatorPublicKey Creator public key
* @param mplProgram Metadata program id
*/
createAndAddCreatorSignMetadataInstruction(tx: Transaction, uuid: string, creatorPublicKey: PublicKey, mplProgram?: PublicKey): Promise<Transaction>;
}
export interface CreatorType {
address: web3.PublicKey;
verified: boolean;
share: number;
}
//# sourceMappingURL=asset-minting-lib.d.ts.map