@solana-mobile/dapp-store-publishing-tools 0.16.0 → 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/lib/CoreUtils.js +0 -3
- package/lib/index.js +1 -0
- package/lib/portal/attestation.js +189 -0
- package/lib/portal/compat.js +3 -0
- package/lib/portal/index.js +5 -0
- package/lib/portal/signer.js +432 -0
- package/lib/portal/types.js +1 -0
- package/lib/portal/workflow/contracts.js +1 -0
- package/lib/portal/workflow/execution.js +493 -0
- package/lib/portal/workflow/ingestion.js +265 -0
- package/lib/portal/workflow/lifecycle.js +616 -0
- package/lib/portal/workflow/logging.js +8 -0
- package/lib/portal/workflow/source/files.js +304 -0
- package/lib/portal/workflow/source/preparation.js +318 -0
- package/lib/portal/workflow/state/bundle.js +260 -0
- package/lib/portal/workflow/state/checkpoints.js +53 -0
- package/lib/portal/workflow/state/session.js +100 -0
- package/lib/portal/workflow.js +1 -0
- package/lib/publish/PublishCoreAttestation.js +18 -17
- package/lib/publish/PublishCoreRemove.js +7 -89
- package/lib/publish/PublishCoreSubmit.js +7 -117
- package/lib/publish/PublishCoreSupport.js +7 -86
- package/lib/publish/PublishCoreUpdate.js +7 -117
- package/lib/publish/index.js +1 -0
- package/lib/schemas/releaseJsonMetadata.json +1 -2
- package/package.json +2 -4
- package/src/CoreUtils.ts +0 -6
- package/src/index.ts +1 -0
- package/src/portal/attestation.ts +76 -0
- package/src/portal/compat.ts +5 -0
- package/src/portal/index.ts +5 -0
- package/src/portal/signer.ts +327 -0
- package/src/portal/types.ts +447 -0
- package/src/portal/workflow/contracts.ts +108 -0
- package/src/portal/workflow/execution.ts +412 -0
- package/src/portal/workflow/ingestion.ts +187 -0
- package/src/portal/workflow/lifecycle.ts +435 -0
- package/src/portal/workflow/logging.ts +17 -0
- package/src/portal/workflow/source/files.ts +49 -0
- package/src/portal/workflow/source/preparation.ts +189 -0
- package/src/portal/workflow/state/bundle.ts +193 -0
- package/src/portal/workflow/state/checkpoints.ts +70 -0
- package/src/portal/workflow/state/session.ts +87 -0
- package/src/portal/workflow.ts +9 -0
- package/src/publish/PublishCoreAttestation.ts +21 -26
- package/src/publish/PublishCoreRemove.ts +13 -109
- package/src/publish/PublishCoreSubmit.ts +18 -150
- package/src/publish/PublishCoreSupport.ts +13 -102
- package/src/publish/PublishCoreUpdate.ts +17 -155
- package/src/publish/index.ts +2 -1
- package/src/schemas/releaseJsonMetadata.json +1 -2
- package/lib/publish/dapp_publisher_portal.js +0 -206
- package/src/publish/dapp_publisher_portal.ts +0 -81
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _define_property(obj, key, value) {
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
Object.defineProperty(obj, key, {
|
|
12
|
+
value: value,
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
obj[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
22
|
+
function _iterable_to_array_limit(arr, i) {
|
|
23
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
|
+
if (_i == null) return;
|
|
25
|
+
var _arr = [];
|
|
26
|
+
var _n = true;
|
|
27
|
+
var _d = false;
|
|
28
|
+
var _s, _e;
|
|
29
|
+
try {
|
|
30
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
31
|
+
_arr.push(_s.value);
|
|
32
|
+
if (i && _arr.length === i) break;
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
_d = true;
|
|
36
|
+
_e = err;
|
|
37
|
+
} finally{
|
|
38
|
+
try {
|
|
39
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
40
|
+
} finally{
|
|
41
|
+
if (_d) throw _e;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return _arr;
|
|
45
|
+
}
|
|
46
|
+
function _non_iterable_rest() {
|
|
47
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
|
+
}
|
|
49
|
+
function _object_spread(target) {
|
|
50
|
+
for(var i = 1; i < arguments.length; i++){
|
|
51
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
52
|
+
var ownKeys = Object.keys(source);
|
|
53
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
54
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
55
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
ownKeys.forEach(function(key) {
|
|
59
|
+
_define_property(target, key, source[key]);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return target;
|
|
63
|
+
}
|
|
64
|
+
function ownKeys(object, enumerableOnly) {
|
|
65
|
+
var keys = Object.keys(object);
|
|
66
|
+
if (Object.getOwnPropertySymbols) {
|
|
67
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
68
|
+
if (enumerableOnly) {
|
|
69
|
+
symbols = symbols.filter(function(sym) {
|
|
70
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
keys.push.apply(keys, symbols);
|
|
74
|
+
}
|
|
75
|
+
return keys;
|
|
76
|
+
}
|
|
77
|
+
function _object_spread_props(target, source) {
|
|
78
|
+
source = source != null ? source : {};
|
|
79
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
80
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
81
|
+
} else {
|
|
82
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
83
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return target;
|
|
87
|
+
}
|
|
88
|
+
function _sliced_to_array(arr, i) {
|
|
89
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
90
|
+
}
|
|
91
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
92
|
+
if (!o) return;
|
|
93
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
94
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
95
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
96
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
97
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
|
+
}
|
|
99
|
+
import { inferFileNameFromUrl } from "../source/files.js";
|
|
100
|
+
function normalizePublicationMetadata(bundle) {
|
|
101
|
+
if (bundle.metadata) {
|
|
102
|
+
return bundle.metadata;
|
|
103
|
+
}
|
|
104
|
+
var _bundle_release_localizedName, _ref, _bundle_dapp_subtitle, _bundle_dapp_description, _bundle_publisher_supportEmail, _ref1, _bundle_dapp_website, _ref2, _bundle_dapp_languages, _bundle_dapp_licenseUrl, _bundle_dapp_copyrightUrl, _bundle_dapp_privacyPolicyUrl, _bundle_installFile_sha256, _bundle_installFile_fileName, _bundle_installFile_canonicalUrl, _bundle_release_releaseMetadataUri, _ref3;
|
|
105
|
+
return {
|
|
106
|
+
localizedName: (_ref = (_bundle_release_localizedName = bundle.release.localizedName) !== null && _bundle_release_localizedName !== void 0 ? _bundle_release_localizedName : bundle.release.releaseName) !== null && _ref !== void 0 ? _ref : bundle.dapp.dappName,
|
|
107
|
+
shortDescription: (_bundle_dapp_subtitle = bundle.dapp.subtitle) !== null && _bundle_dapp_subtitle !== void 0 ? _bundle_dapp_subtitle : "",
|
|
108
|
+
longDescription: (_bundle_dapp_description = bundle.dapp.description) !== null && _bundle_dapp_description !== void 0 ? _bundle_dapp_description : "",
|
|
109
|
+
newInVersion: bundle.release.newInVersion,
|
|
110
|
+
publisherWebsite: bundle.publisher.website,
|
|
111
|
+
supportEmail: (_ref1 = (_bundle_publisher_supportEmail = bundle.publisher.supportEmail) !== null && _bundle_publisher_supportEmail !== void 0 ? _bundle_publisher_supportEmail : bundle.dapp.supportEmail) !== null && _ref1 !== void 0 ? _ref1 : null,
|
|
112
|
+
website: (_ref2 = (_bundle_dapp_website = bundle.dapp.website) !== null && _bundle_dapp_website !== void 0 ? _bundle_dapp_website : bundle.dapp.appWebsite) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
113
|
+
locales: (_bundle_dapp_languages = bundle.dapp.languages) !== null && _bundle_dapp_languages !== void 0 ? _bundle_dapp_languages : [],
|
|
114
|
+
legal: {
|
|
115
|
+
licenseUrl: (_bundle_dapp_licenseUrl = bundle.dapp.licenseUrl) !== null && _bundle_dapp_licenseUrl !== void 0 ? _bundle_dapp_licenseUrl : null,
|
|
116
|
+
copyrightUrl: (_bundle_dapp_copyrightUrl = bundle.dapp.copyrightUrl) !== null && _bundle_dapp_copyrightUrl !== void 0 ? _bundle_dapp_copyrightUrl : null,
|
|
117
|
+
privacyPolicyUrl: (_bundle_dapp_privacyPolicyUrl = bundle.dapp.privacyPolicyUrl) !== null && _bundle_dapp_privacyPolicyUrl !== void 0 ? _bundle_dapp_privacyPolicyUrl : null
|
|
118
|
+
},
|
|
119
|
+
media: [],
|
|
120
|
+
installFile: {
|
|
121
|
+
uri: bundle.installFile.uri,
|
|
122
|
+
mimeType: bundle.installFile.mimeType,
|
|
123
|
+
size: bundle.installFile.size,
|
|
124
|
+
sha256: (_bundle_installFile_sha256 = bundle.installFile.sha256) !== null && _bundle_installFile_sha256 !== void 0 ? _bundle_installFile_sha256 : null,
|
|
125
|
+
fileName: (_bundle_installFile_fileName = bundle.installFile.fileName) !== null && _bundle_installFile_fileName !== void 0 ? _bundle_installFile_fileName : inferFileNameFromUrl(bundle.installFile.uri),
|
|
126
|
+
canonicalUrl: (_bundle_installFile_canonicalUrl = bundle.installFile.canonicalUrl) !== null && _bundle_installFile_canonicalUrl !== void 0 ? _bundle_installFile_canonicalUrl : bundle.installFile.uri,
|
|
127
|
+
url: bundle.installFile.uri,
|
|
128
|
+
origin: "portal"
|
|
129
|
+
},
|
|
130
|
+
localizedStrings: [],
|
|
131
|
+
releaseMetadataUri: (_ref3 = (_bundle_release_releaseMetadataUri = bundle.release.releaseMetadataUri) !== null && _bundle_release_releaseMetadataUri !== void 0 ? _bundle_release_releaseMetadataUri : bundle.release.nftMetadataUri) !== null && _ref3 !== void 0 ? _ref3 : null
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function getReleaseMetadataUri(bundle, session) {
|
|
135
|
+
var _bundle_metadata;
|
|
136
|
+
var _session_metadataUri, _ref, _ref1, _ref2;
|
|
137
|
+
return (_ref2 = (_ref1 = (_ref = (_session_metadataUri = session === null || session === void 0 ? void 0 : session.metadataUri) !== null && _session_metadataUri !== void 0 ? _session_metadataUri : bundle.release.releaseMetadataUri) !== null && _ref !== void 0 ? _ref : bundle.release.nftMetadataUri) !== null && _ref1 !== void 0 ? _ref1 : (_bundle_metadata = bundle.metadata) === null || _bundle_metadata === void 0 ? void 0 : _bundle_metadata.releaseMetadataUri) !== null && _ref2 !== void 0 ? _ref2 : null;
|
|
138
|
+
}
|
|
139
|
+
export function normalizePublicationBundle(bundle) {
|
|
140
|
+
return _object_spread_props(_object_spread({}, bundle), {
|
|
141
|
+
releaseId: bundle.releaseId || bundle.release.id || "",
|
|
142
|
+
metadata: normalizePublicationMetadata(bundle)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
export function withPublicationBundleIdentifiers(bundle, identifiers) {
|
|
146
|
+
return _object_spread_props(_object_spread({}, bundle), {
|
|
147
|
+
releaseId: bundle.releaseId || bundle.release.id || identifiers.releaseId || "",
|
|
148
|
+
publicationSessionId: bundle.publicationSessionId || identifiers.publicationSessionId || "",
|
|
149
|
+
ingestionSessionId: bundle.ingestionSessionId || identifiers.ingestionSessionId || ""
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
export function resolveReleaseMetadataUri(bundle, session) {
|
|
153
|
+
var releaseMetadataUri = getReleaseMetadataUri(bundle, session);
|
|
154
|
+
if (!releaseMetadataUri) {
|
|
155
|
+
throw new Error("Publication bundle did not include a release metadata URI");
|
|
156
|
+
}
|
|
157
|
+
return releaseMetadataUri;
|
|
158
|
+
}
|
|
159
|
+
export function hasResolvableReleaseMetadataUri(bundle, session) {
|
|
160
|
+
return Boolean(getReleaseMetadataUri(bundle, session));
|
|
161
|
+
}
|
|
162
|
+
export function resolvePublicationSignerAddress(bundle) {
|
|
163
|
+
var _bundle_signerAuthority_dappWalletAddress, _ref;
|
|
164
|
+
return (_ref = (_bundle_signerAuthority_dappWalletAddress = bundle.signerAuthority.dappWalletAddress) !== null && _bundle_signerAuthority_dappWalletAddress !== void 0 ? _bundle_signerAuthority_dappWalletAddress : bundle.signerAuthority.requiredSigner) !== null && _ref !== void 0 ? _ref : bundle.signerAuthority.collectionAuthority;
|
|
165
|
+
}
|
|
166
|
+
export function resolveReleaseDisplayName(bundle) {
|
|
167
|
+
var _bundle_release_localizedName, _ref;
|
|
168
|
+
return (_ref = (_bundle_release_localizedName = bundle.release.localizedName) !== null && _bundle_release_localizedName !== void 0 ? _bundle_release_localizedName : bundle.release.releaseName) !== null && _ref !== void 0 ? _ref : bundle.dapp.dappName;
|
|
169
|
+
}
|
|
170
|
+
export function resolvePublicationFeePayer(bundle, signer) {
|
|
171
|
+
var _bundle_signerAuthority_feePayer;
|
|
172
|
+
return (_bundle_signerAuthority_feePayer = bundle.signerAuthority.feePayer) !== null && _bundle_signerAuthority_feePayer !== void 0 ? _bundle_signerAuthority_feePayer : signer.publicKey;
|
|
173
|
+
}
|
|
174
|
+
export function validatePublicationBundle(bundle) {
|
|
175
|
+
var _normalizedBundle_metadata, _normalizedBundle_metadata1, _normalizedBundle_metadata2, _normalizedBundle_metadata3;
|
|
176
|
+
var normalizedBundle = normalizePublicationBundle(bundle);
|
|
177
|
+
var _normalizedBundle_release_localizedName;
|
|
178
|
+
var requiredFields = [
|
|
179
|
+
[
|
|
180
|
+
"releaseId",
|
|
181
|
+
normalizedBundle.releaseId
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
"publicationSessionId",
|
|
185
|
+
normalizedBundle.publicationSessionId
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
"ingestionSessionId",
|
|
189
|
+
normalizedBundle.ingestionSessionId
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
"androidPackage",
|
|
193
|
+
normalizedBundle.release.androidPackage
|
|
194
|
+
],
|
|
195
|
+
[
|
|
196
|
+
"release.localizedName",
|
|
197
|
+
(_normalizedBundle_release_localizedName = normalizedBundle.release.localizedName) !== null && _normalizedBundle_release_localizedName !== void 0 ? _normalizedBundle_release_localizedName : normalizedBundle.release.releaseName
|
|
198
|
+
],
|
|
199
|
+
[
|
|
200
|
+
"versionName",
|
|
201
|
+
normalizedBundle.release.versionName
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"appMintAddress",
|
|
205
|
+
normalizedBundle.signerAuthority.appMintAddress
|
|
206
|
+
],
|
|
207
|
+
[
|
|
208
|
+
"dappWalletAddress",
|
|
209
|
+
normalizedBundle.signerAuthority.dappWalletAddress
|
|
210
|
+
],
|
|
211
|
+
[
|
|
212
|
+
"collectionAuthority",
|
|
213
|
+
normalizedBundle.signerAuthority.collectionAuthority
|
|
214
|
+
],
|
|
215
|
+
[
|
|
216
|
+
"acceptedSignerRoles",
|
|
217
|
+
normalizedBundle.signerAuthority.acceptedSignerRoles
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
"metadata.localizedName",
|
|
221
|
+
(_normalizedBundle_metadata = normalizedBundle.metadata) === null || _normalizedBundle_metadata === void 0 ? void 0 : _normalizedBundle_metadata.localizedName
|
|
222
|
+
],
|
|
223
|
+
[
|
|
224
|
+
"shortDescription",
|
|
225
|
+
(_normalizedBundle_metadata1 = normalizedBundle.metadata) === null || _normalizedBundle_metadata1 === void 0 ? void 0 : _normalizedBundle_metadata1.shortDescription
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
"longDescription",
|
|
229
|
+
(_normalizedBundle_metadata2 = normalizedBundle.metadata) === null || _normalizedBundle_metadata2 === void 0 ? void 0 : _normalizedBundle_metadata2.longDescription
|
|
230
|
+
],
|
|
231
|
+
[
|
|
232
|
+
"newInVersion",
|
|
233
|
+
(_normalizedBundle_metadata3 = normalizedBundle.metadata) === null || _normalizedBundle_metadata3 === void 0 ? void 0 : _normalizedBundle_metadata3.newInVersion
|
|
234
|
+
],
|
|
235
|
+
[
|
|
236
|
+
"installFile.uri",
|
|
237
|
+
normalizedBundle.installFile.uri
|
|
238
|
+
],
|
|
239
|
+
[
|
|
240
|
+
"installFile.mimeType",
|
|
241
|
+
normalizedBundle.installFile.mimeType
|
|
242
|
+
]
|
|
243
|
+
];
|
|
244
|
+
var missing = requiredFields.filter(function(param) {
|
|
245
|
+
var _param = _sliced_to_array(param, 2), value = _param[1];
|
|
246
|
+
if (typeof value === "string") {
|
|
247
|
+
return value.trim().length === 0;
|
|
248
|
+
}
|
|
249
|
+
if (Array.isArray(value)) {
|
|
250
|
+
return value.length === 0;
|
|
251
|
+
}
|
|
252
|
+
return value === undefined || value === null;
|
|
253
|
+
});
|
|
254
|
+
if (missing.length > 0) {
|
|
255
|
+
throw new Error("Publication bundle is missing required fields: ".concat(missing.map(function(param) {
|
|
256
|
+
var _param = _sliced_to_array(param, 1), field = _param[0];
|
|
257
|
+
return field;
|
|
258
|
+
}).join(", ")));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var publicationCheckpointOrder = [
|
|
2
|
+
"created",
|
|
3
|
+
"bundle-ready",
|
|
4
|
+
"mint-submitted",
|
|
5
|
+
"mint-saved",
|
|
6
|
+
"verification-submitted",
|
|
7
|
+
"verified",
|
|
8
|
+
"attested",
|
|
9
|
+
"submitted",
|
|
10
|
+
"completed"
|
|
11
|
+
];
|
|
12
|
+
export function checkpointAtLeast(checkpoint, expected) {
|
|
13
|
+
return publicationCheckpointOrder.indexOf(checkpoint) >= publicationCheckpointOrder.indexOf(expected);
|
|
14
|
+
}
|
|
15
|
+
export function publicationStageToCheckpoint(stage) {
|
|
16
|
+
if (!stage) {
|
|
17
|
+
return "created";
|
|
18
|
+
}
|
|
19
|
+
switch(stage){
|
|
20
|
+
case "PreparedForMint":
|
|
21
|
+
return "bundle-ready";
|
|
22
|
+
case "MintSubmitted":
|
|
23
|
+
return "mint-submitted";
|
|
24
|
+
case "MintSaved":
|
|
25
|
+
return "mint-saved";
|
|
26
|
+
case "VerificationSubmitted":
|
|
27
|
+
return "verification-submitted";
|
|
28
|
+
case "Verified":
|
|
29
|
+
return "verified";
|
|
30
|
+
case "Attested":
|
|
31
|
+
return "attested";
|
|
32
|
+
case "Submitted":
|
|
33
|
+
return "submitted";
|
|
34
|
+
case "Failed":
|
|
35
|
+
default:
|
|
36
|
+
return "created";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function publicationStageToStatus(stage) {
|
|
40
|
+
if (!stage) {
|
|
41
|
+
return "pending";
|
|
42
|
+
}
|
|
43
|
+
switch(stage){
|
|
44
|
+
case "Submitted":
|
|
45
|
+
return "completed";
|
|
46
|
+
case "Failed":
|
|
47
|
+
return "failed";
|
|
48
|
+
case "PreparedForMint":
|
|
49
|
+
return "pending";
|
|
50
|
+
default:
|
|
51
|
+
return "running";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_define_property(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _object_spread_props(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import { publicationStageToCheckpoint, publicationStageToStatus } from "./checkpoints.js";
|
|
54
|
+
export function normalizePublicationSession(session) {
|
|
55
|
+
var stage = resolvePublicationSessionStage(session);
|
|
56
|
+
var _session_checkpoint;
|
|
57
|
+
var checkpoint = (_session_checkpoint = session.checkpoint) !== null && _session_checkpoint !== void 0 ? _session_checkpoint : publicationStageToCheckpoint(stage);
|
|
58
|
+
var _session_status, _session_releaseMintAddress, _ref, _session_verifyTransactionSignature, _ref1;
|
|
59
|
+
return _object_spread_props(_object_spread({}, session), {
|
|
60
|
+
stage: stage,
|
|
61
|
+
checkpoint: checkpoint,
|
|
62
|
+
status: (_session_status = session.status) !== null && _session_status !== void 0 ? _session_status : publicationStageToStatus(stage),
|
|
63
|
+
releaseMintAddress: (_ref = (_session_releaseMintAddress = session.releaseMintAddress) !== null && _session_releaseMintAddress !== void 0 ? _session_releaseMintAddress : session.expectedMintAddress) !== null && _ref !== void 0 ? _ref : null,
|
|
64
|
+
verifyTransactionSignature: (_ref1 = (_session_verifyTransactionSignature = session.verifyTransactionSignature) !== null && _session_verifyTransactionSignature !== void 0 ? _session_verifyTransactionSignature : session.verificationTransactionSignature) !== null && _ref1 !== void 0 ? _ref1 : null
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
export function resolvePublicationSessionStage(session) {
|
|
68
|
+
if (session.stage) {
|
|
69
|
+
return session.stage;
|
|
70
|
+
}
|
|
71
|
+
if (session.status === "failed") {
|
|
72
|
+
return "Failed";
|
|
73
|
+
}
|
|
74
|
+
if (session.status === "completed") {
|
|
75
|
+
return "Submitted";
|
|
76
|
+
}
|
|
77
|
+
if (session.checkpoint === "submitted" || session.checkpoint === "completed") {
|
|
78
|
+
return "Submitted";
|
|
79
|
+
}
|
|
80
|
+
if (session.checkpoint === "verified") {
|
|
81
|
+
return "Verified";
|
|
82
|
+
}
|
|
83
|
+
if (session.checkpoint === "attested") {
|
|
84
|
+
return "Attested";
|
|
85
|
+
}
|
|
86
|
+
if (session.checkpoint === "verification-submitted") {
|
|
87
|
+
return "VerificationSubmitted";
|
|
88
|
+
}
|
|
89
|
+
if (session.checkpoint === "mint-saved") {
|
|
90
|
+
return "MintSaved";
|
|
91
|
+
}
|
|
92
|
+
if (session.checkpoint === "mint-submitted") {
|
|
93
|
+
return "MintSubmitted";
|
|
94
|
+
}
|
|
95
|
+
return "PreparedForMint";
|
|
96
|
+
}
|
|
97
|
+
export function resolveReleaseMintAddress(bundle, publicationSession) {
|
|
98
|
+
var _publicationSession_releaseMintAddress, _ref, _ref1, _ref2;
|
|
99
|
+
return (_ref2 = (_ref1 = (_ref = (_publicationSession_releaseMintAddress = publicationSession.releaseMintAddress) !== null && _publicationSession_releaseMintAddress !== void 0 ? _publicationSession_releaseMintAddress : publicationSession.expectedMintAddress) !== null && _ref !== void 0 ? _ref : bundle.release.nftMintAddress) !== null && _ref1 !== void 0 ? _ref1 : bundle.release.releaseMintAddress) !== null && _ref2 !== void 0 ? _ref2 : undefined;
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createPublicationWorkflow } from "./workflow/lifecycle.js";
|
|
@@ -118,35 +118,36 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
+
import { createAttestationPayload as createPortalAttestationPayload } from '../portal/attestation.js';
|
|
121
122
|
export var createAttestationPayload = function(connection, sign) {
|
|
122
123
|
return _async_to_generator(function() {
|
|
123
|
-
var
|
|
124
|
+
var blockhash;
|
|
124
125
|
return _ts_generator(this, function(_state) {
|
|
125
126
|
switch(_state.label){
|
|
126
127
|
case 0:
|
|
127
|
-
REQUEST_UNIQUE_ID_LEN = 32;
|
|
128
|
-
REQUEST_UNIQUE_ID_CHAR_SET = "0123456789";
|
|
129
|
-
requestUniqueId = Array(REQUEST_UNIQUE_ID_LEN).fill(undefined).map(function(_) {
|
|
130
|
-
return REQUEST_UNIQUE_ID_CHAR_SET.charAt(Math.floor(Math.random() * REQUEST_UNIQUE_ID_CHAR_SET.length));
|
|
131
|
-
}).join("");
|
|
132
128
|
return [
|
|
133
129
|
4,
|
|
134
|
-
connection.getLatestBlockhashAndContext(
|
|
130
|
+
connection.getLatestBlockhashAndContext('finalized')
|
|
135
131
|
];
|
|
136
132
|
case 1:
|
|
137
133
|
blockhash = _state.sent();
|
|
138
|
-
attestation = {
|
|
139
|
-
slot_number: blockhash.context.slot,
|
|
140
|
-
blockhash: blockhash.value.blockhash,
|
|
141
|
-
request_unique_id: requestUniqueId
|
|
142
|
-
};
|
|
143
|
-
signedAttestation = sign(Buffer.from(JSON.stringify(attestation)));
|
|
144
134
|
return [
|
|
145
135
|
2,
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
136
|
+
createPortalAttestationPayload({
|
|
137
|
+
slot: blockhash.context.slot,
|
|
138
|
+
blockhash: blockhash.value.blockhash
|
|
139
|
+
}, {
|
|
140
|
+
signMessage: function(message) {
|
|
141
|
+
return _async_to_generator(function() {
|
|
142
|
+
return _ts_generator(this, function(_state) {
|
|
143
|
+
return [
|
|
144
|
+
2,
|
|
145
|
+
sign(Buffer.from(message))
|
|
146
|
+
];
|
|
147
|
+
});
|
|
148
|
+
})();
|
|
149
|
+
}
|
|
150
|
+
})
|
|
150
151
|
];
|
|
151
152
|
}
|
|
152
153
|
});
|
|
@@ -118,97 +118,15 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
var createRemoveRequest = function(connection, sign, appMintAddress, releaseMintAddress, publisherDetails, requestorIsAuthorized, criticalUpdate) {
|
|
121
|
+
import { deprecateLegacyPublishSurface } from '../portal/compat.js';
|
|
122
|
+
export var publishRemove = function(_publishSolanaNetworkInput, _input, _dryRun) {
|
|
124
123
|
return _async_to_generator(function() {
|
|
125
|
-
var _ref, attestationPayload, requestUniqueId, request;
|
|
126
124
|
return _ts_generator(this, function(_state) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
];
|
|
133
|
-
case 1:
|
|
134
|
-
_ref = _state.sent(), attestationPayload = _ref.attestationPayload, requestUniqueId = _ref.requestUniqueId;
|
|
135
|
-
request = {
|
|
136
|
-
fields: [
|
|
137
|
-
{
|
|
138
|
-
objectTypeId: CONTACT_OBJECT_ID,
|
|
139
|
-
name: CONTACT_PROPERTY_COMPANY,
|
|
140
|
-
value: publisherDetails.name
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
objectTypeId: CONTACT_OBJECT_ID,
|
|
144
|
-
name: CONTACT_PROPERTY_EMAIL,
|
|
145
|
-
value: publisherDetails.email
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
objectTypeId: CONTACT_OBJECT_ID,
|
|
149
|
-
name: CONTACT_PROPERTY_WEBSITE,
|
|
150
|
-
value: publisherDetails.website
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
154
|
-
name: TICKET_PROPERTY_ATTESTATION_PAYLOAD,
|
|
155
|
-
value: attestationPayload
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
159
|
-
name: TICKET_PROPERTY_DAPP_COLLECTION_ACCOUNT_ADDRESS,
|
|
160
|
-
value: appMintAddress
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
164
|
-
name: TICKET_PROPERTY_DAPP_RELEASE_ACCOUNT_ADDRESS,
|
|
165
|
-
value: releaseMintAddress
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
169
|
-
name: TICKET_PROPERTY_REQUEST_UNIQUE_ID,
|
|
170
|
-
value: requestUniqueId
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
174
|
-
name: TICKET_PROPERTY_AUTHORIZED_REQUEST,
|
|
175
|
-
value: requestorIsAuthorized
|
|
176
|
-
}
|
|
177
|
-
]
|
|
178
|
-
};
|
|
179
|
-
if (criticalUpdate) {
|
|
180
|
-
request.fields.push({
|
|
181
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
182
|
-
name: TICKET_PROPERTY_CRITICAL_UPDATE,
|
|
183
|
-
value: criticalUpdate
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
return [
|
|
187
|
-
2,
|
|
188
|
-
request
|
|
189
|
-
];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
})();
|
|
193
|
-
};
|
|
194
|
-
export var publishRemove = function(publishSolanaNetworkInput, param, dryRun) {
|
|
195
|
-
var appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, publisherDetails = param.publisherDetails, requestorIsAuthorized = param.requestorIsAuthorized, criticalUpdate = param.criticalUpdate;
|
|
196
|
-
return _async_to_generator(function() {
|
|
197
|
-
var removeRequest;
|
|
198
|
-
return _ts_generator(this, function(_state) {
|
|
199
|
-
switch(_state.label){
|
|
200
|
-
case 0:
|
|
201
|
-
return [
|
|
202
|
-
4,
|
|
203
|
-
createRemoveRequest(publishSolanaNetworkInput.connection, publishSolanaNetworkInput.sign, appMintAddress, releaseMintAddress, publisherDetails, requestorIsAuthorized, criticalUpdate)
|
|
204
|
-
];
|
|
205
|
-
case 1:
|
|
206
|
-
removeRequest = _state.sent();
|
|
207
|
-
return [
|
|
208
|
-
2,
|
|
209
|
-
submitRequestToSolanaDappPublisherPortal(removeRequest, URL_FORM_REMOVE, dryRun)
|
|
210
|
-
];
|
|
211
|
-
}
|
|
125
|
+
deprecateLegacyPublishSurface('publishRemove');
|
|
126
|
+
return [
|
|
127
|
+
2,
|
|
128
|
+
undefined
|
|
129
|
+
];
|
|
212
130
|
});
|
|
213
131
|
})();
|
|
214
132
|
};
|