Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions resources/js/api/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ import FillListing from '~/graphql/mutation/marketplace/FillListing';
import PlaceBid from '~/graphql/mutation/marketplace/PlaceBid';
import FinalizeAuction from '~/graphql/mutation/marketplace/FinalizeAuction';

import CreateTokenGroup from '~/graphql/mutation/token-group/CreateTokenGroup';
import DestroyTokenGroup from '~/graphql/mutation/token-group/DestroyTokenGroup';
import AddTokenToGroup from '~/graphql/mutation/token-group/AddTokenToGroup';
import RemoveTokenFromGroup from '~/graphql/mutation/token-group/RemoveTokenFromGroup';
import SetTokenGroups from '~/graphql/mutation/token-group/SetTokenGroups';
import SetTokenGroupAttribute from '~/graphql/mutation/token-group/SetTokenGroupAttribute';
import RemoveTokenGroupAttribute from '~/graphql/mutation/token-group/RemoveTokenGroupAttribute';

export default {
CreateCollection,
ApproveCollection,
Expand Down Expand Up @@ -142,4 +150,12 @@ export default {
FillListing,
PlaceBid,
FinalizeAuction,

CreateTokenGroup,
DestroyTokenGroup,
AddTokenToGroup,
RemoveTokenFromGroup,
SetTokenGroups,
SetTokenGroupAttribute,
RemoveTokenGroupAttribute,
};
6 changes: 6 additions & 0 deletions resources/js/api/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ import GetSales from '~/graphql/query/marketplace/GetSales';
import GetBlocks from '~/graphql/query/marketplace/GetBlocks';
import GetBanners from '~/graphql/query/GetBanners';

import GetTokenGroup from '~/graphql/query/token-group/GetTokenGroup';
import GetTokenGroups from '~/graphql/query/token-group/GetTokenGroups';

export default {
GetTransaction,
GetCollections,
Expand Down Expand Up @@ -62,4 +65,7 @@ export default {
GetSales,
GetBlocks,
GetBanners,

GetTokenGroup,
GetTokenGroups,
};
137 changes: 137 additions & 0 deletions resources/js/api/token-group.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import { ApiService } from '.';
import mutations from './mutations';
import queries from './queries';

export class TokenGroupApi {
static async getTokenGroup(collectionId: string, tokenGroupId: string) {
const data = {
query: queries.GetTokenGroup,
variables: {
collectionId,
tokenGroupId,
},
};

return ApiService.sendPlatformRequest(data);
}

static async getTokenGroups(collectionId: string | null = null, after: string | null = null) {
const data = {
query: queries.GetTokenGroups,
variables: {
collectionId,
after,
first: 20,
},
};

return ApiService.sendPlatformRequest(data);
}

static async createTokenGroup(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.CreateTokenGroup,
variables: {
collectionId: tokenGroupData.collectionId,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}

static async destroyTokenGroup(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.DestroyTokenGroup,
variables: {
tokenGroupId: tokenGroupData.tokenGroupId,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}

static async addTokenToGroup(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.AddTokenToGroup,
variables: {
collectionId: tokenGroupData.collectionId,
tokenId: tokenGroupData.tokenId,
tokenGroupId: tokenGroupData.tokenGroupId,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}

static async removeTokenFromGroup(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.RemoveTokenFromGroup,
variables: {
collectionId: tokenGroupData.collectionId,
tokenId: tokenGroupData.tokenId,
tokenGroupId: tokenGroupData.tokenGroupId,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}

static async setTokenGroups(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.SetTokenGroups,
variables: {
collectionId: tokenGroupData.collectionId,
tokenId: tokenGroupData.tokenId,
tokenGroups: tokenGroupData.tokenGroups,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}

static async setTokenGroupAttribute(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.SetTokenGroupAttribute,
variables: {
tokenGroupId: tokenGroupData.tokenGroupId,
key: tokenGroupData.key,
value: tokenGroupData.value,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}

static async removeTokenGroupAttribute(tokenGroupData: Record<string, unknown>) {
const data = {
query: mutations.RemoveTokenGroupAttribute,
variables: {
tokenGroupId: tokenGroupData.tokenGroupId,
key: tokenGroupData.key,
signingAccount: tokenGroupData.signingAccount,
idempotencyKey: tokenGroupData.idempotencyKey,
skipValidation: tokenGroupData.skipValidation,
},
};

return ApiService.sendPlatformRequest(data);
}
}
Loading
Loading