@niftykit/diamond 0.2.2 → 0.2.3
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/dist/cjs/Diamond.js +27 -0
- package/dist/esm/Diamond.js +27 -0
- package/dist/types/Diamond.d.ts +2 -0
- package/dist/umd/index.js +1 -1
- package/package.json +2 -2
package/dist/cjs/Diamond.js
CHANGED
|
@@ -98,6 +98,9 @@ var Diamond = /** @class */ (function () {
|
|
|
98
98
|
Diamond.prototype.verify = function (wallet) {
|
|
99
99
|
return Diamond.verifyWallet(this.collectionId, wallet, this.isDev);
|
|
100
100
|
};
|
|
101
|
+
Diamond.prototype.verifyForEdition = function (wallet, editionId) {
|
|
102
|
+
return Diamond.verifyWalletForEdition(this.collectionId, wallet, editionId, this.isDev);
|
|
103
|
+
};
|
|
101
104
|
Diamond.create = function (signerOrProvider, key, data, isDev) {
|
|
102
105
|
return __awaiter(this, void 0, void 0, function () {
|
|
103
106
|
var instance;
|
|
@@ -141,6 +144,30 @@ var Diamond = /** @class */ (function () {
|
|
|
141
144
|
});
|
|
142
145
|
});
|
|
143
146
|
};
|
|
147
|
+
Diamond.verifyWalletForEdition = function (collectionId, wallet, editionId, isDev) {
|
|
148
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
149
|
+
var baseUrl, url, resp, message;
|
|
150
|
+
return __generator(this, function (_a) {
|
|
151
|
+
switch (_a.label) {
|
|
152
|
+
case 0:
|
|
153
|
+
baseUrl = isDev ? endpoint_1.API_ENDPOINT_DEV : endpoint_1.API_ENDPOINT;
|
|
154
|
+
url = "".concat(baseUrl, "/v3/editions/list/").concat(collectionId, "/").concat(editionId);
|
|
155
|
+
return [4 /*yield*/, axios_1.default.post(url, {
|
|
156
|
+
wallet: wallet,
|
|
157
|
+
}, {
|
|
158
|
+
validateStatus: function (status) { return status < 500; },
|
|
159
|
+
})];
|
|
160
|
+
case 1:
|
|
161
|
+
resp = _a.sent();
|
|
162
|
+
if (resp.status >= 400) {
|
|
163
|
+
message = resp.data.message;
|
|
164
|
+
throw new Error(message);
|
|
165
|
+
}
|
|
166
|
+
return [2 /*return*/, resp.data];
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
};
|
|
144
171
|
Diamond.getCollectionData = function (collectionId, isDev) {
|
|
145
172
|
return __awaiter(this, void 0, void 0, function () {
|
|
146
173
|
var baseUrl, url, resp, message;
|
package/dist/esm/Diamond.js
CHANGED
|
@@ -93,6 +93,9 @@ var Diamond = /** @class */ (function () {
|
|
|
93
93
|
Diamond.prototype.verify = function (wallet) {
|
|
94
94
|
return Diamond.verifyWallet(this.collectionId, wallet, this.isDev);
|
|
95
95
|
};
|
|
96
|
+
Diamond.prototype.verifyForEdition = function (wallet, editionId) {
|
|
97
|
+
return Diamond.verifyWalletForEdition(this.collectionId, wallet, editionId, this.isDev);
|
|
98
|
+
};
|
|
96
99
|
Diamond.create = function (signerOrProvider, key, data, isDev) {
|
|
97
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
98
101
|
var instance;
|
|
@@ -136,6 +139,30 @@ var Diamond = /** @class */ (function () {
|
|
|
136
139
|
});
|
|
137
140
|
});
|
|
138
141
|
};
|
|
142
|
+
Diamond.verifyWalletForEdition = function (collectionId, wallet, editionId, isDev) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var baseUrl, url, resp, message;
|
|
145
|
+
return __generator(this, function (_a) {
|
|
146
|
+
switch (_a.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
baseUrl = isDev ? API_ENDPOINT_DEV : API_ENDPOINT;
|
|
149
|
+
url = "".concat(baseUrl, "/v3/editions/list/").concat(collectionId, "/").concat(editionId);
|
|
150
|
+
return [4 /*yield*/, axios.post(url, {
|
|
151
|
+
wallet: wallet,
|
|
152
|
+
}, {
|
|
153
|
+
validateStatus: function (status) { return status < 500; },
|
|
154
|
+
})];
|
|
155
|
+
case 1:
|
|
156
|
+
resp = _a.sent();
|
|
157
|
+
if (resp.status >= 400) {
|
|
158
|
+
message = resp.data.message;
|
|
159
|
+
throw new Error(message);
|
|
160
|
+
}
|
|
161
|
+
return [2 /*return*/, resp.data];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
};
|
|
139
166
|
Diamond.getCollectionData = function (collectionId, isDev) {
|
|
140
167
|
return __awaiter(this, void 0, void 0, function () {
|
|
141
168
|
var baseUrl, url, resp, message;
|
package/dist/types/Diamond.d.ts
CHANGED
|
@@ -24,7 +24,9 @@ export default class Diamond {
|
|
|
24
24
|
init(): Promise<void>;
|
|
25
25
|
initWithData(data: CollectionApiResponse): void;
|
|
26
26
|
verify(wallet: string): Promise<VerifyApiResponse>;
|
|
27
|
+
verifyForEdition(wallet: string, editionId: number): Promise<VerifyApiResponse>;
|
|
27
28
|
static create(signerOrProvider: Signer | Provider, key: string, data?: CollectionApiResponse, isDev?: boolean): Promise<Diamond | null>;
|
|
28
29
|
static verifyWallet(collectionId: string, wallet: string, isDev?: boolean): Promise<VerifyApiResponse>;
|
|
30
|
+
static verifyWalletForEdition(collectionId: string, wallet: string, editionId: number, isDev?: boolean): Promise<VerifyApiResponse>;
|
|
29
31
|
static getCollectionData(collectionId: string, isDev?: boolean): Promise<CollectionApiResponse>;
|
|
30
32
|
}
|