diff --git a/packages/interfaces/src/models/base.ts b/packages/interfaces/src/models/base.ts index e0aca8d18b..d1a8faeeef 100644 --- a/packages/interfaces/src/models/base.ts +++ b/packages/interfaces/src/models/base.ts @@ -207,27 +207,73 @@ export interface ValidatedAddress { * NFT Minted Metadata. */ export interface NftMintingData { + /** + * Address of the asset. + */ readonly address?: string; + /** + * Network its minted on. + */ readonly network?: Network; - + /** + * Date minted on. + */ readonly mintedOn?: Timestamp; + /** + * User it's minted by. + */ readonly mintedBy?: string; - + /** + * Block id on the chain + */ readonly blockId?: string; + /** + * NFT ID on the chain. + */ readonly nftId?: string; + /** + * Storage deposit requirement. + */ readonly storageDeposit?: number; - + /** + * Alias Block Id on chain. + */ readonly aliasBlockId?: string; + /** + * Alias Id on chain. + */ readonly aliasId?: string; + /** + * Alias storage deposit requirement. + */ readonly aliasStorageDeposit?: number; - + /** + * Minting order id to initiate this mint. + */ readonly mintingOrderId?: string; - + /** + * Total number of NFTs to be minted. + */ readonly nftsToMint?: number; + /** + * Total number of NFTs to be uploaded to file storage. + */ readonly nftMediaToUpload?: number; + /** + * Total number of NFTs to be prepared for the file upload. + */ readonly nftMediaToPrepare?: number; + /** + * Unsold options. What happens to unsold NFTs after mint. + */ readonly unsoldMintingOptions?: UnsoldMintingOptions; + /** + * New price for NFT after it's minted. + */ readonly newPrice?: number; + /** + * NFT Storage deposit requirement. + */ readonly nftsStorageDeposit?: number; } diff --git a/packages/sdk/src/https/datasets/AuctionDataset.ts b/packages/sdk/src/https/datasets/AuctionDataset.ts index 00a30493ba..2f4d6236e2 100644 --- a/packages/sdk/src/https/datasets/AuctionDataset.ts +++ b/packages/sdk/src/https/datasets/AuctionDataset.ts @@ -14,13 +14,19 @@ import { DatasetClass } from './Dataset'; */ export class AuctionDataset extends DatasetClass { /** - * Create generic auction. + * Create generic Auction. + * + * @param req Use {@link Build5Request} with data based on {@link AuctionCreateRequest} + * @returns */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.createauction)(req); /** - * Bid on an auction. + * Bid on auction. + * + * @param req Use {@link Build5Request} with data based on {@link AuctionBidRequest} + * @returns */ bid = (req: Build5Request) => this.sendRequest(WEN_FUNC.bidAuction)(req); diff --git a/packages/sdk/src/https/datasets/BadgesDataset.ts b/packages/sdk/src/https/datasets/BadgesDataset.ts index cdf9ad6822..be2642657a 100644 --- a/packages/sdk/src/https/datasets/BadgesDataset.ts +++ b/packages/sdk/src/https/datasets/BadgesDataset.ts @@ -1,4 +1,7 @@ import { Badge, Dataset } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Badges dataset. + */ export class BadgesDataset extends DatasetClass {} diff --git a/packages/sdk/src/https/datasets/Dataset.ts b/packages/sdk/src/https/datasets/Dataset.ts index bd635a5401..01f9f2c9df 100644 --- a/packages/sdk/src/https/datasets/Dataset.ts +++ b/packages/sdk/src/https/datasets/Dataset.ts @@ -57,19 +57,41 @@ abstract class BaseDataSetClass extends BaseSet { }; } +/** + * Dataset base class. + */ export abstract class DatasetClass extends BaseDataSetClass { + /** + * Get many records by id. + * + * @param setIds + * @returns + */ getManyById = (setIds: string[]) => wrappedFetch(this.apiKey, this.origin + ApiRoutes.GET_MANY_BY_ID, { dataset: this.dataset, setIds, }); - + /** + * Get many records by id. Real time stream. + * + * @param setIds + * @returns + */ getManyByIdLive = (setIds: string[]): Observable => { const params = { dataset: this.dataset, setIds }; const url = this.origin + ApiRoutes.GET_MANY_BY_ID + toQueryParams({ ...params }); return fetchLive(this.apiKey, url); }; + /** + * Get records by field. + * + * @param fieldName + * @param fieldValue + * @param startAfter + * @returns + */ getByField = async ( fieldName: string | string[], fieldValue: string | number | boolean | (string | number | boolean)[], @@ -79,6 +101,13 @@ export abstract class DatasetClass extends BaseDataSetClas return await wrappedFetch(this.apiKey, this.origin + ApiRoutes.GET_MANY, params); }; + /** + * Get records by field. Real time stream. + * @param fieldName + * @param fieldValue + * @param startAfter + * @returns + */ getByFieldLive = ( fieldName: string | string[], fieldValue: string | number | boolean | (string | number | boolean)[], @@ -89,6 +118,13 @@ export abstract class DatasetClass extends BaseDataSetClas return fetchLive(this.apiKey, url); }; + /** + * Get records by space. + * + * @param space + * @param startAfter + * @returns + */ getBySpace = async (space: string, startAfter?: string) => { const params: GetManyRequest = { dataset: this.dataset, @@ -100,6 +136,12 @@ export abstract class DatasetClass extends BaseDataSetClas return await wrappedFetch(this.apiKey, url, { ...params }); }; + /** + * Get records by space. Real time stream. + * @param space + * @param startAfter + * @returns + */ getBySpaceLive = (space: string, startAfter?: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -113,12 +155,25 @@ export abstract class DatasetClass extends BaseDataSetClas return this.getManyAdvancedLive(params); }; + /** + * Get all records updated after unix timestamp. + * + * @param updatedAfter + * @param startAfter + * @returns + */ getAllUpdatedAfter = async (updatedAfter: number, startAfter?: string) => { const params: GetUpdatedAfterRequest = { dataset: this.dataset, updatedAfter, startAfter }; const url = this.origin + ApiRoutes.GET_UPDATED_AFTER; return await wrappedFetch(this.apiKey, url, { ...params }); }; - + /** + * Get all records updated after unix timestamp. Real time stream. + * + * @param updatedAfter + * @param startAfter + * @returns + */ getAllUpdatedAfterLive = (updatedAfter: number, startAfter?: string): Observable => { const params: GetUpdatedAfterRequest = { dataset: this.dataset, updatedAfter, startAfter }; const url = this.origin + ApiRoutes.GET_UPDATED_AFTER + toQueryParams({ ...params }); diff --git a/packages/sdk/src/https/datasets/MemberDataset.ts b/packages/sdk/src/https/datasets/MemberDataset.ts index cd98775971..1620f104d8 100644 --- a/packages/sdk/src/https/datasets/MemberDataset.ts +++ b/packages/sdk/src/https/datasets/MemberDataset.ts @@ -10,13 +10,32 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Member dataset + */ export class MemberDataset extends DatasetClass { + /** + * Update member details. + * + * @param req Use {@link Build5Request} with data based on {@link MemberUpdateRequest} + * @returns + */ update = (req: Build5Request) => this.sendRequest(WEN_FUNC.updateMember)(req); - + /** + * Generate AUTH token. + * + * @param req Use {@link Build5Request} with data based on {@link CustomTokenRequest} + * @returns + */ generateCustomToken = (req: Build5Request) => this.sendRequest(WEN_FUNC.generateCustomToken)(req); - + /** + * Validate member address. + * + * @param req Use {@link Build5Request} with data based on {@link AddressValidationRequest} + * @returns + */ validateAddress = (req: Build5Request) => this.sendRequest(WEN_FUNC.validateAddress)(req); } diff --git a/packages/sdk/src/https/datasets/NftDataset.ts b/packages/sdk/src/https/datasets/NftDataset.ts index 0cb8cf84f6..b2daf3e62d 100644 --- a/packages/sdk/src/https/datasets/NftDataset.ts +++ b/packages/sdk/src/https/datasets/NftDataset.ts @@ -18,36 +18,99 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * NFT Dataset. + */ export class NftDataset extends DatasetClass { + /** + * Create NFT + * + * @param req Use {@link Build5Request} with data based on {@link NftCreateRequest} + * @returns + */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.createNft)(req); - + /** + * Create batch NFT + * + * @param req Use {@link Build5Request} with data based on {@link NftCreateRequest} + * @returns + */ createBatch = (req: Build5Request) => this.sendRequest(WEN_FUNC.createBatchNft)(req); - + /** + * Set NFT for sale + * + * @param req Use {@link Build5Request} with data based on {@link NftSetForSaleRequest} + * @returns + */ setForSale = (req: Build5Request) => this.sendRequest(WEN_FUNC.setForSaleNft)(req); - + /** + * Withdraw NFT + * + * @param req Use {@link Build5Request} with data based on {@link NftWithdrawRequest} + * @returns + */ withdraw = (req: Build5Request) => this.sendRequest(WEN_FUNC.withdrawNft)(req); - + /** + * Deposit NFT + * + * @param req Use {@link Build5Request} with data based on {@link ProjectDeactivateRequest} + * @returns + */ deposit = (req: Build5Request) => this.sendRequest(WEN_FUNC.depositNft)(req); - + /** + * Update unsold NFT. + * + * @param req Use {@link Build5Request} with data based on {@link NftUpdateUnsoldRequest} + * @returns + */ updateUnsold = (req: Build5Request) => this.sendRequest(WEN_FUNC.updateUnsoldNft)(req); - + /** + * Buy NFT. + * + * @param req Use {@link Build5Request} with data based on {@link NftPurchaseRequest} + * @returns + */ order = (req: Build5Request) => this.sendRequest(WEN_FUNC.orderNft)(req); - + /** + * Bin on NFT. + * + * @param req Use {@link Build5Request} with data based on {@link NftBidRequest} + * @returns + */ openBid = (req: Build5Request) => this.sendRequest(WEN_FUNC.openBid)(req); - + /** + * Bulk purchase of NFTs + * + * @param req Use {@link Build5Request} with data based on {@link NftPurchaseBulkRequest} + * @returns + */ bulkPurchase = (req: Build5Request) => this.sendRequest(WEN_FUNC.orderNftBulk)(req); - + /** + * Transfer NFT + * + * @param req Use {@link Build5Request} with data based on {@link NftTransferRequest} + * @returns + */ transfer = this.sendRequest(WEN_FUNC.nftTransfer); + /** + * Get all NFTs by collection. Real time stream. + * + * @param collection + * @param orderBy + * @param orderByDir + * @param startAfter + * @returns + */ getByCollectionLive = ( collection: string, orderBy: string[], @@ -66,6 +129,12 @@ export class NftDataset extends DatasetClass { return this.getManyAdvancedLive(params); }; + /** + * Get all NFTs by owner. Real time stream. + * @param owner + * @param startAfter + * @returns + */ getByOwnerLive = (owner: string, startAfter?: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/NftStakeDataset.ts b/packages/sdk/src/https/datasets/NftStakeDataset.ts index 13a4b108aa..e0deee3981 100644 --- a/packages/sdk/src/https/datasets/NftStakeDataset.ts +++ b/packages/sdk/src/https/datasets/NftStakeDataset.ts @@ -8,7 +8,16 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * NFT Stake Dataset. + */ export class NftStakeDataset extends DatasetClass { + /** + * Stake NFT + * + * @param req Use {@link Build5Request} with data based on {@link NftStakeRequest} + * @returns + */ stake = (req: Build5Request) => this.sendRequest(WEN_FUNC.stakeNft)(req); } diff --git a/packages/sdk/src/https/datasets/NotificationDataset.ts b/packages/sdk/src/https/datasets/NotificationDataset.ts index e9e7545140..8b849e5a32 100644 --- a/packages/sdk/src/https/datasets/NotificationDataset.ts +++ b/packages/sdk/src/https/datasets/NotificationDataset.ts @@ -1,7 +1,17 @@ import { Dataset, GetManyAdvancedRequest, Notification, Opr } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Notification Dataset + */ export class NotificationDataset extends DatasetClass { + /** + * Get notification by member. Real time stream. + * @param member + * @param startAfter + * @param limit + * @returns + */ getByMemberLive = (member: string, startAfter?: string, limit?: number) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/ProjectDataset.ts b/packages/sdk/src/https/datasets/ProjectDataset.ts index d2938696da..934a5dc1ed 100644 --- a/packages/sdk/src/https/datasets/ProjectDataset.ts +++ b/packages/sdk/src/https/datasets/ProjectDataset.ts @@ -7,7 +7,16 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Project dataset. + */ export class ProjectDataset extends DatasetClass { + /** + * Deactivate project. + * + * @param req Use {@link Build5Request} with data based on {@link ProjectDeactivateRequest} + * @returns + */ deactivate = (req: Build5Request) => this.sendRequest(WEN_FUNC.deactivateProject)(req); } diff --git a/packages/sdk/src/https/datasets/StakeDataset.ts b/packages/sdk/src/https/datasets/StakeDataset.ts index c8db51f6a2..2a6f1a7c9b 100644 --- a/packages/sdk/src/https/datasets/StakeDataset.ts +++ b/packages/sdk/src/https/datasets/StakeDataset.ts @@ -10,10 +10,26 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Token Stake Dataset. + */ export class StakeDataset extends DatasetClass { + /** + * Stake Token + * + * @param req Use {@link Build5Request} with data based on {@link TokenStakeRequest} + * @returns + */ deposit = (req: Build5Request) => this.sendRequest(WEN_FUNC.depositStake)(req); + /** + * Get stakes by member. Real time stream. + * @param member + * @param startAfter + * @param limit + * @returns + */ getByMemberLive = (member: string, startAfter?: string, limit?: number) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/StakeRewardDataset.ts b/packages/sdk/src/https/datasets/StakeRewardDataset.ts index 77bea59241..33122ccb93 100644 --- a/packages/sdk/src/https/datasets/StakeRewardDataset.ts +++ b/packages/sdk/src/https/datasets/StakeRewardDataset.ts @@ -11,13 +11,34 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Stake Reward dataset. + */ export class StakeRewardDataset extends DatasetClass { + /** + * Create stake reward. + * + * @param req Use {@link Build5Request} with data based on {@link TokenStakeRewardRequest} + * @returns + */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.stakeReward)(req); - + /** + * Remove stake reward. + * + * @param req Use {@link Build5Request} with data based on {@link TokenStakeRewardsRemoveRequest} + * @returns + */ remove = (req: Build5Request) => this.sendRequest(WEN_FUNC.removeStakeReward)(req); + /** + * TODO + * + * @param token + * @param startAfter + * @returns + */ getByTokenLive = (token: string, startAfter?: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/StampDataset.ts b/packages/sdk/src/https/datasets/StampDataset.ts index eb61568748..edc083b134 100644 --- a/packages/sdk/src/https/datasets/StampDataset.ts +++ b/packages/sdk/src/https/datasets/StampDataset.ts @@ -8,7 +8,16 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Stamp Dataset + */ export class StampDataset extends DatasetClass { + /** + * Stamping API. + * + * @param req Use {@link Build5Request} with data based on {@link StampRequest} + * @returns + */ stamp = (req: Build5Request) => this.sendRequest(WEN_FUNC.stamp)(req); } diff --git a/packages/sdk/src/https/datasets/TickerDataset.ts b/packages/sdk/src/https/datasets/TickerDataset.ts index 9c46906ef8..b2e51ad5d0 100644 --- a/packages/sdk/src/https/datasets/TickerDataset.ts +++ b/packages/sdk/src/https/datasets/TickerDataset.ts @@ -1,4 +1,7 @@ import { Dataset, Ticker } from '@build-5/interfaces'; import { DatasetClass } from './Dataset'; +/** + * Price ticker Dataset + */ export class TickerDataset extends DatasetClass {} diff --git a/packages/sdk/src/https/datasets/TransactionDataset.ts b/packages/sdk/src/https/datasets/TransactionDataset.ts index 1b117ed472..a48badb8e3 100644 --- a/packages/sdk/src/https/datasets/TransactionDataset.ts +++ b/packages/sdk/src/https/datasets/TransactionDataset.ts @@ -17,9 +17,22 @@ import { fetchLive } from '../get/observable'; import { DatasetClass } from './Dataset'; export class TransactionDataset extends DatasetClass { + /** + * Credit blocked transactions back (ie. not gifted storage deposit) + * + * @param req Use {@link Build5Request} with data based on {@link CreditUnrefundableRequest} + * @returns + */ creditUnrefundable = (req: Build5Request) => this.sendRequest(WEN_FUNC.creditUnrefundable)(req); - + /** + * TODO + * + * @param member + * @param orderBy + * @param startAfter + * @returns + */ getBadgesForMemberLive = (member: string, orderBy = ['createdOn'], startAfter?: string) => { const fieldName = ['member', 'type', 'payload.type']; const params: GetManyAdvancedRequest = { @@ -33,7 +46,15 @@ export class TransactionDataset extends DatasetClass extends DatasetClass { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -94,7 +121,15 @@ export class TransactionDataset extends DatasetClass { const fieldName = ['member', 'payload.nft', 'type', 'type']; const fieldValue: (string | number)[] = [ @@ -124,6 +159,14 @@ export class TransactionDataset extends DatasetClass { const fieldName = ['payload.proposalId', 'type']; const fieldValue = [proposal, TransactionType.VOTE]; @@ -144,7 +187,12 @@ export class TransactionDataset extends DatasetClass { const params: GetManyRequest = { dataset: this.dataset, @@ -155,6 +203,12 @@ export class TransactionDataset extends DatasetClass(this.apiKey, url); }; + /** + * TODO + * + * @param sourceTransaction + * @returns + */ getBySourceTransactionLive = (sourceTransaction: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/award/AwardDataset.ts b/packages/sdk/src/https/datasets/award/AwardDataset.ts index 57899eac13..b803cefcd7 100644 --- a/packages/sdk/src/https/datasets/award/AwardDataset.ts +++ b/packages/sdk/src/https/datasets/award/AwardDataset.ts @@ -27,31 +27,49 @@ import { SubsetType } from '../common'; export class AwardDataset extends DatasetClass { /** * Create Award + * + * @param req Use {@link Build5Request} with data based on {@link AwardCreateRequest} + * @returns */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.createAward)(req); /** * Fund award with native or base token. + * + * @param req Use {@link Build5Request} with data based on {@link AwardFundRequest} + * @returns */ fund = (req: Build5Request) => this.sendRequest(WEN_FUNC.fundAward)(req); /** * Reject award + * + * @param req Use {@link Build5Request} with data based on {@link AwardRejectRequest} + * @returns */ reject = (req: Build5Request) => this.sendRequest(WEN_FUNC.rejectAward)(req); /** * Add owner of the award. This grants the ability to manage it. + * + * @param req Use {@link Build5Request} with data based on {@link AwardAddOwnerRequest} + * @returns */ addOwner = (req: Build5Request) => this.sendRequest(WEN_FUNC.addOwnerAward)(req); /** * Participate in the award to receive badge and tokens. + * + * @param req Use {@link Build5Request} with data based on {@link AwardParticpateRequest} + * @returns */ participate = (req: Build5Request) => this.sendRequest(WEN_FUNC.participateAward)(req); /** * Approve participants and distribute them with token and NFT + * + * @param req Use {@link Build5Request} with data based on {@link AwardApproveParticipantRequest} + * @returns */ approveParticipant = (req: Build5Request) => this.sendRequest(WEN_FUNC.approveParticipantAward)< @@ -60,6 +78,9 @@ export class AwardDataset extends DatasetClass { >(req); /** * Cancel ongoing award and get refunded with remaining tokens. + * + * @param req Use {@link Build5Request} with data based on {@link AwardCancelRequest} + * @returns */ cancel = (req: Build5Request) => this.sendRequest(WEN_FUNC.cancelAward)(req); diff --git a/packages/sdk/src/https/datasets/collection/CollectionDataset.ts b/packages/sdk/src/https/datasets/collection/CollectionDataset.ts index 18e2514800..80f6ada3f8 100644 --- a/packages/sdk/src/https/datasets/collection/CollectionDataset.ts +++ b/packages/sdk/src/https/datasets/collection/CollectionDataset.ts @@ -23,36 +23,57 @@ import { DatasetClass } from '../Dataset'; export class CollectionDataset extends DatasetClass { /** * Create NFT Collection. + * + * @param req Use {@link Build5Request} with data based on {@link CreateCollectionRequest} + * @returns */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.createCollection)(req); /** * Update NFT Collection. + * + * @param req Use {@link Build5Request} with data based on {@link UpdateCollectionRequest} + * @returns */ update = (req: Build5Request) => this.sendRequest(WEN_FUNC.updateCollection)(req); /** * Update minted NFT Collection. Only certain fields are updated (typically those that are not immutable and stored on DLT) + * + * @param req Use {@link Build5Request} with data based on {@link UpdateCollectionRequest} + * @returns */ updateMinted = (req: Build5Request) => this.sendRequest(WEN_FUNC.updateCollection)(req); /** * Reject collection and hide it. + * + * @param req Use {@link Build5Request} with data based on {@link RejectCollectionRequest} + * @returns */ reject = (req: Build5Request) => this.sendRequest(WEN_FUNC.rejectCollection)(req); /** * Mint collection on defined network. + * + * @param req Use {@link Build5Request} with data based on {@link CollectionMintRequest} + * @returns */ mint = (req: Build5Request) => this.sendRequest(WEN_FUNC.mintCollection)(req); /** * Give collection a vote up or down. + * + * @param req Use {@link Build5Request} with data based on {@link VoteRequest} + * @returns */ vote = (req: Build5Request) => this.sendRequest(WEN_FUNC.voteController)(req); /** * Rank collection. This typically is managed by Rank Moderators. + * + * @param req Use {@link Build5Request} with data based on {@link RankRequest} + * @returns */ rank = (req: Build5Request) => this.sendRequest(WEN_FUNC.rankController)(req); diff --git a/packages/sdk/src/https/datasets/proposal/ProposalDataset.ts b/packages/sdk/src/https/datasets/proposal/ProposalDataset.ts index 94633fc5fa..a3318a6a45 100644 --- a/packages/sdk/src/https/datasets/proposal/ProposalDataset.ts +++ b/packages/sdk/src/https/datasets/proposal/ProposalDataset.ts @@ -25,16 +25,37 @@ export class ProposalDataset extends DatasetClass) => this.sendRequest(WEN_FUNC.createProposal)(req); - + /** + * Method to approve Proposal + * + * @param req Use {@link Build5Request} with data based on {@link ApproveProposalRequest} + * @returns + */ approve = (req: Build5Request) => this.sendRequest(WEN_FUNC.approveProposal)(req); - + /** + * Method to reject Proposal + * + * @param req Use {@link Build5Request} with data based on {@link RejectProposalRequest} + * @returns + */ reject = (req: Build5Request) => this.sendRequest(WEN_FUNC.rejectProposal)(req); - + /** + * Method to vote on Proposal + * + * @param req Use {@link Build5Request} with data based on {@link ProposalVoteRequest} + * @returns + */ vote = (req: Build5Request) => this.sendRequest(WEN_FUNC.voteOnProposal)(req); + /** + * TODO + * + * @param startAfter + * @returns + */ getAllActiveLive = (startAfter?: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -47,7 +68,13 @@ export class ProposalDataset extends DatasetClass { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -60,7 +87,13 @@ export class ProposalDataset extends DatasetClass { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -73,7 +106,13 @@ export class ProposalDataset extends DatasetClass { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -86,7 +125,13 @@ export class ProposalDataset extends DatasetClass { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/proposal/ProposalMemberSubset.ts b/packages/sdk/src/https/datasets/proposal/ProposalMemberSubset.ts index c638135759..b787b0134c 100644 --- a/packages/sdk/src/https/datasets/proposal/ProposalMemberSubset.ts +++ b/packages/sdk/src/https/datasets/proposal/ProposalMemberSubset.ts @@ -1,7 +1,17 @@ import { GetManyAdvancedRequest, Opr, ProposalMember } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Proposal Member subset + */ export class ProposalMemberSubset extends SubsetClass { + /** + * TODO + * + * @param voted + * @param startAfter + * @returns + */ getVotingMembersLive = (voted: boolean, startAfter?: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/proposal/ProposalOwnerSubset.ts b/packages/sdk/src/https/datasets/proposal/ProposalOwnerSubset.ts index bd89a0d49f..cd8b94ba4b 100644 --- a/packages/sdk/src/https/datasets/proposal/ProposalOwnerSubset.ts +++ b/packages/sdk/src/https/datasets/proposal/ProposalOwnerSubset.ts @@ -1,4 +1,7 @@ import { ProposalMember } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Proposel Owner subset + */ export class ProposalOwnerSubset extends SubsetClass {} diff --git a/packages/sdk/src/https/datasets/space/SpaceBlockedMemberSubset.ts b/packages/sdk/src/https/datasets/space/SpaceBlockedMemberSubset.ts index b5ffb0515e..15f25dba83 100644 --- a/packages/sdk/src/https/datasets/space/SpaceBlockedMemberSubset.ts +++ b/packages/sdk/src/https/datasets/space/SpaceBlockedMemberSubset.ts @@ -1,4 +1,6 @@ import { SpaceMember } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; - +/** + * Space Blocked Member subset + */ export class SpaceBlockedMemberSubset extends SubsetClass {} diff --git a/packages/sdk/src/https/datasets/space/SpaceDataset.ts b/packages/sdk/src/https/datasets/space/SpaceDataset.ts index 2c49b03715..b46c7a8629 100644 --- a/packages/sdk/src/https/datasets/space/SpaceDataset.ts +++ b/packages/sdk/src/https/datasets/space/SpaceDataset.ts @@ -19,43 +19,116 @@ import { switchMap } from 'rxjs'; import { DatasetClass } from '../Dataset'; import { SubsetType } from '../common'; +/** + * Space Dataset + */ export class SpaceDataset extends DatasetClass { + /** + * Create Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceCreateRequest} + * @returns + */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.createSpace)(req); - + /** + * Update Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceUpdateRequest} + * @returns + */ update = (req: Build5Request) => this.sendRequest(WEN_FUNC.updateSpace)(req); - + /** + * Join Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceJoinRequest} + * @returns + */ join = (req: Build5Request) => this.sendRequest(WEN_FUNC.joinSpace)(req); - + /** + * Leave Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceLeaveRequest} + * @returns + */ leave = (req: Build5Request) => this.sendRequest(WEN_FUNC.leaveSpace)(req); - + /** + * Block Member on Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceMemberUpsertRequest} + * @returns + */ blockMember = (req: Build5Request) => this.sendRequest(WEN_FUNC.blockMemberSpace)(req); - + /** + * Unblock Member on Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceMemberUpsertRequest} + * @returns + */ unblockMember = (req: Build5Request) => this.sendRequest(WEN_FUNC.unblockMemberSpace)(req); - + /** + * Accept Member on Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceMemberUpsertRequest} + * @returns + */ acceptMember = (req: Build5Request) => this.sendRequest(WEN_FUNC.acceptMemberSpace)(req); - + /** + * Decline member on Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceMemberUpsertRequest} + * @returns + */ declineMember = (req: Build5Request) => this.sendRequest(WEN_FUNC.declineMemberSpace)(req); - + /** + * Add Guardian on Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceMemberUpsertRequest} + * @returns + */ addGuardian = (req: Build5Request) => this.sendRequest(WEN_FUNC.addGuardianSpace)(req); - + /** + * Remove Guardian on Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceMemberUpsertRequest} + * @returns + */ removeGuardian = (req: Build5Request) => this.sendRequest(WEN_FUNC.removeGuardianSpace)(req); - + /** + * Claim Space. + * + * @param req Use {@link Build5Request} with data based on {@link SpaceClaimRequest} + * @returns + */ claim = (req: Build5Request) => this.sendRequest(WEN_FUNC.claimSpace)(req); - + /** + * Validate address on Space. + * + * @param req Use {@link Build5Request} with data based on {@link AddressValidationRequest} + * @returns + */ validateAddress = (req: Build5Request) => this.sendRequest(WEN_FUNC.validateAddress)(req); - + /** + * TODO + * + * @param member + * @param orderBy + * @param orderByDir + * @param startAfter + * @param limit + * @returns + */ getTopByMember = ( member: string, orderBy = ['createdOn'], @@ -71,7 +144,16 @@ export class SpaceDataset extends DatasetClass { return (await Promise.all(promises)).map((s) => s!); }), ); - + /** + * TODO + * + * @param member + * @param orderBy + * @param orderByDir + * @param startAfter + * @param limit + * @returns + */ getPendingSpacesByMemberLive = ( member: string, orderBy = ['createdOn'], diff --git a/packages/sdk/src/https/datasets/space/SpaceGuardianSubset.ts b/packages/sdk/src/https/datasets/space/SpaceGuardianSubset.ts index 9d4c2b2fd5..c9f333fab7 100644 --- a/packages/sdk/src/https/datasets/space/SpaceGuardianSubset.ts +++ b/packages/sdk/src/https/datasets/space/SpaceGuardianSubset.ts @@ -1,4 +1,7 @@ import { SpaceMember } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Space guardian subset + */ export class SpaceGuardianSubset extends SubsetClass {} diff --git a/packages/sdk/src/https/datasets/space/SpaceKnockingMemberSubset.ts b/packages/sdk/src/https/datasets/space/SpaceKnockingMemberSubset.ts index b70deaf196..b86064b935 100644 --- a/packages/sdk/src/https/datasets/space/SpaceKnockingMemberSubset.ts +++ b/packages/sdk/src/https/datasets/space/SpaceKnockingMemberSubset.ts @@ -1,4 +1,7 @@ import { SpaceMember } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Space knocking member subset + */ export class SpaceKnockingMemberSubset extends SubsetClass {} diff --git a/packages/sdk/src/https/datasets/space/SpaceMemberSubset.ts b/packages/sdk/src/https/datasets/space/SpaceMemberSubset.ts index 0d1efa9aee..ddc475a708 100644 --- a/packages/sdk/src/https/datasets/space/SpaceMemberSubset.ts +++ b/packages/sdk/src/https/datasets/space/SpaceMemberSubset.ts @@ -1,4 +1,7 @@ import { SpaceMember } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Space Member subset + */ export class SpaceMemberSubset extends SubsetClass {} diff --git a/packages/sdk/src/https/datasets/token/AirdropDataset.ts b/packages/sdk/src/https/datasets/token/AirdropDataset.ts index b1cd3bd5ce..8a02ba3f37 100644 --- a/packages/sdk/src/https/datasets/token/AirdropDataset.ts +++ b/packages/sdk/src/https/datasets/token/AirdropDataset.ts @@ -10,18 +10,42 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from '../Dataset'; +/** + * Airdrop dataset. + */ export class AirdropDataset extends DatasetClass { + /** + * Airdrop tokens. + * + * @param req Use {@link Build5Request} with data based on {@link CreateAirdropsRequest} + * @returns + */ airdropToken = (req: Build5Request) => this.sendRequest(WEN_FUNC.airdropToken)(req); - + /** + * Airdrop minted tokens. + * + * @param req Use {@link Build5Request} with data based on {@link CreateAirdropsRequest} + * @returns + */ airdropMintedToken = (req: Build5Request) => this.sendRequest(WEN_FUNC.airdropMintedToken)(req); - + /** + * Claimed minted token airdrop. + * + * @param req Use {@link Build5Request} with data based on {@link ClaimAirdroppedTokensRequest} + * @returns + */ claimMintedAirdrop = (req: Build5Request) => this.sendRequest(WEN_FUNC.claimMintedTokenOrder)( req, ); - + /** + * Claim token airdrop. + * + * @param req Use {@link Build5Request} with data based on {@link ClaimPreMintedAirdroppedTokensRequest} + * @returns + */ claimAirdropped = (req: Build5Request) => this.sendRequest(WEN_FUNC.claimAirdroppedToken)< ClaimPreMintedAirdroppedTokensRequest, diff --git a/packages/sdk/src/https/datasets/token/TokenDataset.ts b/packages/sdk/src/https/datasets/token/TokenDataset.ts index 29dae123a2..dfbfdb2bbb 100644 --- a/packages/sdk/src/https/datasets/token/TokenDataset.ts +++ b/packages/sdk/src/https/datasets/token/TokenDataset.ts @@ -23,40 +23,106 @@ import { } from '@build-5/interfaces'; import { DatasetClass } from '../Dataset'; +/** + * Token Dataset + */ export class TokenDataset extends DatasetClass { + /** + * Create token. + * + * @param req Use {@link Build5Request} with data based on {@link TokenCreateRequest} + * @returns + */ create = (req: Build5Request) => this.sendRequest(WEN_FUNC.createToken)(req); - + /** + * Update token. + * + * @param req Use {@link Build5Request} with data based on {@link TokenUpdateRequest} + * @returns + */ update = (req: Build5Request) => this.sendRequest(WEN_FUNC.updateToken)(req); - + /** + * Set token for sale on the launchpad. + * + * @param req Use {@link Build5Request} with data based on {@link SetTokenForSaleRequest} + * @returns + */ setAvailableForSale = (req: Build5Request) => this.sendRequest(WEN_FUNC.setTokenAvailableForSale)(req); - + /** + * Cancel public token sale. + * + * @param req Use {@link Build5Request} with data based on {@link CanelPublicSaleRequest} + * @returns + */ cancelPublicSale = (req: Build5Request) => this.sendRequest(WEN_FUNC.cancelPublicSale)(req); - + /** + * Order Token request. + * + * @param req Use {@link Build5Request} with data based on {@link OrderTokenRequest} + * @returns + */ order = (req: Build5Request) => this.sendRequest(WEN_FUNC.orderToken)(req); - + /** + * Credit token request. + * + * @param req Use {@link Build5Request} with data based on {@link CreditTokenRequest} + * @returns + */ credit = (req: Build5Request) => this.sendRequest(WEN_FUNC.creditToken)(req); - + /** + * Update member details. + * + * @param req Use {@link Build5Request} with data based on {@link MemberUpdateRequest} + * @returns + */ mint = (req: Build5Request) => this.sendRequest(WEN_FUNC.mintTokenOrder)(req); - + /** + * Enable token for trading on a exchange. + * + * @param req Use {@link Build5Request} with data based on {@link EnableTokenTradingRequest} + * @returns + */ enableTrading = (req: Build5Request) => this.sendRequest(WEN_FUNC.enableTokenTrading)(req); - + /** + * Imported minted token from the chain. + * + * @param req Use {@link Build5Request} with data based on {@link ImportMintedTokenRequest} + * @returns + */ importMintedToken = (req: Build5Request) => this.sendRequest(WEN_FUNC.importMintedToken)(req); - + /** + * Vote on token. + * + * @param req Use {@link Build5Request} with data based on {@link VoteRequest} + * @returns + */ vote = (req: Build5Request) => this.sendRequest(WEN_FUNC.voteController)(req); - + /** + * Rank token. + * + * @param req Use {@link Build5Request} with data based on {@link RankRequest} + * @returns + */ rank = (req: Build5Request) => this.sendRequest(WEN_FUNC.rankController)(req); + /** + * Get tokens by member. Real time stream. + * @param member + * @param startAfter + * @param limit + * @returns + */ getByMemberLive = (member: string, startAfter?: string, limit?: number) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -70,7 +136,13 @@ export class TokenDataset extends DatasetClass { }; return this.getManyAdvancedLive(params); }; - + /** + * Get status for token. Real time stream. + * @param status + * @param startAfter + * @param limit + * @returns + */ getByStatusLive = (status: TokenStatus[] = [], startAfter?: string, limit?: number) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, diff --git a/packages/sdk/src/https/datasets/token/TokenDistributionSubset.ts b/packages/sdk/src/https/datasets/token/TokenDistributionSubset.ts index a9abf89ca9..1d4c43fc19 100644 --- a/packages/sdk/src/https/datasets/token/TokenDistributionSubset.ts +++ b/packages/sdk/src/https/datasets/token/TokenDistributionSubset.ts @@ -1,4 +1,7 @@ import { TokenDistribution } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Token Distribution subset + */ export class TokenDistributionSubset extends SubsetClass {} diff --git a/packages/sdk/src/https/datasets/token/TokenMarketDataset.ts b/packages/sdk/src/https/datasets/token/TokenMarketDataset.ts index 72b8f2cd8a..154fffdf0a 100644 --- a/packages/sdk/src/https/datasets/token/TokenMarketDataset.ts +++ b/packages/sdk/src/https/datasets/token/TokenMarketDataset.ts @@ -19,9 +19,21 @@ import GetTokenPriceGroupedLive from '../../get/GetTokenPriceGroupedLive'; import { DatasetClass } from '../Dataset'; export class TokenMarketDataset extends DatasetClass { + /** + * Trade token. + * + * @param req Use {@link Build5Request} with data based on {@link TradeTokenRequest} + * @returns + */ tradeToken = (req: Build5Request) => this.sendRequest(WEN_FUNC.tradeToken)(req); + /** + * TODO + * + * @param token + * @returns + */ getTokenPrice = (token: string) => GetTokenPriceGrouped.get({ origin: this.origin, @@ -30,6 +42,12 @@ export class TokenMarketDataset extends DatasetClass from( GetTokenPriceGroupedLive.get({ @@ -43,12 +61,27 @@ export class TokenMarketDataset extends DatasetClass r || { id: token, price: 0, usdPrice: 0 }), ); + /** + * TODO + * + * @param token + * @returns + */ getTokenPriceInUsd = async (token: string) => { const url = this.origin + ApiRoutes.GET_TOKEN_PRICE; const response = await wrappedFetch(this.origin, url, { token }); return (response as Record).usdPrice; }; + /** + * TODO + * + * @param token + * @param type + * @param status + * @param startAfter + * @returns + */ getBidsLive = ( token: string, type: TokenTradeOrderType, @@ -67,6 +100,14 @@ export class TokenMarketDataset extends DatasetClass extends DatasetClass { + /** + * TODO + * @param token + * @param startAfter + * @returns + */ getPuchasesLive = (token: string, startAfter?: string) => { const params: GetManyAdvancedRequest = { dataset: this.dataset, @@ -24,7 +33,11 @@ export class TokenPurchaseDataset extends DatasetClass from( GetTokenAvgPriceGroupedLive.get({ @@ -37,7 +50,11 @@ export class TokenPurchaseDataset extends DatasetClass inner), map((result) => result?.avg || 0), ); - + /** + * TODO + * @param token + * @returns + */ getPriceChangeLive = (token: string) => from( GetTokenPriceChangeGroupedLive.get({ diff --git a/packages/sdk/src/https/datasets/token/TokenStatsSubset.ts b/packages/sdk/src/https/datasets/token/TokenStatsSubset.ts index 661bd534c6..c9a7eab626 100644 --- a/packages/sdk/src/https/datasets/token/TokenStatsSubset.ts +++ b/packages/sdk/src/https/datasets/token/TokenStatsSubset.ts @@ -1,4 +1,7 @@ import { TokenStats } from '@build-5/interfaces'; import { SubsetClass } from '../Subset'; +/** + * Token stats subset + */ export class TokenStatsSubset extends SubsetClass {}