RWA Marketplace
The RWAMarketplaceSDK class is designed to interact with a smart contract to manage real-world asset (RWA) transactions. It provides methods to:
Connect to the smart contract using a signer or provider.
List a new RWA.
Fetch an RWA by its ID.
Make, cancel, accept, and reject offers on RWAs.
Approve offers as a middleman.
Get offer count for an RWA.
Get active RWA IDs.
Class: RWAMarketplaceSDK
Constructor
private constructor(signerOrProvider: Signer | Provider): Initializes the SDK with a signer or provider.
Static Methods
static async connect(wc: WalletClient): Promise<RWAMarketplaceSDK>: Connects to the RWAMARKETPLACE contract using a ReownWalletClientand returns an instance ofRWAMarketplaceSDK.
Instance Methods
async listRWA(meta: Metadata): Promise<ethers.providers.TransactionResponse>: Lists a new RWA with the given metadata.async getRWA(id: number): Promise<RWA>: Fetches an RWA by its ID and returns its details.async makeOffer(id: number, amount: bigint): Promise<ethers.providers.TransactionResponse>: Makes an offer on an RWA in $TALK.async cancelOffer(id: number, idx: number): Promise<ethers.providers.TransactionResponse>: Cancels a specific offer made by the caller.async rejectOffer(id: number, idx: number): Promise<ethers.providers.TransactionResponse>: Rejects a non-accepted offer.async acceptOffer(id: number, idx: number): Promise<ethers.providers.TransactionResponse>: Accepts an offerasync approveOffer(id: number): Promise<ethers.providers.TransactionResponse>: Approves an accepted offer (middleman).async getOfferCount(id: number): Promise<number>: Retrieves the total number of offers for a given RWA.async getOffer(id: number, idx: number): Promise<Offer>: Retrieves a specific offer by its index for a given RWA.async getActiveRWAIds(): Promise<number[]>: Retrieves a list of IDs for all active RWAs.
Types
Metadata: Defines the structure for RWA metadata, including title, description, image, tags, and category.RWA: Defines the structure for RWA data, including metadata, owner, and status.Offer: Defines the structure for offer data, including buyer, amount, and status flags.ListingStatus: An enum representing the status of an RWA listing (Active, PendingApproval, Sold).
Usage Example
Last updated