Skip to content

Commit 9bc5edd

Browse files
authored
Feat/payment widget (#1)
1 parent 9f62909 commit 9bc5edd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+15669
-131
lines changed

.github/deploy-to-production.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Deploy to production
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Webhook request
13+
run: |
14+
curl -X GET https://prod.request.network/api/deploy/${{ secrets.EASYPANEL_DEPLOY_KEY_PRODUCTION }}

.github/deploy-to-staging.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Deploy to staging
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Webhook request
13+
run: |
14+
curl -X GET https://stage.request.network/api/deploy/${{ secrets.EASYPANEL_DEPLOY_KEY_STAGING }}

.gitignore

Lines changed: 31 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,41 @@
1-
# Logs
2-
logs
3-
*.log
4-
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
7-
lerna-debug.log*
8-
9-
# Diagnostic reports (https://nodejs.org/api/report.html)
10-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11-
12-
# Runtime data
13-
pids
14-
*.pid
15-
*.seed
16-
*.pid.lock
17-
18-
# Directory for instrumented libs generated by jscoverage/JSCover
19-
lib-cov
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
202

21-
# Coverage directory used by tools like istanbul
22-
coverage
23-
*.lcov
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
2412

25-
# nyc test coverage
26-
.nyc_output
13+
# testing
14+
/coverage
2715

28-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29-
.grunt
16+
# next.js
17+
/.next/
18+
/out/
3019

31-
# Bower dependency directory (https://bower.io/)
32-
bower_components
20+
# production
21+
/build
3322

34-
# node-waf configuration
35-
.lock-wscript
23+
# misc
24+
.DS_Store
25+
*.pem
3626

37-
# Compiled binary addons (https://nodejs.org/api/addons.html)
38-
build/Release
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
3932

40-
# Dependency directories
41-
node_modules/
42-
jspm_packages/
33+
# env files (can opt-in for committing if needed)
34+
.env*
4335

44-
# Snowpack dependency directory (https://snowpack.dev/)
45-
web_modules/
36+
# vercel
37+
.vercel
4638

47-
# TypeScript cache
39+
# typescript
4840
*.tsbuildinfo
49-
50-
# Optional npm cache directory
51-
.npm
52-
53-
# Optional eslint cache
54-
.eslintcache
55-
56-
# Optional stylelint cache
57-
.stylelintcache
58-
59-
# Optional REPL history
60-
.node_repl_history
61-
62-
# Output of 'npm pack'
63-
*.tgz
64-
65-
# Yarn Integrity file
66-
.yarn-integrity
67-
68-
# dotenv environment variable files
69-
.env
70-
.env.*
71-
!.env.example
72-
73-
# parcel-bundler cache (https://parceljs.org/)
74-
.cache
75-
.parcel-cache
76-
77-
# Next.js build output
78-
.next
79-
out
80-
81-
# Nuxt.js build / generate output
82-
.nuxt
83-
dist
84-
85-
# Gatsby files
86-
.cache/
87-
# Comment in the public line in if your project uses Gatsby and not Next.js
88-
# https://nextjs.org/blog/next-9-1#public-directory-support
89-
# public
90-
91-
# vuepress build output
92-
.vuepress/dist
93-
94-
# vuepress v2.x temp and cache directory
95-
.temp
96-
.cache
97-
98-
# Sveltekit cache directory
99-
.svelte-kit/
100-
101-
# vitepress build output
102-
**/.vitepress/dist
103-
104-
# vitepress cache directory
105-
**/.vitepress/cache
106-
107-
# Docusaurus cache and generated files
108-
.docusaurus
109-
110-
# Serverless directories
111-
.serverless/
112-
113-
# FuseBox cache
114-
.fusebox/
115-
116-
# DynamoDB Local files
117-
.dynamodb/
118-
119-
# Firebase cache directory
120-
.firebase/
121-
122-
# TernJS port file
123-
.tern-port
124-
125-
# Stores VSCode versions used for testing VSCode extensions
126-
.vscode-test
127-
128-
# yarn v3
129-
.pnp.*
130-
.yarn/*
131-
!.yarn/patches
132-
!.yarn/plugins
133-
!.yarn/releases
134-
!.yarn/sdks
135-
!.yarn/versions
136-
137-
# Vite logs files
138-
vite.config.js.timestamp-*
139-
vite.config.ts.timestamp-*
41+
next-env.d.ts

README.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
1-
# ui-registry
2-
Request Network's reusable components registry for ShadCN
1+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2+
3+
## Notes
4+
5+
Before you push changes to this repository, do not forget to run `npm run registry:build` to regenerate the component's `JSON` file!
6+
7+
8+
## Getting Started
9+
10+
First, run the development server:
11+
12+
```bash
13+
npm run dev
14+
# or
15+
yarn dev
16+
# or
17+
pnpm dev
18+
# or
19+
bun dev
20+
```
21+
22+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
23+
24+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
25+
26+
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
27+
28+
## Learn More
29+
30+
To learn more about Next.js, take a look at the following resources:
31+
32+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
33+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
34+
35+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
36+
37+
## Deploy on Vercel
38+
39+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
40+
41+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
"use client";
2+
3+
import { PaymentWidget } from "@/registry/default/payment-widget/payment-widget";
4+
import type { WalletClient } from "viem";
5+
6+
interface PaymentWidgetWrapperProps {
7+
recipientWallet: string;
8+
walletAccount?: WalletClient;
9+
}
10+
11+
export function PaymentWidgetWrapper({
12+
recipientWallet,
13+
walletAccount,
14+
}: PaymentWidgetWrapperProps) {
15+
const walletConnectProjectId =
16+
process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || "";
17+
const rnApiClientId = process.env.NEXT_PUBLIC_REQUEST_API_CLIENT_ID || "";
18+
19+
const handleSuccess = async (requestId: string) => {
20+
console.log("Payment successful:", requestId);
21+
};
22+
23+
const handleError = async (error: any) => {
24+
console.error("Payment failed:", error);
25+
};
26+
27+
return (
28+
<PaymentWidget
29+
amountInUsd="1.00"
30+
recipientWallet={recipientWallet}
31+
walletAccount={walletAccount}
32+
paymentConfig={{
33+
walletConnectProjectId,
34+
rnApiClientId,
35+
supportedCurrencies: [
36+
"ETH-sepolia-sepolia",
37+
"fUSDT-sepolia",
38+
"FAU-sepolia",
39+
//"USDCn-matic",
40+
],
41+
feeInfo: undefined /* {
42+
feeAddress: "0xEbe98659e162e8fF3520EC71e097C9e0a4F53829",
43+
feePercentage: "10",
44+
},*/,
45+
}}
46+
receiptInfo={{
47+
buyerInfo: {
48+
firstName: "Testo",
49+
50+
},
51+
companyInfo: {
52+
name: "Request Network Inc.",
53+
address: {
54+
street: "123 Crypto Street",
55+
city: "San Francisco",
56+
state: "CA",
57+
postalCode: "94105",
58+
country: "USA",
59+
},
60+
taxId: "US123456789",
61+
62+
phone: "+1 (555) 123-4567",
63+
website: "https://request.network",
64+
},
65+
items: [
66+
{
67+
id: "1",
68+
description: "Payment via Request Network",
69+
quantity: 1,
70+
unitPrice: "10.0",
71+
total: "10.0",
72+
currency: "USD",
73+
},
74+
],
75+
totals: {
76+
totalDiscount: "0",
77+
totalTax: "0",
78+
total: "10.0",
79+
totalUSD: "10.0",
80+
},
81+
}}
82+
onSuccess={handleSuccess}
83+
onError={handleError}
84+
>
85+
<div className="flex p-3 bg-blue-500 items-center rounded-2xl text-white">
86+
Pay using crypto
87+
</div>
88+
</PaymentWidget>
89+
);
90+
}

0 commit comments

Comments
 (0)