@niftykit/redeemable 0.0.4 → 0.0.9
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/package.json +1 -1
- package/dist/cjs/Redeemable.js +0 -182
- package/dist/cjs/config/endpoint.js +0 -5
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/types/api-responses.js +0 -2
- package/dist/cjs/types/redeemable.js +0 -2
- package/dist/esm/Redeemable.js +0 -177
- package/dist/esm/config/endpoint.js +0 -2
- package/dist/esm/index.js +0 -2
- package/dist/esm/types/api-responses.js +0 -1
- package/dist/esm/types/redeemable.js +0 -1
- package/dist/types/Redeemable.d.ts +0 -17
- package/dist/types/config/endpoint.d.ts +0 -2
- package/dist/types/index.d.ts +0 -2
- package/dist/types/types/api-responses.d.ts +0 -6
- package/dist/types/types/redeemable.d.ts +0 -13
- package/dist/umd/index.js +0 -2
- package/dist/umd/index.js.LICENSE.txt +0 -8
package/package.json
CHANGED
package/dist/cjs/Redeemable.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var typechain_1 = require("@niftykit/contracts/typechain");
|
|
43
|
-
var axios_1 = __importDefault(require("axios"));
|
|
44
|
-
var ethers_1 = require("ethers");
|
|
45
|
-
var endpoint_1 = require("./config/endpoint");
|
|
46
|
-
var Redeemable = /** @class */ (function () {
|
|
47
|
-
function Redeemable(isDev) {
|
|
48
|
-
this.contract = {};
|
|
49
|
-
this.version = 1;
|
|
50
|
-
this.isDev = isDev;
|
|
51
|
-
}
|
|
52
|
-
Object.defineProperty(Redeemable.prototype, "apiBaseUrl", {
|
|
53
|
-
get: function () {
|
|
54
|
-
return this.isDev ? endpoint_1.API_ENDPOINT_DEV : endpoint_1.API_ENDPOINT;
|
|
55
|
-
},
|
|
56
|
-
enumerable: false,
|
|
57
|
-
configurable: true
|
|
58
|
-
});
|
|
59
|
-
Redeemable.prototype.init = function (signerOrProvider, contractAddress) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var url, resp;
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
switch (_a.label) {
|
|
64
|
-
case 0:
|
|
65
|
-
if (!ethers_1.ethers.utils.isAddress(contractAddress)) {
|
|
66
|
-
throw new Error('Invalid contract address.');
|
|
67
|
-
}
|
|
68
|
-
url = "".concat(this.apiBaseUrl, "/v2/redeemables/").concat(contractAddress);
|
|
69
|
-
return [4 /*yield*/, axios_1.default.get(url, {
|
|
70
|
-
validateStatus: function (status) { return status < 500; },
|
|
71
|
-
})];
|
|
72
|
-
case 1:
|
|
73
|
-
resp = _a.sent();
|
|
74
|
-
if (resp.status !== 200) {
|
|
75
|
-
throw new Error('Something went wrong.');
|
|
76
|
-
}
|
|
77
|
-
this.version = resp.data.version;
|
|
78
|
-
this.contract =
|
|
79
|
-
this.version === 1
|
|
80
|
-
? typechain_1.TokenCollection__factory.connect(contractAddress, signerOrProvider)
|
|
81
|
-
: typechain_1.TokenCollection__factoryV2.connect(contractAddress, signerOrProvider);
|
|
82
|
-
if (!this.contract) {
|
|
83
|
-
throw new Error('Initialization failed.');
|
|
84
|
-
}
|
|
85
|
-
return [2 /*return*/];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
Redeemable.create = function (signerOrProvider, contractAddress, isDev) {
|
|
91
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
92
|
-
var instance;
|
|
93
|
-
return __generator(this, function (_a) {
|
|
94
|
-
switch (_a.label) {
|
|
95
|
-
case 0:
|
|
96
|
-
instance = new Redeemable(isDev);
|
|
97
|
-
return [4 /*yield*/, instance.init(signerOrProvider, contractAddress)];
|
|
98
|
-
case 1:
|
|
99
|
-
_a.sent();
|
|
100
|
-
return [2 /*return*/, instance];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
Redeemable.prototype.getRedeemable = function (tokenId) {
|
|
106
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
-
var payload, _a;
|
|
108
|
-
return __generator(this, function (_b) {
|
|
109
|
-
switch (_b.label) {
|
|
110
|
-
case 0:
|
|
111
|
-
if (!(this.version === 1)) return [3 /*break*/, 2];
|
|
112
|
-
return [4 /*yield*/, this.contract.redeemableByIndex(tokenId)];
|
|
113
|
-
case 1:
|
|
114
|
-
_a = _b.sent();
|
|
115
|
-
return [3 /*break*/, 4];
|
|
116
|
-
case 2: return [4 /*yield*/, this.contract.redeemableAt(tokenId)];
|
|
117
|
-
case 3:
|
|
118
|
-
_a = _b.sent();
|
|
119
|
-
_b.label = 4;
|
|
120
|
-
case 4:
|
|
121
|
-
payload = _a;
|
|
122
|
-
return [2 /*return*/, {
|
|
123
|
-
index: tokenId,
|
|
124
|
-
tokenURI: payload[0],
|
|
125
|
-
price: payload.price,
|
|
126
|
-
maxAmount: payload[3].toNumber(),
|
|
127
|
-
maxPerWallet: payload.maxPerWallet.toNumber(),
|
|
128
|
-
maxPerMint: payload.maxPerMint.toNumber(),
|
|
129
|
-
redeemedCount: payload.redeemedCount.toNumber(),
|
|
130
|
-
merkleRoot: payload.merkleRoot,
|
|
131
|
-
active: payload.active,
|
|
132
|
-
nonce: payload.nonce,
|
|
133
|
-
}];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
};
|
|
138
|
-
Redeemable.prototype.redeem = function (tokenId, quantity, signature) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var nft;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
switch (_a.label) {
|
|
143
|
-
case 0: return [4 /*yield*/, this.getRedeemable(tokenId)];
|
|
144
|
-
case 1:
|
|
145
|
-
nft = _a.sent();
|
|
146
|
-
return [4 /*yield*/, this.contract['redeem(uint256,uint256,bytes)'](nft.index, quantity, signature, {
|
|
147
|
-
value: nft.price.mul(quantity),
|
|
148
|
-
})];
|
|
149
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
};
|
|
154
|
-
Redeemable.prototype.presaleRedeem = function (tokenId, quantity, signature, proof) {
|
|
155
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
156
|
-
var nft;
|
|
157
|
-
return __generator(this, function (_a) {
|
|
158
|
-
switch (_a.label) {
|
|
159
|
-
case 0: return [4 /*yield*/, this.getRedeemable(tokenId)];
|
|
160
|
-
case 1:
|
|
161
|
-
nft = _a.sent();
|
|
162
|
-
return [4 /*yield*/, this.contract['redeem(uint256,uint256,bytes,bytes32[])'](nft.index, quantity, signature, proof, {
|
|
163
|
-
value: nft.price.mul(quantity),
|
|
164
|
-
})];
|
|
165
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
Redeemable.prototype.burn = function (tokenId) {
|
|
171
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
-
return __generator(this, function (_a) {
|
|
173
|
-
switch (_a.label) {
|
|
174
|
-
case 0: return [4 /*yield*/, this.contract.burn(tokenId)];
|
|
175
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
return Redeemable;
|
|
181
|
-
}());
|
|
182
|
-
exports.default = Redeemable;
|
package/dist/cjs/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var Redeemable_1 = __importDefault(require("./Redeemable"));
|
|
7
|
-
exports.default = Redeemable_1.default;
|
package/dist/esm/Redeemable.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (_) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { TokenCollection__factoryV2, TokenCollection__factory, } from '@niftykit/contracts/typechain';
|
|
38
|
-
import axios from 'axios';
|
|
39
|
-
import { ethers } from 'ethers';
|
|
40
|
-
import { API_ENDPOINT, API_ENDPOINT_DEV } from './config/endpoint';
|
|
41
|
-
var Redeemable = /** @class */ (function () {
|
|
42
|
-
function Redeemable(isDev) {
|
|
43
|
-
this.contract = {};
|
|
44
|
-
this.version = 1;
|
|
45
|
-
this.isDev = isDev;
|
|
46
|
-
}
|
|
47
|
-
Object.defineProperty(Redeemable.prototype, "apiBaseUrl", {
|
|
48
|
-
get: function () {
|
|
49
|
-
return this.isDev ? API_ENDPOINT_DEV : API_ENDPOINT;
|
|
50
|
-
},
|
|
51
|
-
enumerable: false,
|
|
52
|
-
configurable: true
|
|
53
|
-
});
|
|
54
|
-
Redeemable.prototype.init = function (signerOrProvider, contractAddress) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
-
var url, resp;
|
|
57
|
-
return __generator(this, function (_a) {
|
|
58
|
-
switch (_a.label) {
|
|
59
|
-
case 0:
|
|
60
|
-
if (!ethers.utils.isAddress(contractAddress)) {
|
|
61
|
-
throw new Error('Invalid contract address.');
|
|
62
|
-
}
|
|
63
|
-
url = "".concat(this.apiBaseUrl, "/v2/redeemables/").concat(contractAddress);
|
|
64
|
-
return [4 /*yield*/, axios.get(url, {
|
|
65
|
-
validateStatus: function (status) { return status < 500; },
|
|
66
|
-
})];
|
|
67
|
-
case 1:
|
|
68
|
-
resp = _a.sent();
|
|
69
|
-
if (resp.status !== 200) {
|
|
70
|
-
throw new Error('Something went wrong.');
|
|
71
|
-
}
|
|
72
|
-
this.version = resp.data.version;
|
|
73
|
-
this.contract =
|
|
74
|
-
this.version === 1
|
|
75
|
-
? TokenCollection__factory.connect(contractAddress, signerOrProvider)
|
|
76
|
-
: TokenCollection__factoryV2.connect(contractAddress, signerOrProvider);
|
|
77
|
-
if (!this.contract) {
|
|
78
|
-
throw new Error('Initialization failed.');
|
|
79
|
-
}
|
|
80
|
-
return [2 /*return*/];
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
Redeemable.create = function (signerOrProvider, contractAddress, isDev) {
|
|
86
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
-
var instance;
|
|
88
|
-
return __generator(this, function (_a) {
|
|
89
|
-
switch (_a.label) {
|
|
90
|
-
case 0:
|
|
91
|
-
instance = new Redeemable(isDev);
|
|
92
|
-
return [4 /*yield*/, instance.init(signerOrProvider, contractAddress)];
|
|
93
|
-
case 1:
|
|
94
|
-
_a.sent();
|
|
95
|
-
return [2 /*return*/, instance];
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
Redeemable.prototype.getRedeemable = function (tokenId) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
var payload, _a;
|
|
103
|
-
return __generator(this, function (_b) {
|
|
104
|
-
switch (_b.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
if (!(this.version === 1)) return [3 /*break*/, 2];
|
|
107
|
-
return [4 /*yield*/, this.contract.redeemableByIndex(tokenId)];
|
|
108
|
-
case 1:
|
|
109
|
-
_a = _b.sent();
|
|
110
|
-
return [3 /*break*/, 4];
|
|
111
|
-
case 2: return [4 /*yield*/, this.contract.redeemableAt(tokenId)];
|
|
112
|
-
case 3:
|
|
113
|
-
_a = _b.sent();
|
|
114
|
-
_b.label = 4;
|
|
115
|
-
case 4:
|
|
116
|
-
payload = _a;
|
|
117
|
-
return [2 /*return*/, {
|
|
118
|
-
index: tokenId,
|
|
119
|
-
tokenURI: payload[0],
|
|
120
|
-
price: payload.price,
|
|
121
|
-
maxAmount: payload[3].toNumber(),
|
|
122
|
-
maxPerWallet: payload.maxPerWallet.toNumber(),
|
|
123
|
-
maxPerMint: payload.maxPerMint.toNumber(),
|
|
124
|
-
redeemedCount: payload.redeemedCount.toNumber(),
|
|
125
|
-
merkleRoot: payload.merkleRoot,
|
|
126
|
-
active: payload.active,
|
|
127
|
-
nonce: payload.nonce,
|
|
128
|
-
}];
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
Redeemable.prototype.redeem = function (tokenId, quantity, signature) {
|
|
134
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
-
var nft;
|
|
136
|
-
return __generator(this, function (_a) {
|
|
137
|
-
switch (_a.label) {
|
|
138
|
-
case 0: return [4 /*yield*/, this.getRedeemable(tokenId)];
|
|
139
|
-
case 1:
|
|
140
|
-
nft = _a.sent();
|
|
141
|
-
return [4 /*yield*/, this.contract['redeem(uint256,uint256,bytes)'](nft.index, quantity, signature, {
|
|
142
|
-
value: nft.price.mul(quantity),
|
|
143
|
-
})];
|
|
144
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
Redeemable.prototype.presaleRedeem = function (tokenId, quantity, signature, proof) {
|
|
150
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
151
|
-
var nft;
|
|
152
|
-
return __generator(this, function (_a) {
|
|
153
|
-
switch (_a.label) {
|
|
154
|
-
case 0: return [4 /*yield*/, this.getRedeemable(tokenId)];
|
|
155
|
-
case 1:
|
|
156
|
-
nft = _a.sent();
|
|
157
|
-
return [4 /*yield*/, this.contract['redeem(uint256,uint256,bytes,bytes32[])'](nft.index, quantity, signature, proof, {
|
|
158
|
-
value: nft.price.mul(quantity),
|
|
159
|
-
})];
|
|
160
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
Redeemable.prototype.burn = function (tokenId) {
|
|
166
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
-
return __generator(this, function (_a) {
|
|
168
|
-
switch (_a.label) {
|
|
169
|
-
case 0: return [4 /*yield*/, this.contract.burn(tokenId)];
|
|
170
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
return Redeemable;
|
|
176
|
-
}());
|
|
177
|
-
export default Redeemable;
|
package/dist/esm/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@ethersproject/providers';
|
|
2
|
-
import { TokenCollection, TokenCollectionV2 } from '@niftykit/contracts/typechain';
|
|
3
|
-
import { ContractTransaction, Signer } from 'ethers';
|
|
4
|
-
import { RedeemableData } from './types/redeemable';
|
|
5
|
-
export default class Redeemable {
|
|
6
|
-
contract: TokenCollection | TokenCollectionV2;
|
|
7
|
-
isDev?: boolean;
|
|
8
|
-
version: number;
|
|
9
|
-
private get apiBaseUrl();
|
|
10
|
-
constructor(isDev?: boolean);
|
|
11
|
-
private init;
|
|
12
|
-
static create(signerOrProvider: Signer | Provider, contractAddress: string, isDev?: boolean): Promise<Redeemable | null>;
|
|
13
|
-
getRedeemable(tokenId: number): Promise<RedeemableData>;
|
|
14
|
-
redeem(tokenId: number, quantity: number, signature: string): Promise<ContractTransaction>;
|
|
15
|
-
presaleRedeem(tokenId: number, quantity: number, signature: string, proof: string[]): Promise<ContractTransaction>;
|
|
16
|
-
burn(tokenId: number): Promise<ContractTransaction>;
|
|
17
|
-
}
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers';
|
|
2
|
-
export interface RedeemableData {
|
|
3
|
-
index: number;
|
|
4
|
-
tokenURI: string;
|
|
5
|
-
price: ethers.BigNumber;
|
|
6
|
-
maxAmount: number;
|
|
7
|
-
maxPerWallet: number;
|
|
8
|
-
maxPerMint: number;
|
|
9
|
-
redeemedCount: number;
|
|
10
|
-
merkleRoot: string;
|
|
11
|
-
active: boolean;
|
|
12
|
-
nonce: ethers.BigNumber;
|
|
13
|
-
}
|