@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
|
@@ -118,125 +118,15 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
var createSubmitRequest = function(connection, sign, appMintAddress, releaseMintAddress, publisherDetails, solanaMobileDappPublisherPortalDetails, compliesWithSolanaDappStorePolicies, requestorIsAuthorized, alphaTest) {
|
|
121
|
+
import { deprecateLegacyPublishSurface } from '../portal/compat.js';
|
|
122
|
+
export var publishSubmit = 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
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
179
|
-
name: TICKET_PROPERTY_POLICY_COMPLIANT,
|
|
180
|
-
value: compliesWithSolanaDappStorePolicies
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
};
|
|
184
|
-
if (solanaMobileDappPublisherPortalDetails.google_store_package !== undefined) {
|
|
185
|
-
request.fields.push({
|
|
186
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
187
|
-
name: TICKET_PROPERTY_GOOGLE_PLAY_STORE_PACKAGE_NAME,
|
|
188
|
-
value: solanaMobileDappPublisherPortalDetails.google_store_package
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (alphaTest) {
|
|
192
|
-
request.fields.push({
|
|
193
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
194
|
-
name: TICKET_PROPERTY_ALPHA_TEST,
|
|
195
|
-
value: true
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (solanaMobileDappPublisherPortalDetails.testing_instructions !== undefined) {
|
|
199
|
-
request.fields.push({
|
|
200
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
201
|
-
name: TICKET_PROPERTY_TESTING_INSTRUCTIONS,
|
|
202
|
-
value: solanaMobileDappPublisherPortalDetails.testing_instructions
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
if (solanaMobileDappPublisherPortalDetails.alpha_testers !== undefined && solanaMobileDappPublisherPortalDetails.alpha_testers.length > 0) {
|
|
206
|
-
request.fields.push({
|
|
207
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
208
|
-
name: TICKET_PROPERTY_ALPHA_TESTERS,
|
|
209
|
-
value: solanaMobileDappPublisherPortalDetails.alpha_testers.map(function(tester) {
|
|
210
|
-
return tester.address;
|
|
211
|
-
}).toString()
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
return [
|
|
215
|
-
2,
|
|
216
|
-
request
|
|
217
|
-
];
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
})();
|
|
221
|
-
};
|
|
222
|
-
export var publishSubmit = function(publishSolanaNetworkInput, param, dryRun) {
|
|
223
|
-
var appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, publisherDetails = param.publisherDetails, solanaMobileDappPublisherPortalDetails = param.solanaMobileDappPublisherPortalDetails, compliesWithSolanaDappStorePolicies = param.compliesWithSolanaDappStorePolicies, requestorIsAuthorized = param.requestorIsAuthorized, alphaTest = param.alphaTest;
|
|
224
|
-
return _async_to_generator(function() {
|
|
225
|
-
var submitRequest;
|
|
226
|
-
return _ts_generator(this, function(_state) {
|
|
227
|
-
switch(_state.label){
|
|
228
|
-
case 0:
|
|
229
|
-
return [
|
|
230
|
-
4,
|
|
231
|
-
createSubmitRequest(publishSolanaNetworkInput.connection, publishSolanaNetworkInput.sign, appMintAddress, releaseMintAddress, publisherDetails, solanaMobileDappPublisherPortalDetails, compliesWithSolanaDappStorePolicies, requestorIsAuthorized, alphaTest)
|
|
232
|
-
];
|
|
233
|
-
case 1:
|
|
234
|
-
submitRequest = _state.sent();
|
|
235
|
-
return [
|
|
236
|
-
2,
|
|
237
|
-
submitRequestToSolanaDappPublisherPortal(submitRequest, URL_FORM_SUBMIT, dryRun)
|
|
238
|
-
];
|
|
239
|
-
}
|
|
125
|
+
deprecateLegacyPublishSurface('publishSubmit');
|
|
126
|
+
return [
|
|
127
|
+
2,
|
|
128
|
+
undefined
|
|
129
|
+
];
|
|
240
130
|
});
|
|
241
131
|
})();
|
|
242
132
|
};
|
|
@@ -118,94 +118,15 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
var createSupportRequest = function(connection, sign, appMintAddress, releaseMintAddress, publisherDetails, requestorIsAuthorized, requestDetails) {
|
|
121
|
+
import { deprecateLegacyPublishSurface } from '../portal/compat.js';
|
|
122
|
+
export var publishSupport = function(_publishSolanaNetworkInput, _input, _dryRun) {
|
|
124
123
|
return _async_to_generator(function() {
|
|
125
|
-
var _ref, attestationPayload, requestUniqueId;
|
|
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
|
-
return [
|
|
136
|
-
2,
|
|
137
|
-
{
|
|
138
|
-
fields: [
|
|
139
|
-
{
|
|
140
|
-
objectTypeId: CONTACT_OBJECT_ID,
|
|
141
|
-
name: CONTACT_PROPERTY_COMPANY,
|
|
142
|
-
value: publisherDetails.name
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
objectTypeId: CONTACT_OBJECT_ID,
|
|
146
|
-
name: CONTACT_PROPERTY_EMAIL,
|
|
147
|
-
value: publisherDetails.email
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
objectTypeId: CONTACT_OBJECT_ID,
|
|
151
|
-
name: CONTACT_PROPERTY_WEBSITE,
|
|
152
|
-
value: publisherDetails.website
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
156
|
-
name: TICKET_PROPERTY_ATTESTATION_PAYLOAD,
|
|
157
|
-
value: attestationPayload
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
161
|
-
name: TICKET_PROPERTY_CONTENT,
|
|
162
|
-
value: requestDetails
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
166
|
-
name: TICKET_PROPERTY_DAPP_COLLECTION_ACCOUNT_ADDRESS,
|
|
167
|
-
value: appMintAddress
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
171
|
-
name: TICKET_PROPERTY_DAPP_RELEASE_ACCOUNT_ADDRESS,
|
|
172
|
-
value: releaseMintAddress
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
176
|
-
name: TICKET_PROPERTY_REQUEST_UNIQUE_ID,
|
|
177
|
-
value: requestUniqueId
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
181
|
-
name: TICKET_PROPERTY_AUTHORIZED_REQUEST,
|
|
182
|
-
value: requestorIsAuthorized
|
|
183
|
-
}
|
|
184
|
-
]
|
|
185
|
-
}
|
|
186
|
-
];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
})();
|
|
190
|
-
};
|
|
191
|
-
export var publishSupport = function(publishSolanaNetworkInput, param, dryRun) {
|
|
192
|
-
var appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, publisherDetails = param.publisherDetails, requestorIsAuthorized = param.requestorIsAuthorized, requestDetails = param.requestDetails;
|
|
193
|
-
return _async_to_generator(function() {
|
|
194
|
-
var supportRequest;
|
|
195
|
-
return _ts_generator(this, function(_state) {
|
|
196
|
-
switch(_state.label){
|
|
197
|
-
case 0:
|
|
198
|
-
return [
|
|
199
|
-
4,
|
|
200
|
-
createSupportRequest(publishSolanaNetworkInput.connection, publishSolanaNetworkInput.sign, appMintAddress, releaseMintAddress, publisherDetails, requestorIsAuthorized, requestDetails)
|
|
201
|
-
];
|
|
202
|
-
case 1:
|
|
203
|
-
supportRequest = _state.sent();
|
|
204
|
-
return [
|
|
205
|
-
2,
|
|
206
|
-
submitRequestToSolanaDappPublisherPortal(supportRequest, URL_FORM_SUPPORT, dryRun)
|
|
207
|
-
];
|
|
208
|
-
}
|
|
125
|
+
deprecateLegacyPublishSurface('publishSupport');
|
|
126
|
+
return [
|
|
127
|
+
2,
|
|
128
|
+
undefined
|
|
129
|
+
];
|
|
209
130
|
});
|
|
210
131
|
})();
|
|
211
132
|
};
|
|
@@ -118,125 +118,15 @@ function _ts_generator(thisArg, body) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
import {
|
|
122
|
-
|
|
123
|
-
var createUpdateRequest = function(connection, sign, appMintAddress, releaseMintAddress, publisherDetails, solanaMobileDappPublisherPortalDetails, compliesWithSolanaDappStorePolicies, requestorIsAuthorized, criticalUpdate, alphaTest) {
|
|
121
|
+
import { deprecateLegacyPublishSurface } from '../portal/compat.js';
|
|
122
|
+
export var publishUpdate = 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
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
179
|
-
name: TICKET_PROPERTY_POLICY_COMPLIANT,
|
|
180
|
-
value: compliesWithSolanaDappStorePolicies
|
|
181
|
-
}
|
|
182
|
-
]
|
|
183
|
-
};
|
|
184
|
-
if (criticalUpdate) {
|
|
185
|
-
request.fields.push({
|
|
186
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
187
|
-
name: TICKET_PROPERTY_CRITICAL_UPDATE,
|
|
188
|
-
value: criticalUpdate
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
if (alphaTest) {
|
|
192
|
-
request.fields.push({
|
|
193
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
194
|
-
name: TICKET_PROPERTY_ALPHA_TEST,
|
|
195
|
-
value: true
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
if (solanaMobileDappPublisherPortalDetails.testing_instructions !== undefined) {
|
|
199
|
-
request.fields.push({
|
|
200
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
201
|
-
name: TICKET_PROPERTY_TESTING_INSTRUCTIONS,
|
|
202
|
-
value: solanaMobileDappPublisherPortalDetails.testing_instructions
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
if (solanaMobileDappPublisherPortalDetails.alpha_testers !== undefined && solanaMobileDappPublisherPortalDetails.alpha_testers.length > 0) {
|
|
206
|
-
request.fields.push({
|
|
207
|
-
objectTypeId: TICKET_OBJECT_ID,
|
|
208
|
-
name: TICKET_PROPERTY_ALPHA_TESTERS,
|
|
209
|
-
value: solanaMobileDappPublisherPortalDetails.alpha_testers.map(function(tester) {
|
|
210
|
-
return tester.address;
|
|
211
|
-
}).toString()
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
return [
|
|
215
|
-
2,
|
|
216
|
-
request
|
|
217
|
-
];
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
})();
|
|
221
|
-
};
|
|
222
|
-
export var publishUpdate = function(publishSolanaNetworkInput, param, dryRun) {
|
|
223
|
-
var appMintAddress = param.appMintAddress, releaseMintAddress = param.releaseMintAddress, publisherDetails = param.publisherDetails, solanaMobileDappPublisherPortalDetails = param.solanaMobileDappPublisherPortalDetails, compliesWithSolanaDappStorePolicies = param.compliesWithSolanaDappStorePolicies, requestorIsAuthorized = param.requestorIsAuthorized, criticalUpdate = param.criticalUpdate, alphaTest = param.alphaTest;
|
|
224
|
-
return _async_to_generator(function() {
|
|
225
|
-
var updateRequest;
|
|
226
|
-
return _ts_generator(this, function(_state) {
|
|
227
|
-
switch(_state.label){
|
|
228
|
-
case 0:
|
|
229
|
-
return [
|
|
230
|
-
4,
|
|
231
|
-
createUpdateRequest(publishSolanaNetworkInput.connection, publishSolanaNetworkInput.sign, appMintAddress, releaseMintAddress, publisherDetails, solanaMobileDappPublisherPortalDetails, compliesWithSolanaDappStorePolicies, requestorIsAuthorized, criticalUpdate, alphaTest)
|
|
232
|
-
];
|
|
233
|
-
case 1:
|
|
234
|
-
updateRequest = _state.sent();
|
|
235
|
-
return [
|
|
236
|
-
2,
|
|
237
|
-
submitRequestToSolanaDappPublisherPortal(updateRequest, URL_FORM_UPDATE, dryRun)
|
|
238
|
-
];
|
|
239
|
-
}
|
|
125
|
+
deprecateLegacyPublishSurface('publishUpdate');
|
|
126
|
+
return [
|
|
127
|
+
2,
|
|
128
|
+
undefined
|
|
129
|
+
];
|
|
240
130
|
});
|
|
241
131
|
})();
|
|
242
132
|
};
|
package/lib/publish/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana-mobile/dapp-store-publishing-tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,17 +26,15 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/debug": "^4.1.7",
|
|
28
28
|
"@types/mime": "^3.0.1",
|
|
29
|
-
"@types/node-fetch": "^2.6.2",
|
|
30
29
|
"get-video-dimensions": "^1.0.0",
|
|
31
30
|
"json-schema-to-typescript": "^11.0.2",
|
|
32
31
|
"shx": "^0.3.4"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@metaplex-foundation/js": "0.20.0",
|
|
35
|
+
"@metaplex-foundation/mpl-token-metadata": "2.13.0",
|
|
36
36
|
"@solana/web3.js": "1.68.0",
|
|
37
37
|
"ajv": "^8.11.0",
|
|
38
|
-
"axios": "1.1.3",
|
|
39
|
-
"chokidar": "^3.5.3",
|
|
40
38
|
"debug": "^4.3.4",
|
|
41
39
|
"image-size": "^1.0.2",
|
|
42
40
|
"mime": "^3.0.0"
|
package/src/CoreUtils.ts
CHANGED
|
@@ -10,12 +10,6 @@ import { ComputeBudgetProgram } from "@solana/web3.js";
|
|
|
10
10
|
export class Constants {
|
|
11
11
|
static PUBLISHING_SCHEMA_VER = "0.4.0";
|
|
12
12
|
}
|
|
13
|
-
export const truncateAddress = (address: string) => {
|
|
14
|
-
return `${address.slice(0, 4)}...${address.slice(
|
|
15
|
-
address.length - 4,
|
|
16
|
-
address.length
|
|
17
|
-
)}`;
|
|
18
|
-
};
|
|
19
13
|
|
|
20
14
|
type JsonMetadataMetaplexFile = Omit<JsonMetadata, "image"> & {
|
|
21
15
|
image: string | MetaplexFile;
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PublicationAttestationBlockData,
|
|
3
|
+
PublicationAttestationClient,
|
|
4
|
+
PublicationSigner,
|
|
5
|
+
} from './types.js';
|
|
6
|
+
|
|
7
|
+
export type PublicationAttestation = {
|
|
8
|
+
slot_number: number;
|
|
9
|
+
blockhash: string;
|
|
10
|
+
request_unique_id: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type PublicationAttestationResult = {
|
|
14
|
+
payload: string;
|
|
15
|
+
attestationPayload: string;
|
|
16
|
+
requestUniqueId: string;
|
|
17
|
+
attestation: PublicationAttestation;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const createRequestUniqueId = () => {
|
|
21
|
+
const requestUniqueIdLength = 32;
|
|
22
|
+
const charset = '0123456789';
|
|
23
|
+
|
|
24
|
+
return Array(requestUniqueIdLength)
|
|
25
|
+
.fill(undefined)
|
|
26
|
+
.map(() => charset.charAt(Math.floor(Math.random() * charset.length)))
|
|
27
|
+
.join('');
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const createAttestationPayload = async (
|
|
31
|
+
blockData: PublicationAttestationBlockData,
|
|
32
|
+
signer: Pick<PublicationSigner, 'signMessage'>,
|
|
33
|
+
): Promise<PublicationAttestationResult> => {
|
|
34
|
+
const requestUniqueId = createRequestUniqueId();
|
|
35
|
+
const attestation: PublicationAttestation = {
|
|
36
|
+
slot_number: blockData.slot,
|
|
37
|
+
blockhash: blockData.blockhash,
|
|
38
|
+
request_unique_id: requestUniqueId,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const attestationBuffer = new TextEncoder().encode(
|
|
42
|
+
JSON.stringify(attestation),
|
|
43
|
+
);
|
|
44
|
+
const signedMessageFromSigner = await signer.signMessage(attestationBuffer);
|
|
45
|
+
const signedMessageBuffer =
|
|
46
|
+
signedMessageFromSigner.length === 64
|
|
47
|
+
? (() => {
|
|
48
|
+
const payload = new Uint8Array(64 + attestationBuffer.length);
|
|
49
|
+
payload.set(signedMessageFromSigner, 0);
|
|
50
|
+
payload.set(attestationBuffer, 64);
|
|
51
|
+
return payload;
|
|
52
|
+
})()
|
|
53
|
+
: signedMessageFromSigner;
|
|
54
|
+
const signature = signedMessageBuffer.slice(0, 64);
|
|
55
|
+
|
|
56
|
+
if (signature.length !== 64) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`Invalid signature length: expected 64, got ${signature.length}`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
payload: Buffer.from(signedMessageBuffer).toString('base64'),
|
|
64
|
+
attestationPayload: Buffer.from(signedMessageBuffer).toString('base64'),
|
|
65
|
+
requestUniqueId,
|
|
66
|
+
attestation,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const createAttestationPayloadFromClient = async (
|
|
71
|
+
client: PublicationAttestationClient,
|
|
72
|
+
signer: Pick<PublicationSigner, 'signMessage'>,
|
|
73
|
+
): Promise<PublicationAttestationResult> => {
|
|
74
|
+
const blockData = await client.getBlockData();
|
|
75
|
+
return createAttestationPayload(blockData, signer);
|
|
76
|
+
};
|