Skip to content

Commit 048fdd6

Browse files
authored
Merge branch 'main' into peaq-evm-support
2 parents 5c865ef + 81d283c commit 048fdd6

File tree

6 files changed

+63
-19
lines changed

6 files changed

+63
-19
lines changed

typescript/packages/x402/src/shared/middleware.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,30 @@ describe("getDefaultAsset", () => {
344344
});
345345
});
346346

347+
it("should return Polygon Amoy USDC asset details", () => {
348+
const result = getDefaultAsset("polygon-amoy");
349+
expect(result).toEqual({
350+
address: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582",
351+
decimals: 6,
352+
eip712: {
353+
name: "USDC",
354+
version: "2",
355+
},
356+
});
357+
});
358+
359+
it("should return Polygon mainnet USDC asset details", () => {
360+
const result = getDefaultAsset("polygon");
361+
expect(result).toEqual({
362+
address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
363+
decimals: 6,
364+
eip712: {
365+
name: "USD Coin",
366+
version: "2",
367+
},
368+
});
369+
});
370+
347371
it("should handle unknown networks", () => {
348372
expect(() => getDefaultAsset("unknown" as Network)).toThrow("Unsupported network: unknown");
349373
});

typescript/packages/x402/src/types/shared/evm/config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ export const config: Record<string, ChainConfig> = {
4040
usdcAddress: "0xe15fc38f6d8c56af07bbcbe3baf5708a2bf42392",
4141
usdcName: "USDC",
4242
},
43+
"137": {
44+
usdcAddress: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
45+
usdcName: "USD Coin",
46+
},
47+
"80002": {
48+
usdcAddress: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582",
49+
usdcName: "USDC",
50+
},
4351
"3338": {
4452
usdcAddress: "0xbbA60da06c2c5424f03f7434542280FCAd453d10",
4553
usdcName: "USDC",

typescript/packages/x402/src/types/shared/evm/wallet.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,16 @@ import type {
1010
PublicClient,
1111
LocalAccount,
1212
} from "viem";
13-
import { baseSepolia, avalancheFuji, base, sei, seiTestnet, peaq } from "viem/chains";
13+
import {
14+
baseSepolia,
15+
avalancheFuji,
16+
base,
17+
sei,
18+
seiTestnet,
19+
polygon,
20+
polygonAmoy,
21+
peaq,
22+
} from "viem/chains";
1423
import { privateKeyToAccount } from "viem/accounts";
1524
import { Hex } from "viem";
1625

@@ -187,6 +196,10 @@ function getChainFromNetwork(network: string | undefined): Chain {
187196
return sei;
188197
case "sei-testnet":
189198
return seiTestnet;
199+
case "polygon":
200+
return polygon;
201+
case "polygon-amoy":
202+
return polygonAmoy;
190203
case "peaq":
191204
return peaq;
192205
default:

typescript/packages/x402/src/types/shared/network.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export const NetworkSchema = z.enum([
1010
"solana",
1111
"sei",
1212
"sei-testnet",
13+
"polygon",
14+
"polygon-amoy",
1315
"peaq",
1416
]);
1517
export type Network = z.infer<typeof NetworkSchema>;
@@ -23,6 +25,8 @@ export const SupportedEVMNetworks: Network[] = [
2325
"iotex",
2426
"sei",
2527
"sei-testnet",
28+
"polygon",
29+
"polygon-amoy",
2630
"peaq",
2731
];
2832
export const EvmNetworkToChainId = new Map<Network, number>([
@@ -33,6 +37,8 @@ export const EvmNetworkToChainId = new Map<Network, number>([
3337
["iotex", 4689],
3438
["sei", 1329],
3539
["sei-testnet", 1328],
40+
["polygon", 137],
41+
["polygon-amoy", 80002],
3642
["peaq", 3338],
3743
]);
3844

typescript/site/app/components/NavBar.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import Link from 'next/link';
1+
import Link from "next/link";
22
import {
33
QuestionMarkCircleIcon,
44
ArrowDownTrayIcon,
55
BriefcaseIcon,
6-
} from '@heroicons/react/24/outline';
7-
import GithubIcon from '../assets/github.svg';
8-
import DiscordIcon from '../assets/discord.svg';
6+
} from "@heroicons/react/24/outline";
7+
import GithubIcon from "../assets/github.svg";
8+
import DiscordIcon from "../assets/discord.svg";
99

1010
const NavBar = () => {
1111
return (
1212
<section className="max-w-6xl mx-auto px-4 pt-4 relative z-20">
1313
<div className="flex gap-4 md:gap-8 justify-between sm:justify-end">
1414
<Link
15-
href="https://docs.google.com/forms/d/e/1FAIpQLSeESQAfvSlmjzl8JTcAOdzYjcWZ2O2GZjhuSeb8vTPpNys7FQ/viewform"
15+
href="https://forms.gle/VZKvX93ifiew1ksW9"
1616
target="_blank"
1717
rel="noopener noreferrer"
1818
className="font-mono hover:text-blue-400 transition-colors flex items-center gap-1 text-sm"
1919
>
2020
<QuestionMarkCircleIcon className="w-4 h-4 mr-1" />
21-
Learn more
21+
Get In Touch
2222
</Link>
2323
<Link
2424
href="/x402.pdf"
@@ -61,4 +61,4 @@ const NavBar = () => {
6161
);
6262
};
6363

64-
export default NavBar;
64+
export default NavBar;

typescript/site/app/layout.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const geistMono = Geist_Mono({
1313
});
1414

1515
export const metadata: Metadata = {
16-
title: 'x402.org',
17-
description: 'A chain-agnostic protocol for web payments',
16+
title: "x402.org",
17+
description: "An open standard for internet-native payments",
1818
};
1919

2020
export default function RootLayout({
@@ -26,18 +26,11 @@ export default function RootLayout({
2626
<html lang="en">
2727
<head>
2828
<link rel="icon" type="image/png" href="/x402-icon-black.png" />
29-
<link
30-
rel="apple-touch-icon"
31-
href="/x402-icon-black.png"
32-
/>
29+
<link rel="apple-touch-icon" href="/x402-icon-black.png" />
3330
<meta name="apple-mobile-web-app-title" content="x402" />
3431
<link rel="manifest" href="/site.webmanifest" />
3532
</head>
36-
<body
37-
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
38-
>
39-
{children}
40-
</body>
33+
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>{children}</body>
4134
</html>
4235
);
4336
}

0 commit comments

Comments
 (0)