@solana-mobile/dapp-store-publishing-tools 0.4.2 → 0.4.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/lib/CoreUtils.js +226 -0
- package/lib/create/AppCore.js +197 -0
- package/lib/create/PublisherCore.js +186 -0
- package/lib/create/ReleaseCore.js +709 -0
- package/lib/{esm/create → create}/index.js +0 -1
- package/lib/generated/appJsonMetadata.d.js +5 -0
- package/lib/{esm/generated → generated}/index.js +0 -1
- package/lib/generated/publisherJsonMetadata.d.js +5 -0
- package/lib/generated/releaseJsonMetadata.d.js +5 -0
- package/lib/{esm/index.js → index.js} +0 -1
- package/lib/publish/PublishCoreAttestation.js +161 -0
- package/lib/publish/PublishCoreRemove.js +224 -0
- package/lib/publish/PublishCoreSubmit.js +236 -0
- package/lib/publish/PublishCoreSupport.js +221 -0
- package/lib/publish/PublishCoreUpdate.js +236 -0
- package/lib/publish/dapp_publisher_portal.js +202 -0
- package/lib/{esm/publish → publish}/index.js +0 -1
- package/lib/publish/types.js +1 -0
- package/lib/schemas/appJsonMetadata.json +58 -0
- package/lib/schemas/publisherJsonMetadata.json +85 -0
- package/lib/schemas/releaseJsonMetadata.json +230 -0
- package/lib/types/index.d.js +0 -0
- package/lib/types.js +1 -0
- package/lib/validate/CoreValidation.js +99 -0
- package/package.json +9 -6
- package/lib/esm/CoreUtils.js +0 -22
- package/lib/esm/CoreUtils.js.map +0 -1
- package/lib/esm/create/AppCore.js +0 -47
- package/lib/esm/create/AppCore.js.map +0 -1
- package/lib/esm/create/PublisherCore.js +0 -43
- package/lib/esm/create/PublisherCore.js.map +0 -1
- package/lib/esm/create/ReleaseCore.js +0 -141
- package/lib/esm/create/ReleaseCore.js.map +0 -1
- package/lib/esm/create/index.js.map +0 -1
- package/lib/esm/generated/index.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/publish/PublishCoreAttestation.js +0 -14
- package/lib/esm/publish/PublishCoreAttestation.js.map +0 -1
- package/lib/esm/publish/PublishCoreRemove.js +0 -62
- package/lib/esm/publish/PublishCoreRemove.js.map +0 -1
- package/lib/esm/publish/PublishCoreSubmit.js +0 -74
- package/lib/esm/publish/PublishCoreSubmit.js.map +0 -1
- package/lib/esm/publish/PublishCoreSupport.js +0 -59
- package/lib/esm/publish/PublishCoreSupport.js.map +0 -1
- package/lib/esm/publish/PublishCoreUpdate.js +0 -74
- package/lib/esm/publish/PublishCoreUpdate.js.map +0 -1
- package/lib/esm/publish/dapp_publisher_portal.js +0 -57
- package/lib/esm/publish/dapp_publisher_portal.js.map +0 -1
- package/lib/esm/publish/index.js.map +0 -1
- package/lib/esm/publish/types.js +0 -2
- package/lib/esm/publish/types.js.map +0 -1
- package/lib/esm/schemas/appJsonMetadata.json +0 -58
- package/lib/esm/schemas/publisherJsonMetadata.json +0 -85
- package/lib/esm/schemas/releaseJsonMetadata.json +0 -230
- package/lib/esm/types.js +0 -2
- package/lib/esm/types.js.map +0 -1
- package/lib/esm/validate/CoreValidation.js +0 -57
- package/lib/esm/validate/CoreValidation.js.map +0 -1
- package/lib/types/CoreUtils.d.ts +0 -11
- package/lib/types/CoreUtils.d.ts.map +0 -1
- package/lib/types/create/AppCore.d.ts +0 -11
- package/lib/types/create/AppCore.d.ts.map +0 -1
- package/lib/types/create/PublisherCore.d.ts +0 -11
- package/lib/types/create/PublisherCore.d.ts.map +0 -1
- package/lib/types/create/ReleaseCore.d.ts +0 -20
- package/lib/types/create/ReleaseCore.d.ts.map +0 -1
- package/lib/types/create/index.d.ts +0 -4
- package/lib/types/create/index.d.ts.map +0 -1
- package/lib/types/generated/index.d.ts +0 -4
- package/lib/types/generated/index.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -5
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/publish/PublishCoreAttestation.d.ts +0 -7
- package/lib/types/publish/PublishCoreAttestation.d.ts.map +0 -1
- package/lib/types/publish/PublishCoreRemove.d.ts +0 -11
- package/lib/types/publish/PublishCoreRemove.d.ts.map +0 -1
- package/lib/types/publish/PublishCoreSubmit.d.ts +0 -12
- package/lib/types/publish/PublishCoreSubmit.d.ts.map +0 -1
- package/lib/types/publish/PublishCoreSupport.d.ts +0 -11
- package/lib/types/publish/PublishCoreSupport.d.ts.map +0 -1
- package/lib/types/publish/PublishCoreUpdate.d.ts +0 -13
- package/lib/types/publish/PublishCoreUpdate.d.ts.map +0 -1
- package/lib/types/publish/dapp_publisher_portal.d.ts +0 -26
- package/lib/types/publish/dapp_publisher_portal.d.ts.map +0 -1
- package/lib/types/publish/index.d.ts +0 -6
- package/lib/types/publish/index.d.ts.map +0 -1
- package/lib/types/publish/types.d.ts +0 -8
- package/lib/types/publish/types.d.ts.map +0 -1
- package/lib/types/types.d.ts +0 -76
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/validate/CoreValidation.d.ts +0 -6
- package/lib/types/validate/CoreValidation.d.ts.map +0 -1
package/lib/CoreUtils.js
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _class_call_check(instance, Constructor) {
|
|
31
|
+
if (!(instance instanceof Constructor)) {
|
|
32
|
+
throw new TypeError("Cannot call a class as a function");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function _define_property(obj, key, value) {
|
|
36
|
+
if (key in obj) {
|
|
37
|
+
Object.defineProperty(obj, key, {
|
|
38
|
+
value: value,
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true
|
|
42
|
+
});
|
|
43
|
+
} else {
|
|
44
|
+
obj[key] = value;
|
|
45
|
+
}
|
|
46
|
+
return obj;
|
|
47
|
+
}
|
|
48
|
+
function _object_spread(target) {
|
|
49
|
+
for(var i = 1; i < arguments.length; i++){
|
|
50
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
51
|
+
var ownKeys = Object.keys(source);
|
|
52
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
53
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
54
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
ownKeys.forEach(function(key) {
|
|
58
|
+
_define_property(target, key, source[key]);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return target;
|
|
62
|
+
}
|
|
63
|
+
function ownKeys(object, enumerableOnly) {
|
|
64
|
+
var keys = Object.keys(object);
|
|
65
|
+
if (Object.getOwnPropertySymbols) {
|
|
66
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
67
|
+
if (enumerableOnly) {
|
|
68
|
+
symbols = symbols.filter(function(sym) {
|
|
69
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
keys.push.apply(keys, symbols);
|
|
73
|
+
}
|
|
74
|
+
return keys;
|
|
75
|
+
}
|
|
76
|
+
function _object_spread_props(target, source) {
|
|
77
|
+
source = source != null ? source : {};
|
|
78
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
79
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
80
|
+
} else {
|
|
81
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
82
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
function _ts_generator(thisArg, body) {
|
|
88
|
+
var f, y, t, g, _ = {
|
|
89
|
+
label: 0,
|
|
90
|
+
sent: function() {
|
|
91
|
+
if (t[0] & 1) throw t[1];
|
|
92
|
+
return t[1];
|
|
93
|
+
},
|
|
94
|
+
trys: [],
|
|
95
|
+
ops: []
|
|
96
|
+
};
|
|
97
|
+
return(g = {
|
|
98
|
+
next: verb(0),
|
|
99
|
+
"throw": verb(1),
|
|
100
|
+
"return": verb(2)
|
|
101
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
102
|
+
return this;
|
|
103
|
+
}), g);
|
|
104
|
+
function verb(n) {
|
|
105
|
+
return function(v) {
|
|
106
|
+
return step([
|
|
107
|
+
n,
|
|
108
|
+
v
|
|
109
|
+
]);
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function step(op) {
|
|
113
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
+
while(_)try {
|
|
115
|
+
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;
|
|
116
|
+
if (y = 0, t) op = [
|
|
117
|
+
op[0] & 2,
|
|
118
|
+
t.value
|
|
119
|
+
];
|
|
120
|
+
switch(op[0]){
|
|
121
|
+
case 0:
|
|
122
|
+
case 1:
|
|
123
|
+
t = op;
|
|
124
|
+
break;
|
|
125
|
+
case 4:
|
|
126
|
+
_.label++;
|
|
127
|
+
return {
|
|
128
|
+
value: op[1],
|
|
129
|
+
done: false
|
|
130
|
+
};
|
|
131
|
+
case 5:
|
|
132
|
+
_.label++;
|
|
133
|
+
y = op[1];
|
|
134
|
+
op = [
|
|
135
|
+
0
|
|
136
|
+
];
|
|
137
|
+
continue;
|
|
138
|
+
case 7:
|
|
139
|
+
op = _.ops.pop();
|
|
140
|
+
_.trys.pop();
|
|
141
|
+
continue;
|
|
142
|
+
default:
|
|
143
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
144
|
+
_ = 0;
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
148
|
+
_.label = op[1];
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
152
|
+
_.label = t[1];
|
|
153
|
+
t = op;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
if (t && _.label < t[2]) {
|
|
157
|
+
_.label = t[2];
|
|
158
|
+
_.ops.push(op);
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
if (t[2]) _.ops.pop();
|
|
162
|
+
_.trys.pop();
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
op = body.call(thisArg, _);
|
|
166
|
+
} catch (e) {
|
|
167
|
+
op = [
|
|
168
|
+
6,
|
|
169
|
+
e
|
|
170
|
+
];
|
|
171
|
+
y = 0;
|
|
172
|
+
} finally{
|
|
173
|
+
f = t = 0;
|
|
174
|
+
}
|
|
175
|
+
if (op[0] & 5) throw op[1];
|
|
176
|
+
return {
|
|
177
|
+
value: op[0] ? op[1] : void 0,
|
|
178
|
+
done: true
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
export var Constants = function Constants() {
|
|
183
|
+
"use strict";
|
|
184
|
+
_class_call_check(this, Constants);
|
|
185
|
+
};
|
|
186
|
+
_define_property(Constants, "PUBLISHING_SCHEMA_VER", "0.2.5");
|
|
187
|
+
export var truncateAddress = function(address) {
|
|
188
|
+
return "".concat(address.slice(0, 4), "...").concat(address.slice(address.length - 4, address.length));
|
|
189
|
+
};
|
|
190
|
+
export var mintNft = function() {
|
|
191
|
+
var _ref = _async_to_generator(function(metaplex, json, createNftInput) {
|
|
192
|
+
var uri, txBuilder;
|
|
193
|
+
return _ts_generator(this, function(_state) {
|
|
194
|
+
switch(_state.label){
|
|
195
|
+
case 0:
|
|
196
|
+
console.info({
|
|
197
|
+
json: json
|
|
198
|
+
});
|
|
199
|
+
return [
|
|
200
|
+
4,
|
|
201
|
+
metaplex.nfts().uploadMetadata(json)
|
|
202
|
+
];
|
|
203
|
+
case 1:
|
|
204
|
+
uri = _state.sent().uri;
|
|
205
|
+
return [
|
|
206
|
+
4,
|
|
207
|
+
metaplex.nfts().builders().create(_object_spread_props(_object_spread({}, createNftInput), {
|
|
208
|
+
uri: uri,
|
|
209
|
+
// @ts-ignore
|
|
210
|
+
name: json.name,
|
|
211
|
+
sellerFeeBasisPoints: 0
|
|
212
|
+
}))
|
|
213
|
+
];
|
|
214
|
+
case 2:
|
|
215
|
+
txBuilder = _state.sent();
|
|
216
|
+
return [
|
|
217
|
+
2,
|
|
218
|
+
txBuilder
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
return function mintNft(metaplex, json, createNftInput) {
|
|
224
|
+
return _ref.apply(this, arguments);
|
|
225
|
+
};
|
|
226
|
+
}();
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _ts_generator(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return(g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g);
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
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;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
import { Constants, mintNft } from "../CoreUtils.js";
|
|
126
|
+
import debugModule from "debug";
|
|
127
|
+
import { validateApp } from "../validate/CoreValidation.js";
|
|
128
|
+
var debug = debugModule("APP");
|
|
129
|
+
export var createAppJson = function(app, publisherAddress) {
|
|
130
|
+
var appMetadata = {
|
|
131
|
+
schema_version: Constants.PUBLISHING_SCHEMA_VER,
|
|
132
|
+
name: app.name,
|
|
133
|
+
image: app.icon,
|
|
134
|
+
external_url: app.urls.website,
|
|
135
|
+
properties: {
|
|
136
|
+
category: "dApp",
|
|
137
|
+
creators: [
|
|
138
|
+
{
|
|
139
|
+
address: publisherAddress.toBase58(),
|
|
140
|
+
share: 100
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
extensions: {
|
|
145
|
+
solana_dapp_store: {
|
|
146
|
+
android_package: app.android_package
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
return appMetadata;
|
|
151
|
+
};
|
|
152
|
+
export var createApp = function() {
|
|
153
|
+
var _ref = _async_to_generator(function(param, param1) {
|
|
154
|
+
var publisherMintAddress, mintAddress, appDetails, metaplex, publisher, appJson, txBuilder;
|
|
155
|
+
return _ts_generator(this, function(_state) {
|
|
156
|
+
switch(_state.label){
|
|
157
|
+
case 0:
|
|
158
|
+
publisherMintAddress = param.publisherMintAddress, mintAddress = param.mintAddress, appDetails = param.appDetails, metaplex = param1.metaplex, publisher = param1.publisher;
|
|
159
|
+
debug("Minting app NFT for publisher: ".concat(publisherMintAddress.toBase58()));
|
|
160
|
+
appJson = createAppJson(appDetails, publisher.publicKey);
|
|
161
|
+
validateApp(appJson);
|
|
162
|
+
return [
|
|
163
|
+
4,
|
|
164
|
+
mintNft(metaplex, appJson, {
|
|
165
|
+
useNewMint: mintAddress,
|
|
166
|
+
collection: publisherMintAddress,
|
|
167
|
+
collectionAuthority: publisher,
|
|
168
|
+
isCollection: true,
|
|
169
|
+
isMutable: true,
|
|
170
|
+
creators: [
|
|
171
|
+
{
|
|
172
|
+
address: publisher.publicKey,
|
|
173
|
+
share: 100
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
];
|
|
178
|
+
case 1:
|
|
179
|
+
txBuilder = _state.sent();
|
|
180
|
+
txBuilder.append(metaplex.nfts().builders().verifyCreator({
|
|
181
|
+
mintAddress: mintAddress.publicKey,
|
|
182
|
+
creator: publisher
|
|
183
|
+
}));
|
|
184
|
+
debug({
|
|
185
|
+
appNft: mintAddress.publicKey.toBase58()
|
|
186
|
+
});
|
|
187
|
+
return [
|
|
188
|
+
2,
|
|
189
|
+
txBuilder
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
return function createApp(_, _1) {
|
|
195
|
+
return _ref.apply(this, arguments);
|
|
196
|
+
};
|
|
197
|
+
}();
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _async_to_generator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function _ts_generator(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return(g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g);
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
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;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
import debugModule from "debug";
|
|
126
|
+
import { validatePublisher } from "../validate/CoreValidation.js";
|
|
127
|
+
import { Constants, mintNft } from "../CoreUtils.js";
|
|
128
|
+
var debug = debugModule("PUBLISHER");
|
|
129
|
+
export var createPublisherJson = function(publisher) {
|
|
130
|
+
var publisherMetadata = {
|
|
131
|
+
schema_version: Constants.PUBLISHING_SCHEMA_VER,
|
|
132
|
+
name: publisher.name,
|
|
133
|
+
image: publisher.icon,
|
|
134
|
+
external_url: publisher.website,
|
|
135
|
+
properties: {
|
|
136
|
+
category: "dApp",
|
|
137
|
+
creators: [
|
|
138
|
+
{
|
|
139
|
+
address: publisher.address,
|
|
140
|
+
share: 100
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
extensions: {
|
|
145
|
+
solana_dapp_store: {
|
|
146
|
+
publisher_details: {
|
|
147
|
+
name: publisher.name,
|
|
148
|
+
website: publisher.website,
|
|
149
|
+
contact: publisher.email
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
return publisherMetadata;
|
|
155
|
+
};
|
|
156
|
+
export var createPublisher = function() {
|
|
157
|
+
var _ref = _async_to_generator(function(param, param1) {
|
|
158
|
+
var mintAddress, publisherDetails, metaplex, publisherJson, txBuilder;
|
|
159
|
+
return _ts_generator(this, function(_state) {
|
|
160
|
+
switch(_state.label){
|
|
161
|
+
case 0:
|
|
162
|
+
mintAddress = param.mintAddress, publisherDetails = param.publisherDetails, metaplex = param1.metaplex;
|
|
163
|
+
debug("Minting publisher NFT");
|
|
164
|
+
publisherJson = createPublisherJson(publisherDetails);
|
|
165
|
+
validatePublisher(publisherJson);
|
|
166
|
+
return [
|
|
167
|
+
4,
|
|
168
|
+
mintNft(metaplex, publisherJson, {
|
|
169
|
+
isCollection: true,
|
|
170
|
+
isMutable: true,
|
|
171
|
+
useNewMint: mintAddress
|
|
172
|
+
})
|
|
173
|
+
];
|
|
174
|
+
case 1:
|
|
175
|
+
txBuilder = _state.sent();
|
|
176
|
+
return [
|
|
177
|
+
2,
|
|
178
|
+
txBuilder
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
return function createPublisher(_, _1) {
|
|
184
|
+
return _ref.apply(this, arguments);
|
|
185
|
+
};
|
|
186
|
+
}();
|