getgems 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -0
- package/dist/api-service/abstract-api.service.d.ts +9 -0
- package/dist/api-service/abstract-api.service.js +51 -0
- package/dist/api-service/abstract-api.types.d.ts +32 -0
- package/dist/api-service/abstract-api.types.js +16 -0
- package/dist/api-service/index.d.ts +2 -0
- package/dist/api-service/index.js +8 -0
- package/dist/cnft-api/cnft-api.service.d.ts +11 -0
- package/dist/cnft-api/cnft-api.service.js +68 -0
- package/dist/cnft-api/index.d.ts +1 -0
- package/dist/cnft-api/index.js +5 -0
- package/dist/gift-api/gift-api.service.d.ts +16 -0
- package/dist/gift-api/gift-api.service.js +64 -0
- package/dist/gift-api/index.d.ts +1 -0
- package/dist/gift-api/index.js +5 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +18 -0
- package/dist/minting-api/index.d.ts +1 -0
- package/dist/minting-api/index.js +5 -0
- package/dist/minting-api/minting-api.service.d.ts +36 -0
- package/dist/minting-api/minting-api.service.js +181 -0
- package/dist/read-api/index.d.ts +1 -0
- package/dist/read-api/index.js +5 -0
- package/dist/read-api/read-api.service.d.ts +100 -0
- package/dist/read-api/read-api.service.js +328 -0
- package/dist/schemas.d.ts +760 -0
- package/dist/schemas.js +130 -0
- package/dist/storage-api/index.d.ts +1 -0
- package/dist/storage-api/index.js +5 -0
- package/dist/storage-api/storage-api.service.d.ts +8 -0
- package/dist/storage-api/storage-api.service.js +44 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Getgems NFT Marketplace API Client
|
|
2
|
+
|
|
3
|
+
**TypeScript SDK for interacting with the Getgems NFT Marketplace API.**
|
|
4
|
+
|
|
5
|
+
This package provides a convenient interface for working with the **Getgems** marketplace, supporting the ability to retrieve collection stats, manage NFTs, and more.
|
|
6
|
+
|
|
7
|
+
This npm package follows the structure and types as outlined in the official [Getgems API documentation](https://api.getgems.io/public-api/docs).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
To install the package, use npm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install getgems
|
|
15
|
+
````
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Initialize the Client
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { Getgems } from 'getgems';
|
|
23
|
+
|
|
24
|
+
const client = new Getgems('your-api-key');
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Accessing APIs
|
|
28
|
+
|
|
29
|
+
The client provides access to the following APIs:
|
|
30
|
+
|
|
31
|
+
1. **ReadApi** – Retrieve Collection Floor Price, NFTs in Collection, and More
|
|
32
|
+
2. **MintingApi** – Create New NFTs and Collections via a Simple API
|
|
33
|
+
3. **cNFTApi** – For Large NFT Collections
|
|
34
|
+
4. **GiftApi** – This is a Special API for Partners Only
|
|
35
|
+
5. **StorageApi** – This is a Special API for Partners Only
|
|
36
|
+
|
|
37
|
+
To access the methods of these APIs, use the following properties of the created client class: `readApi`, `mintingApi`, `cNftApi`, `giftApi`, `storageApi`.
|
|
38
|
+
|
|
39
|
+
### Example:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
//Get collection attributes
|
|
43
|
+
const collectionAttributes = await client.readApi.getCollectionAttributes('collectionAddress');
|
|
44
|
+
|
|
45
|
+
//Create minting task
|
|
46
|
+
const mintingStatus = await client.mintingApi.createMinting('collectionAddress', mintingRequestBody);
|
|
47
|
+
|
|
48
|
+
//Add CNFT to collection
|
|
49
|
+
const addCNFTToCollectionResponse = await client.cNftApi.addCNFTToCollection('collectionAddress', cNFTRequestBody);
|
|
50
|
+
|
|
51
|
+
//Publicly unavailable. Get offchain gifts by specified owner address
|
|
52
|
+
const nftItems = await client.giftApi.getOwnerOffchainGifts('ownerAddress', queryParams);
|
|
53
|
+
|
|
54
|
+
//Publicly unavailable. Create box for storage
|
|
55
|
+
const storageBoxId = await client.storageApi.createStorage();
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The method names correspond to the `operationId` values specified in the `paths/{path}/{httpRequestMethod}/operationId` for each endpoint, as outlined in [JSON file of the official API documentation](https://api.getgems.io/public-api/docs.json)
|
|
59
|
+
|
|
60
|
+
For full documentation of available methods for each API, please refer to the official [Getgems API Documentation](https://api.getgems.io/public-api/docs).
|
|
61
|
+
|
|
62
|
+
## Data Structures
|
|
63
|
+
|
|
64
|
+
If you require any of the Getgems API schema types (e.g., for forming request bodies), you can import them directly from `getgems/schemas`.
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
import { DefaultErrorObject, NftItemFull } from 'getgems/schemas'
|
|
68
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MakeApiRequest } from ".";
|
|
2
|
+
export declare abstract class ApiService {
|
|
3
|
+
private readonly API_KEY;
|
|
4
|
+
private readonly API_BASE_URL;
|
|
5
|
+
constructor(API_KEY: string);
|
|
6
|
+
protected makeApiRequest<Response>({ method, path, body, queryParams }: MakeApiRequest): Promise<Response>;
|
|
7
|
+
private makeUrl;
|
|
8
|
+
private getQueryParams;
|
|
9
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.ApiService = void 0;
|
|
16
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
|
+
class ApiService {
|
|
18
|
+
constructor(API_KEY) {
|
|
19
|
+
this.API_KEY = API_KEY;
|
|
20
|
+
this.API_BASE_URL = 'https://api.getgems.io/public-api';
|
|
21
|
+
}
|
|
22
|
+
makeApiRequest(_a) {
|
|
23
|
+
return __awaiter(this, arguments, void 0, function* ({ method, path, body, queryParams }) {
|
|
24
|
+
try {
|
|
25
|
+
const res = yield (0, node_fetch_1.default)(this.makeUrl(path, queryParams), {
|
|
26
|
+
method,
|
|
27
|
+
body,
|
|
28
|
+
headers: {
|
|
29
|
+
accept: 'application/json',
|
|
30
|
+
'Authorization': this.API_KEY
|
|
31
|
+
}
|
|
32
|
+
}).then(res => res.json());
|
|
33
|
+
return res;
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
throw new Error(`Method: ${method} | Path: ${path} | Make API reqeuest: ${err}`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
makeUrl(path, queryParams) {
|
|
41
|
+
let url = `${this.API_BASE_URL}${path}`;
|
|
42
|
+
if (queryParams) {
|
|
43
|
+
url += `?${this.getQueryParams(queryParams)}`;
|
|
44
|
+
}
|
|
45
|
+
return url;
|
|
46
|
+
}
|
|
47
|
+
getQueryParams(params) {
|
|
48
|
+
return new URLSearchParams(Object.fromEntries(Object.entries(params).filter(([_, val]) => val !== undefined))).toString();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.ApiService = ApiService;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BodyInit } from "node-fetch";
|
|
2
|
+
import { EHistoryType } from "../schemas";
|
|
3
|
+
export declare enum EApiRequestMethod {
|
|
4
|
+
GET = "GET",
|
|
5
|
+
POST = "POST",
|
|
6
|
+
PATCH = "PATCH"
|
|
7
|
+
}
|
|
8
|
+
export interface MakeApiRequest {
|
|
9
|
+
method: EApiRequestMethod;
|
|
10
|
+
path: string;
|
|
11
|
+
body?: BodyInit;
|
|
12
|
+
queryParams?: ApiQueryParams;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiQueryParams {
|
|
15
|
+
after?: AfterParameter;
|
|
16
|
+
limit?: LimitParameter;
|
|
17
|
+
minTime?: MinTimeParameter;
|
|
18
|
+
maxTime?: MaxTimeParameter;
|
|
19
|
+
types?: EHistoryType[];
|
|
20
|
+
reverse?: boolean;
|
|
21
|
+
kind?: ECollectionsTopKind;
|
|
22
|
+
}
|
|
23
|
+
export type LimitParameter = number;
|
|
24
|
+
export type AfterParameter = string;
|
|
25
|
+
export type MinTimeParameter = number;
|
|
26
|
+
export type MaxTimeParameter = number;
|
|
27
|
+
export declare enum ECollectionsTopKind {
|
|
28
|
+
Day = "day",
|
|
29
|
+
Week = "week",
|
|
30
|
+
Month = "month",
|
|
31
|
+
All = "all"
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ECollectionsTopKind = exports.EApiRequestMethod = void 0;
|
|
4
|
+
var EApiRequestMethod;
|
|
5
|
+
(function (EApiRequestMethod) {
|
|
6
|
+
EApiRequestMethod["GET"] = "GET";
|
|
7
|
+
EApiRequestMethod["POST"] = "POST";
|
|
8
|
+
EApiRequestMethod["PATCH"] = "PATCH";
|
|
9
|
+
})(EApiRequestMethod || (exports.EApiRequestMethod = EApiRequestMethod = {}));
|
|
10
|
+
var ECollectionsTopKind;
|
|
11
|
+
(function (ECollectionsTopKind) {
|
|
12
|
+
ECollectionsTopKind["Day"] = "day";
|
|
13
|
+
ECollectionsTopKind["Week"] = "week";
|
|
14
|
+
ECollectionsTopKind["Month"] = "month";
|
|
15
|
+
ECollectionsTopKind["All"] = "all";
|
|
16
|
+
})(ECollectionsTopKind || (exports.ECollectionsTopKind = ECollectionsTopKind = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ECollectionsTopKind = exports.EApiRequestMethod = exports.ApiService = void 0;
|
|
4
|
+
var abstract_api_service_1 = require("./abstract-api.service");
|
|
5
|
+
Object.defineProperty(exports, "ApiService", { enumerable: true, get: function () { return abstract_api_service_1.ApiService; } });
|
|
6
|
+
var abstract_api_types_1 = require("./abstract-api.types");
|
|
7
|
+
Object.defineProperty(exports, "EApiRequestMethod", { enumerable: true, get: function () { return abstract_api_types_1.EApiRequestMethod; } });
|
|
8
|
+
Object.defineProperty(exports, "ECollectionsTopKind", { enumerable: true, get: function () { return abstract_api_types_1.ECollectionsTopKind; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ApiService } from "../api-service";
|
|
2
|
+
import { MintingWalletBalanceResponse, FailedResponse, MintingMessageResponse, AddCNFTToCollectionResponse, CNFTRequest, OpenCNFTResult, UploadResponse } from "../schemas";
|
|
3
|
+
export declare class CNFTApiService extends ApiService {
|
|
4
|
+
constructor(API_KEY: string);
|
|
5
|
+
mintingWalletBalance(collectionAddress: string): Promise<FailedResponse | MintingWalletBalanceResponse>;
|
|
6
|
+
mintingWalletRefund(collectionAddress: string, receiverAddress: string): Promise<FailedResponse | MintingMessageResponse>;
|
|
7
|
+
mintingDeactivateApi(collectionAddress: string): Promise<FailedResponse | MintingMessageResponse>;
|
|
8
|
+
addCNFTToCollection(collectionAddress: string, body: CNFTRequest): Promise<FailedResponse | AddCNFTToCollectionResponse>;
|
|
9
|
+
openCNFTMintInCollection(collectionAddress: string): Promise<FailedResponse | OpenCNFTResult>;
|
|
10
|
+
createCNFTUpload(collectionAddress: string, fileName: string): Promise<FailedResponse | UploadResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CNFTApiService = void 0;
|
|
13
|
+
const api_service_1 = require("../api-service");
|
|
14
|
+
class CNFTApiService extends api_service_1.ApiService {
|
|
15
|
+
constructor(API_KEY) {
|
|
16
|
+
super(API_KEY);
|
|
17
|
+
}
|
|
18
|
+
mintingWalletBalance(collectionAddress) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return this.makeApiRequest({
|
|
21
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
22
|
+
path: `/minting/${collectionAddress}/wallet-balance`
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
mintingWalletRefund(collectionAddress, receiverAddress) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return this.makeApiRequest({
|
|
29
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
30
|
+
path: `/minting/${collectionAddress}/refund/${receiverAddress}`
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
mintingDeactivateApi(collectionAddress) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
return this.makeApiRequest({
|
|
37
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
38
|
+
path: `/minting/${collectionAddress}/deactivate-api`
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
addCNFTToCollection(collectionAddress, body) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return this.makeApiRequest({
|
|
45
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
46
|
+
path: `/cnft/${collectionAddress}/add-nft`,
|
|
47
|
+
body: JSON.stringify(body)
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
openCNFTMintInCollection(collectionAddress) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return this.makeApiRequest({
|
|
54
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
55
|
+
path: `/cnft/${collectionAddress}/open-minting`,
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
createCNFTUpload(collectionAddress, fileName) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return this.makeApiRequest({
|
|
62
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
63
|
+
path: `/cnft/create-upload/${collectionAddress}/${fileName}`,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.CNFTApiService = CNFTApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CNFTApiService } from './cnft-api.service';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CNFTApiService = void 0;
|
|
4
|
+
var cnft_api_service_1 = require("./cnft-api.service");
|
|
5
|
+
Object.defineProperty(exports, "CNFTApiService", { enumerable: true, get: function () { return cnft_api_service_1.CNFTApiService; } });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AfterParameter, ApiService, LimitParameter } from "../api-service";
|
|
2
|
+
import { ConfirmTransferRequest, ConfirmTransferResponse, FailedResponse, GiftTransferRequest, NftItemsFullResponse, RequestTransferResponse, TransferOffchainGiftRequest, TransferResponse } from "../schemas";
|
|
3
|
+
export declare class GiftApiService extends ApiService {
|
|
4
|
+
constructor(API_KEY: string);
|
|
5
|
+
transferOffchainGift(address: string, body: TransferOffchainGiftRequest): Promise<FailedResponse | TransferResponse>;
|
|
6
|
+
getCollectionOwnerOffchainGifts(collectionAddress: string, ownerAddress: string, queryParams?: {
|
|
7
|
+
after?: AfterParameter;
|
|
8
|
+
limit?: LimitParameter;
|
|
9
|
+
}): Promise<FailedResponse | NftItemsFullResponse>;
|
|
10
|
+
getOwnerOffchainGifts(ownerAddress: string, queryParams?: {
|
|
11
|
+
after?: AfterParameter;
|
|
12
|
+
limit?: LimitParameter;
|
|
13
|
+
}): Promise<FailedResponse | NftItemsFullResponse>;
|
|
14
|
+
requestGiftTransfer(body: GiftTransferRequest): Promise<FailedResponse | RequestTransferResponse>;
|
|
15
|
+
confirmGiftTransfer(body: ConfirmTransferRequest): Promise<FailedResponse | ConfirmTransferResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.GiftApiService = void 0;
|
|
13
|
+
const api_service_1 = require("../api-service");
|
|
14
|
+
class GiftApiService extends api_service_1.ApiService {
|
|
15
|
+
constructor(API_KEY) {
|
|
16
|
+
super(API_KEY);
|
|
17
|
+
}
|
|
18
|
+
transferOffchainGift(address, body) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return this.makeApiRequest({
|
|
21
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
22
|
+
path: `/v1/gifts/offchain/transfer/${address}`,
|
|
23
|
+
body: JSON.stringify(body)
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getCollectionOwnerOffchainGifts(collectionAddress, ownerAddress, queryParams) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.makeApiRequest({
|
|
30
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
31
|
+
path: `/v1/gifts/offchain/${collectionAddress}/owner/${ownerAddress}`,
|
|
32
|
+
queryParams
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
getOwnerOffchainGifts(ownerAddress, queryParams) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return this.makeApiRequest({
|
|
39
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
40
|
+
path: `/v1/gifts/offchain/owner/${ownerAddress}`,
|
|
41
|
+
queryParams
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
requestGiftTransfer(body) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return this.makeApiRequest({
|
|
48
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
49
|
+
path: `/v1/gifts/request-transfer`,
|
|
50
|
+
body: JSON.stringify(body)
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
confirmGiftTransfer(body) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return this.makeApiRequest({
|
|
57
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
58
|
+
path: `/v1/gifts/confirm-transfer`,
|
|
59
|
+
body: JSON.stringify(body)
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.GiftApiService = GiftApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GiftApiService } from './gift-api.service';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GiftApiService = void 0;
|
|
4
|
+
var gift_api_service_1 = require("./gift-api.service");
|
|
5
|
+
Object.defineProperty(exports, "GiftApiService", { enumerable: true, get: function () { return gift_api_service_1.GiftApiService; } });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReadApiService } from "./read-api";
|
|
2
|
+
import { MintingApiService } from "./minting-api";
|
|
3
|
+
import { CNFTApiService } from "./cnft-api";
|
|
4
|
+
import { GiftApiService } from "./gift-api";
|
|
5
|
+
import { StorageApiService } from "./storage-api";
|
|
6
|
+
declare class GetgemsService {
|
|
7
|
+
readApi: ReadApiService;
|
|
8
|
+
mintingApi: MintingApiService;
|
|
9
|
+
cNftApi: CNFTApiService;
|
|
10
|
+
giftApi: GiftApiService;
|
|
11
|
+
storageApi: StorageApiService;
|
|
12
|
+
constructor(apiKey: string);
|
|
13
|
+
}
|
|
14
|
+
export { GetgemsService as Getgems };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Getgems = void 0;
|
|
4
|
+
const read_api_1 = require("./read-api");
|
|
5
|
+
const minting_api_1 = require("./minting-api");
|
|
6
|
+
const cnft_api_1 = require("./cnft-api");
|
|
7
|
+
const gift_api_1 = require("./gift-api");
|
|
8
|
+
const storage_api_1 = require("./storage-api");
|
|
9
|
+
class GetgemsService {
|
|
10
|
+
constructor(apiKey) {
|
|
11
|
+
this.readApi = new read_api_1.ReadApiService(apiKey);
|
|
12
|
+
this.mintingApi = new minting_api_1.MintingApiService(apiKey);
|
|
13
|
+
this.cNftApi = new cnft_api_1.CNFTApiService(apiKey);
|
|
14
|
+
this.giftApi = new gift_api_1.GiftApiService(apiKey);
|
|
15
|
+
this.storageApi = new storage_api_1.StorageApiService(apiKey);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.Getgems = GetgemsService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MintingApiService } from './minting-api.service';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MintingApiService = void 0;
|
|
4
|
+
var minting_api_service_1 = require("./minting-api.service");
|
|
5
|
+
Object.defineProperty(exports, "MintingApiService", { enumerable: true, get: function () { return minting_api_service_1.MintingApiService; } });
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AfterParameter, ApiService, LimitParameter } from "../api-service";
|
|
2
|
+
import { BatchMintingRequest, BatchMintingStatusResponse, CollectionUpdateRequest, CreateNewCollectionRequest, DefaultErrorObject, FailedResponse, MintingListResponse, MintingMessageResponse, MintingRequest, MintingStatusResponse, MintingWalletBalanceResponse, NftCollectionCreatingStatusResponse, NftItemResponse, NftItemsResponse, UpdateRequest, UpdateResponse, UploadResponse, V2BatchMintingRequest } from "../schemas";
|
|
3
|
+
export declare class MintingApiService extends ApiService {
|
|
4
|
+
constructor(API_KEY: string);
|
|
5
|
+
createMinting(collectionAddress: string, body: MintingRequest): Promise<FailedResponse | MintingStatusResponse>;
|
|
6
|
+
createBatchMinting(collectionAddress: string, body: BatchMintingRequest): Promise<FailedResponse | BatchMintingStatusResponse>;
|
|
7
|
+
v2CreateBatchMinting(collectionAddress: string, body: V2BatchMintingRequest): Promise<FailedResponse | BatchMintingStatusResponse>;
|
|
8
|
+
v2GetBatchStatus(collectionAddress: string, body: {
|
|
9
|
+
requestIds: string[];
|
|
10
|
+
}): Promise<FailedResponse | BatchMintingStatusResponse>;
|
|
11
|
+
mintingWalletBalance(collectionAddress: string): Promise<FailedResponse | MintingWalletBalanceResponse>;
|
|
12
|
+
mintingWalletRefund(collectionAddress: string, receiverAddress: string): Promise<FailedResponse | MintingMessageResponse>;
|
|
13
|
+
mintingDeactivateApi(collectionAddress: string): Promise<FailedResponse | MintingMessageResponse>;
|
|
14
|
+
getStatus(collectionAddress: string, requestId: string): Promise<FailedResponse | MintingStatusResponse>;
|
|
15
|
+
getMintingList(collectionAddress: string, queryParams?: {
|
|
16
|
+
after?: AfterParameter;
|
|
17
|
+
limit?: LimitParameter;
|
|
18
|
+
reverse?: boolean;
|
|
19
|
+
}): Promise<FailedResponse | MintingListResponse>;
|
|
20
|
+
createUpload(collectionAddress: string, fileName: string): Promise<FailedResponse | UploadResponse>;
|
|
21
|
+
getNftByAddress(collectionAddress: string, nftAddress: string): Promise<FailedResponse | NftItemResponse>;
|
|
22
|
+
getNftsInCollection(collectionAddress: string, queryParams?: {
|
|
23
|
+
after?: AfterParameter;
|
|
24
|
+
limit?: LimitParameter;
|
|
25
|
+
}): Promise<FailedResponse | NftItemsResponse>;
|
|
26
|
+
getUserNftsInCollection(collectionAddress: string, userAddress: string, queryParams?: {
|
|
27
|
+
after?: AfterParameter;
|
|
28
|
+
limit?: LimitParameter;
|
|
29
|
+
}): Promise<FailedResponse | NftItemsResponse>;
|
|
30
|
+
getUpdateNftStatus(collectionAddress: string, nftAddress: string): Promise<UpdateResponse | FailedResponse>;
|
|
31
|
+
updateNft(collectionAddress: string, nftAddress: string, body: UpdateRequest): Promise<UpdateResponse | FailedResponse>;
|
|
32
|
+
newNftCollectionStatus(collectionAddress: string, requestId: string): Promise<DefaultErrorObject | FailedResponse | NftCollectionCreatingStatusResponse>;
|
|
33
|
+
createNewNftCollection(collectionAddress: string, body: CreateNewCollectionRequest): Promise<DefaultErrorObject | FailedResponse | NftCollectionCreatingStatusResponse>;
|
|
34
|
+
updateNftCollection(collectionAddress: string, body: CollectionUpdateRequest): Promise<UpdateResponse | FailedResponse>;
|
|
35
|
+
getUpdateNftCollectionStatus(collectionAddress: string, requestId: string): Promise<UpdateResponse | FailedResponse>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MintingApiService = void 0;
|
|
13
|
+
const api_service_1 = require("../api-service");
|
|
14
|
+
class MintingApiService extends api_service_1.ApiService {
|
|
15
|
+
constructor(API_KEY) {
|
|
16
|
+
super(API_KEY);
|
|
17
|
+
}
|
|
18
|
+
createMinting(collectionAddress, body) {
|
|
19
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
return this.makeApiRequest({
|
|
21
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
22
|
+
path: `/minting/${collectionAddress}`,
|
|
23
|
+
body: JSON.stringify(body)
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
createBatchMinting(collectionAddress, body) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
return this.makeApiRequest({
|
|
30
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
31
|
+
path: `/minting/${collectionAddress}/batch`,
|
|
32
|
+
body: JSON.stringify(body)
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
v2CreateBatchMinting(collectionAddress, body) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return this.makeApiRequest({
|
|
39
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
40
|
+
path: `/v2/minting/${collectionAddress}/batch`,
|
|
41
|
+
body: JSON.stringify(body)
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
v2GetBatchStatus(collectionAddress, body) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return this.makeApiRequest({
|
|
48
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
49
|
+
path: `/v2/minting/${collectionAddress}/batch-status`,
|
|
50
|
+
body: JSON.stringify(body)
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
mintingWalletBalance(collectionAddress) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
return this.makeApiRequest({
|
|
57
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
58
|
+
path: `/minting/${collectionAddress}/wallet-balance`
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
mintingWalletRefund(collectionAddress, receiverAddress) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return this.makeApiRequest({
|
|
65
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
66
|
+
path: `/minting/${collectionAddress}/refund/${receiverAddress}`
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
mintingDeactivateApi(collectionAddress) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
return this.makeApiRequest({
|
|
73
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
74
|
+
path: `/minting/${collectionAddress}/deactivate-api`
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
getStatus(collectionAddress, requestId) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
return this.makeApiRequest({
|
|
81
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
82
|
+
path: `/minting/${collectionAddress}/${requestId}`
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
getMintingList(collectionAddress, queryParams) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
return this.makeApiRequest({
|
|
89
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
90
|
+
path: `/minting/${collectionAddress}/list`,
|
|
91
|
+
queryParams
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
createUpload(collectionAddress, fileName) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
return this.makeApiRequest({
|
|
98
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
99
|
+
path: `/minting/create-upload/${collectionAddress}/${fileName}`
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
getNftByAddress(collectionAddress, nftAddress) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return this.makeApiRequest({
|
|
106
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
107
|
+
path: `/nft/collection/by-address/${collectionAddress}/${nftAddress}`
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
getNftsInCollection(collectionAddress, queryParams) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
return this.makeApiRequest({
|
|
114
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
115
|
+
path: `/nft/collection/items/${collectionAddress}`,
|
|
116
|
+
queryParams
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
getUserNftsInCollection(collectionAddress, userAddress, queryParams) {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
return this.makeApiRequest({
|
|
123
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
124
|
+
path: `/nft/collection/items/${collectionAddress}/${userAddress}`,
|
|
125
|
+
queryParams
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
getUpdateNftStatus(collectionAddress, nftAddress) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
return this.makeApiRequest({
|
|
132
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
133
|
+
path: `/minting/${collectionAddress}/update/${nftAddress}`
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
updateNft(collectionAddress, nftAddress, body) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
return this.makeApiRequest({
|
|
140
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
141
|
+
path: `/minting/${collectionAddress}/update/${nftAddress}`,
|
|
142
|
+
body: JSON.stringify(body)
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
newNftCollectionStatus(collectionAddress, requestId) {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
return this.makeApiRequest({
|
|
149
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
150
|
+
path: `/minting/${collectionAddress}/new-collection/${requestId}`
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
createNewNftCollection(collectionAddress, body) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
return this.makeApiRequest({
|
|
157
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
158
|
+
path: `/minting/${collectionAddress}/new-collection`,
|
|
159
|
+
body: JSON.stringify(body)
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
updateNftCollection(collectionAddress, body) {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
return this.makeApiRequest({
|
|
166
|
+
method: api_service_1.EApiRequestMethod.POST,
|
|
167
|
+
path: `/minting/${collectionAddress}/update-collection`,
|
|
168
|
+
body: JSON.stringify(body)
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
getUpdateNftCollectionStatus(collectionAddress, requestId) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
+
return this.makeApiRequest({
|
|
175
|
+
method: api_service_1.EApiRequestMethod.GET,
|
|
176
|
+
path: `/minting/${collectionAddress}/update-collection/${requestId}`
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
exports.MintingApiService = MintingApiService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ReadApiService } from './read-api.service';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadApiService = void 0;
|
|
4
|
+
var read_api_service_1 = require("./read-api.service");
|
|
5
|
+
Object.defineProperty(exports, "ReadApiService", { enumerable: true, get: function () { return read_api_service_1.ReadApiService; } });
|