Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial alpha testing support #289

Merged
merged 8 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ release:
solana_mobile_dapp_publisher_portal:
google_store_package: com.solanamobile.cutekitten.gps
testing_instructions: Here are some steps informing Solana Mobile of how to test this dapp. You can specify multiple lines of instructions. For example, if a login is needed, you would add those details here.
#alpha_testers: 3tgkMfug2gs82sy2wexQjMkR12JzFcX9rSLd9yM9m38g,G65S4B3RkFpPAt9CwY4cZXptNSkTS6c8hFW1m89GCuB1 -- specify your own
7 changes: 7 additions & 0 deletions packages/cli/src/CliSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ publishCommand
"-d, --dry-run",
"Flag for dry run. Doesn't submit the request to the publisher portal."
)
.option("-l, --alpha", "Flag to mark the submission as alpha test.")
.action(
async ({
appMintAddress,
Expand All @@ -312,6 +313,7 @@ publishCommand
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
dryRun,
alpha,
}) => {
await tryWithErrorMessage(async () => {
await checkForSelfUpdate();
Expand All @@ -335,6 +337,7 @@ publishCommand
compliesWithSolanaDappStorePolicies: compliesWithSolanaDappStorePolicies,
requestorIsAuthorized: requestorIsAuthorized,
critical: false,
alphaTest: alpha,
});
} else {
await publishSubmitCommand({
Expand All @@ -345,6 +348,7 @@ publishCommand
dryRun: dryRun,
compliesWithSolanaDappStorePolicies: compliesWithSolanaDappStorePolicies,
requestorIsAuthorized: requestorIsAuthorized,
alphaTest: alpha,
});
}

Expand Down Expand Up @@ -389,6 +393,7 @@ publishCommand
"-d, --dry-run",
"Flag for dry run. Doesn't submit the request to the publisher portal."
)
.option("-l, --alpha", "Flag to mark the submission as alpha test.")
.action(
async ({
appMintAddress,
Expand All @@ -399,6 +404,7 @@ publishCommand
requestorIsAuthorized,
critical,
dryRun,
alpha,
}) => {
await tryWithErrorMessage(async () => {
await checkForSelfUpdate();
Expand All @@ -421,6 +427,7 @@ publishCommand
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
critical,
alphaTest: alpha,
});

if (dryRun) {
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/commands/publish/PublishCliSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type PublishSubmitCommandInput = {
dryRun: boolean;
compliesWithSolanaDappStorePolicies: boolean;
requestorIsAuthorized: boolean;
alphaTest?: boolean;
};

export const publishSubmitCommand = async ({
Expand All @@ -24,6 +25,7 @@ export const publishSubmitCommand = async ({
dryRun = false,
compliesWithSolanaDappStorePolicies = false,
requestorIsAuthorized = false,
alphaTest
}: PublishSubmitCommandInput) => {
showMessage(
`Publishing Estimates`,
Expand Down Expand Up @@ -74,6 +76,7 @@ export const publishSubmitCommand = async ({
solanaMobileDappPublisherPortalDetails,
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
alphaTest,
},
dryRun
);
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/commands/publish/PublishCliUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type PublishUpdateCommandInput = {
compliesWithSolanaDappStorePolicies: boolean;
requestorIsAuthorized: boolean;
critical: boolean;
alphaTest?: boolean;
};

export const publishUpdateCommand = async ({
Expand All @@ -25,6 +26,7 @@ export const publishUpdateCommand = async ({
compliesWithSolanaDappStorePolicies = false,
requestorIsAuthorized = false,
critical = false,
alphaTest,
}: PublishUpdateCommandInput) => {

showMessage(
Expand Down Expand Up @@ -83,6 +85,7 @@ export const publishUpdateCommand = async ({
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
criticalUpdate: critical,
alphaTest,
},
dryRun
);
Expand Down
12 changes: 12 additions & 0 deletions packages/cli/src/config/PublishDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import util from "util";
import { imageSize } from "image-size";
import { exec } from "child_process";
import getVideoDimensions from "get-video-dimensions";
import { PublicKey } from "@solana/web3.js";

const runImgSize = util.promisify(imageSize);
const runExec = util.promisify(exec);
Expand Down Expand Up @@ -179,6 +180,17 @@ export const loadPublishDetailsWithChecks = async (
}
}

const { alpha_testers } = config.solana_mobile_dapp_publisher_portal;
if (alpha_testers !== undefined) {
for (const wallet of alpha_testers.split(",")) {
try {
void new PublicKey(wallet);
} catch (e: unknown) {
throw new Error(`invalid alpha tester wallet <${wallet}>`);
}
}
}

return config;
};

Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/prebuild_schema/publishing_source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@ release:
solana_mobile_dapp_publisher_portal:
google_store_package: <<ANDROID_PACKAGE_NAME_OF_GOOGLE_PLAY_STORE_VERSION_IF_DIFFERENT>>
testing_instructions: >-
<<TESTING_INSTRUCTIONS>>
<<TESTING_INSTRUCTIONS>>
alpha_testers: <<COMMA_SEPARATED_LIST_OF_WALLETS>>
27 changes: 25 additions & 2 deletions packages/core/src/publish/PublishCoreSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
CONTACT_PROPERTY_WEBSITE,
submitRequestToSolanaDappPublisherPortal,
TICKET_OBJECT_ID,
TICKET_PROPERTY_ALPHA_TEST,
TICKET_PROPERTY_ALPHA_TESTERS,
TICKET_PROPERTY_ATTESTATION_PAYLOAD,
TICKET_PROPERTY_AUTHORIZED_REQUEST,
TICKET_PROPERTY_DAPP_COLLECTION_ACCOUNT_ADDRESS,
Expand All @@ -28,7 +30,8 @@ const createSubmitRequest = async (
publisherDetails: Publisher,
solanaMobileDappPublisherPortalDetails: SolanaMobileDappPublisherPortal,
compliesWithSolanaDappStorePolicies: boolean,
requestorIsAuthorized: boolean
requestorIsAuthorized: boolean,
alphaTest?: boolean
) => {
const { attestationPayload, requestUniqueId } = await createAttestationPayload(connection, sign);

Expand Down Expand Up @@ -90,6 +93,14 @@ const createSubmitRequest = async (
});
}

if (alphaTest) {
request.fields.push({
objectTypeId: TICKET_OBJECT_ID,
name: TICKET_PROPERTY_ALPHA_TEST,
value: true,
});
}

if (solanaMobileDappPublisherPortalDetails.testing_instructions !== undefined) {
request.fields.push(
{
Expand All @@ -100,6 +111,14 @@ const createSubmitRequest = async (
);
}

if (solanaMobileDappPublisherPortalDetails.alpha_testers !== undefined) {
request.fields.push({
objectTypeId: TICKET_OBJECT_ID,
name: TICKET_PROPERTY_ALPHA_TESTERS,
value: solanaMobileDappPublisherPortalDetails.alpha_testers,
});
}

return request;
};

Expand All @@ -110,6 +129,7 @@ export type PublishSubmitInput = {
solanaMobileDappPublisherPortalDetails: SolanaMobileDappPublisherPortal;
compliesWithSolanaDappStorePolicies: boolean;
requestorIsAuthorized: boolean;
alphaTest?: boolean;
};

export const publishSubmit = async (
Expand All @@ -121,6 +141,7 @@ export const publishSubmit = async (
solanaMobileDappPublisherPortalDetails,
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
alphaTest,
} : PublishSubmitInput,
dryRun: boolean,
) => {
Expand All @@ -132,7 +153,9 @@ export const publishSubmit = async (
publisherDetails,
solanaMobileDappPublisherPortalDetails,
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized);
requestorIsAuthorized,
alphaTest
);

return submitRequestToSolanaDappPublisherPortal(submitRequest, URL_FORM_SUBMIT, dryRun);
};
27 changes: 25 additions & 2 deletions packages/core/src/publish/PublishCoreUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
CONTACT_PROPERTY_WEBSITE,
submitRequestToSolanaDappPublisherPortal,
TICKET_OBJECT_ID,
TICKET_PROPERTY_ALPHA_TEST,
TICKET_PROPERTY_ALPHA_TESTERS,
TICKET_PROPERTY_ATTESTATION_PAYLOAD,
TICKET_PROPERTY_AUTHORIZED_REQUEST,
TICKET_PROPERTY_CRITICAL_UPDATE,
Expand All @@ -29,7 +31,8 @@ const createUpdateRequest = async (
solanaMobileDappPublisherPortalDetails: SolanaMobileDappPublisherPortal,
compliesWithSolanaDappStorePolicies: boolean,
requestorIsAuthorized: boolean,
criticalUpdate: boolean
criticalUpdate: boolean,
alphaTest?: boolean
) => {
const { attestationPayload, requestUniqueId } = await createAttestationPayload(connection, sign);

Expand Down Expand Up @@ -93,6 +96,14 @@ const createUpdateRequest = async (
);
}

if (alphaTest) {
request.fields.push({
objectTypeId: TICKET_OBJECT_ID,
name: TICKET_PROPERTY_ALPHA_TEST,
value: true,
});
}

if (solanaMobileDappPublisherPortalDetails.testing_instructions !== undefined) {
request.fields.push(
{
Expand All @@ -103,6 +114,14 @@ const createUpdateRequest = async (
);
}

if (solanaMobileDappPublisherPortalDetails.alpha_testers !== undefined) {
request.fields.push({
objectTypeId: TICKET_OBJECT_ID,
name: TICKET_PROPERTY_ALPHA_TESTERS,
value: solanaMobileDappPublisherPortalDetails.alpha_testers,
});
}

return request;
};

Expand All @@ -114,6 +133,7 @@ export type PublishUpdateInput = {
compliesWithSolanaDappStorePolicies: boolean;
requestorIsAuthorized: boolean;
criticalUpdate: boolean;
alphaTest?: boolean;
};

export const publishUpdate = async (
Expand All @@ -126,6 +146,7 @@ export const publishUpdate = async (
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
criticalUpdate,
alphaTest,
} : PublishUpdateInput,
dryRun: boolean,
) => {
Expand All @@ -138,7 +159,9 @@ export const publishUpdate = async (
solanaMobileDappPublisherPortalDetails,
compliesWithSolanaDappStorePolicies,
requestorIsAuthorized,
criticalUpdate);
criticalUpdate,
alphaTest
);

return submitRequestToSolanaDappPublisherPortal(updateRequest, URL_FORM_UPDATE, dryRun);
};
2 changes: 2 additions & 0 deletions packages/core/src/publish/dapp_publisher_portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export const TICKET_PROPERTY_GOOGLE_PLAY_STORE_PACKAGE_NAME = "google_play_store
export const TICKET_PROPERTY_POLICY_COMPLIANT = "complies_with_solana_dapp_store_policies"; // boolean
export const TICKET_PROPERTY_REQUEST_UNIQUE_ID = "request_unique_id"; // string (32 base-10 digits)
export const TICKET_PROPERTY_TESTING_INSTRUCTIONS = "testing_instructions"; // string
export const TICKET_PROPERTY_ALPHA_TEST = "alpha_test"; // boolean
export const TICKET_PROPERTY_ALPHA_TESTERS = "alpha_testers"; // string

export const FORM_SUBMIT = "1464247f-6804-46e1-8114-952f372daa81";
export const FORM_UPDATE = "87b4cbe7-957f-495c-a132-8b789678883d";
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export type Release = {
export type SolanaMobileDappPublisherPortal = {
google_store_package: string;
testing_instructions: string;
alpha_testers?: string;
};

export type LastSubmittedVersionOnChain = {
Expand Down
Loading