Skip to content

Commit 0a5b461

Browse files
committed
chore: prepare next beta session onboarding flow
1 parent e271885 commit 0a5b461

35 files changed

Lines changed: 4806 additions & 235 deletions

app/meta/app-registry.seed.json

Lines changed: 2449 additions & 0 deletions
Large diffs are not rendered by default.

app/next.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ const __dirname = dirname(__filename);
88
const context = __dirname;
99

1010
const nextConfig = {
11+
images: {
12+
remotePatterns: [
13+
{
14+
protocol: 'https',
15+
hostname: 'abstract-portal-metadata-prod.s3.amazonaws.com',
16+
},
17+
],
18+
},
1119
webpack(config) {
1220
// Grab the existing rule that handles SVG imports
1321
const fileLoaderRule = config.module.rules.find((rule) =>

app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"start": "next start",
1010
"lint": "next lint",
1111
"check-types": "tsc --noEmit",
12-
"test": "vitest run"
12+
"test": "vitest run",
13+
"refresh:app-registry": "node scripts/refresh-app-registry.mjs"
1314
},
1415
"engines": {
1516
"node": ">=20.0.0"
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
#!/usr/bin/env node
2+
3+
import fs from "node:fs/promises";
4+
import path from "node:path";
5+
6+
const outputPath = path.resolve(process.cwd(), "meta", "app-registry.seed.json");
7+
const portalApiBase = "https://backend.portal.abs.xyz/api/contract/address";
8+
9+
const appSeeds = [
10+
{
11+
id: "12",
12+
name: "MYRIAD",
13+
contracts: ["0x4f4988A910f8aE9B3214149A8eA1F2E4e3Cd93CC"],
14+
},
15+
{
16+
id: "39",
17+
name: "Gigaverse",
18+
contracts: [
19+
"0xD24902E148cCF3e12CD7Fbb90a0428b62afabd95",
20+
"0x8C98B3a36C0d9e7893Eb848FDf5b4658aDFe0732",
21+
"0x57E8994e2Ac2e49974b0aE685C15b468d1C09259",
22+
"0x59EEC556cEf447E13eDf4BfD3D4433d8daD8a7a5",
23+
"0x74eb92b33f2400EB14F6D6725B14F76078d5E731",
24+
"0x7619a1716bA419A8440fEcF98068A15457634c60",
25+
"0x833AF8b667500FaA61D0f136F85865E506458Aa0",
26+
"0xB40468196610fC1060986F16438B4DE9F4530cC9",
27+
"0xF101f08880a6AcB31b041Aba7586D1C40F33D910",
28+
],
29+
},
30+
{
31+
id: "136",
32+
name: "Gacha",
33+
contracts: [
34+
"0x3272596F776470D2D7C3f7dfF3dc50888b7D8967",
35+
"0xe6765C9cb1B42D3CC36Fcd3D2B4fc938db456EaD",
36+
"0xe90e33162d31004996F14ED6463EA1F610d4d3Ab",
37+
],
38+
},
39+
{
40+
id: "183",
41+
name: "Aborean Finance",
42+
contracts: [
43+
"0xC0F53703e9f4b79fA2FB09a2aeBA487FA97729c9",
44+
"0x4d8971D9932C1c0c16079722b3D93893F16Bb065",
45+
"0xF6cDfFf7Ad51caaD860e7A35d6D4075d74039a6B",
46+
],
47+
},
48+
{
49+
id: "213",
50+
name: "Maze of Gains",
51+
contracts: [
52+
"0x40018Cbb1926dae72DCb315E89AAB7320A191D02",
53+
"0xBDE2483b242C266a97E39826b2B5B3c06FC02916",
54+
],
55+
},
56+
];
57+
58+
async function fetchContractSummary(address) {
59+
let response = null;
60+
let lastStatus = "unknown";
61+
62+
for (let attempt = 0; attempt < 3; attempt += 1) {
63+
response = await fetch(`${portalApiBase}/${address}`, {
64+
headers: {
65+
"user-agent": "agw-mcp-app-registry-refresh/1.0",
66+
},
67+
});
68+
lastStatus = String(response.status);
69+
70+
if (response.ok) {
71+
break;
72+
}
73+
if (response.status !== 429 && response.status < 500) {
74+
break;
75+
}
76+
await new Promise(resolve => setTimeout(resolve, 300 * (attempt + 1)));
77+
}
78+
79+
if (!response || !response.ok) {
80+
return {
81+
address,
82+
name: "Unknown",
83+
selectors: [],
84+
source: `portal-api-miss-${lastStatus}`,
85+
};
86+
}
87+
88+
const payload = await response.json();
89+
const contract = payload.contract ?? {};
90+
const functions = Array.isArray(contract.functions) ? contract.functions : [];
91+
return {
92+
address,
93+
name: typeof contract.name === "string" ? contract.name : "Unknown",
94+
selectors: functions
95+
.filter(item => item && typeof item.selector === "string")
96+
.map(item => ({
97+
selector: item.selector,
98+
name: typeof item.name === "string" ? item.name : "Unknown",
99+
})),
100+
source: "portal-api",
101+
};
102+
}
103+
104+
async function main() {
105+
const generatedAt = new Date().toISOString();
106+
const apps = [];
107+
108+
for (const app of appSeeds) {
109+
const contracts = [];
110+
for (const address of app.contracts) {
111+
contracts.push(await fetchContractSummary(address));
112+
}
113+
apps.push({
114+
id: app.id,
115+
name: app.name,
116+
contracts,
117+
});
118+
}
119+
120+
const output = {
121+
generatedAt,
122+
source: portalApiBase,
123+
apps,
124+
};
125+
126+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
127+
await fs.writeFile(outputPath, `${JSON.stringify(output, null, 2)}\n`, "utf8");
128+
process.stdout.write(`Wrote ${outputPath}\n`);
129+
}
130+
131+
main().catch(error => {
132+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
133+
process.exit(1);
134+
});

app/src/components/SessionWizard/steps/Creating.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ export default function Creating({
6666
chainId: chain.id,
6767
expiresAt: Number(result.sessionConfig.expiresAt),
6868
sessionConfig: serializeSessionConfig(result.sessionConfig),
69+
policyMeta: policyPreview.policyPayload.policyMeta,
6970
};
7071

7172
const redirectUrl = buildRedirectUrl(callbackUrl, bundle);
7273
markCreationSuccess({
7374
transactionHash: result.transactionHash ?? null,
7475
redirectUrl,
7576
});
76-
window.location.assign(redirectUrl);
7777
} catch (error) {
7878
markCreationError(error instanceof Error ? error.message : String(error));
7979
}

0 commit comments

Comments
 (0)