-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/payment widget #1
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
Merged
Merged
Changes from 32 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
d2c18d1
feat: scaffold initial payment widget component
bassgeta 9ae4ede
feat: reorganize folder structure when lib is added via shad cli, use…
bassgeta d7a1a57
feat: implement currency selection and buyer info form
bassgeta 1683a73
feat: reorganize the home page and widget due to env issues, implemen…
bassgeta 708d686
feat: make the payment step more granular and decouple functions, con…
bassgeta bade620
feat: add invoice download as the payment success step
bassgeta 89c6923
feat: rework props and make invoice info configurable by props
bassgeta b2f24a1
feat: fetch conversion currencies dynamically
bassgeta fb0b232
feat: add flags for payment success UI elements, add supported curren…
bassgeta d407216
feat: add option to override the wallet connection with own viem wall…
bassgeta f524cf1
feat: make the button just be children and add powered by RN subtext
bassgeta d9d615b
feat: use real wallet logos
bassgeta b7f9405
feat: use client id instead of API key
bassgeta 12cb559
fix: fix wagmi config error due to wallet connect being initialized t…
bassgeta 0c52196
feat: restyle app to look nicer
bassgeta badec7b
fix: shadcn build, restyle invoice
bassgeta 53692b7
fix: move wallet icons to base64
bassgeta c8b3fbb
docs: add code comment containing css overrides
bassgeta 02c381d
refactor: use context instead of prop drilling
bassgeta 50faeb7
feat: add readme.md and code for using an existing viem wallet client
bassgeta 791128b
refactor: locally encapsulate helpers instead of having them in globa…
bassgeta daebcc9
refactor: use receipt instead of invoice, make company name mandatory…
bassgeta 4242270
feat: zipCode -> postalCode, add customerInfo to payout
bassgeta be2644e
feat: make form send undefined instead of empty string, start nesting…
bassgeta 54aeb6b
feat: wait for transactions to be mined, update the onSuccess handler
bassgeta b78219b
feat: code review align
bassgeta 05f91ec
feat: make URL overridable via env
bassgeta 8a05197
feat: code review align, make api url overridable
bassgeta 7b6dff4
feat: handle switching chains before executing payment, pass txHash t…
bassgeta 70ce7e1
feat: nest CSS class, disable pay button
bassgeta b3347b8
refactor: use supportedCurrencies instead of the top level network pa…
bassgeta 3e505ea
refactor: change receipt info numbers to strings
bassgeta 72e5bf9
fix: make matic and polygon resolve to the polygon network
bassgeta 4c8a456
fix: make the page try to pay 1 dollar instead of 10
bassgeta c4647e5
build: add deploy to staging and production scripts
bassgeta c702ddd
fix: comment out actual USDC from the test page
bassgeta f9e732e
docs: add note for devs to run the registry build before pushing
bassgeta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,41 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/versions | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
# testing | ||
/coverage | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
# production | ||
/build | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
# env files (can opt-in for committing if needed) | ||
.env* | ||
|
||
# Snowpack dependency directory (https://snowpack.dev/) | ||
web_modules/ | ||
# vercel | ||
.vercel | ||
|
||
# TypeScript cache | ||
# typescript | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional stylelint cache | ||
.stylelintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variable files | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
.parcel-cache | ||
|
||
# Next.js build output | ||
.next | ||
out | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and not Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# vuepress v2.x temp and cache directory | ||
.temp | ||
.cache | ||
|
||
# Sveltekit cache directory | ||
.svelte-kit/ | ||
|
||
# vitepress build output | ||
**/.vitepress/dist | ||
|
||
# vitepress cache directory | ||
**/.vitepress/cache | ||
|
||
# Docusaurus cache and generated files | ||
.docusaurus | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# Firebase cache directory | ||
.firebase/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test | ||
|
||
# yarn v3 | ||
.pnp.* | ||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
!.yarn/releases | ||
!.yarn/sdks | ||
!.yarn/versions | ||
|
||
# Vite logs files | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* | ||
next-env.d.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
# ui-registry | ||
Request Network's reusable components registry for ShadCN | ||
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). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
# or | ||
bun dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
|
||
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. | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
|
||
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. | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
"use client"; | ||
|
||
import { PaymentWidget } from "@/registry/default/payment-widget/payment-widget"; | ||
import type { WalletClient } from "viem"; | ||
|
||
interface PaymentWidgetWrapperProps { | ||
recipientWallet: string; | ||
walletAccount?: WalletClient; | ||
} | ||
|
||
export function PaymentWidgetWrapper({ | ||
recipientWallet, | ||
walletAccount, | ||
}: PaymentWidgetWrapperProps) { | ||
const walletConnectProjectId = | ||
process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || ""; | ||
const rnApiClientId = process.env.NEXT_PUBLIC_REQUEST_API_CLIENT_ID || ""; | ||
|
||
const handleSuccess = async (requestId: string) => { | ||
console.log("Payment successful:", requestId); | ||
}; | ||
|
||
const handleError = async (error: any) => { | ||
console.error("Payment failed:", error); | ||
}; | ||
|
||
return ( | ||
<PaymentWidget | ||
amountInUsd="10.00" | ||
recipientWallet={recipientWallet} | ||
walletAccount={walletAccount} | ||
paymentConfig={{ | ||
walletConnectProjectId, | ||
rnApiClientId, | ||
supportedCurrencies: [ | ||
"ETH-sepolia-sepolia", | ||
"fUSDT-sepolia", | ||
"FAU-sepolia", | ||
"USDCn-matic", | ||
], | ||
feeInfo: undefined /* { | ||
feeAddress: "0xEbe98659e162e8fF3520EC71e097C9e0a4F53829", | ||
feePercentage: "10", | ||
},*/, | ||
}} | ||
receiptInfo={{ | ||
buyerInfo: { | ||
firstName: "Testo", | ||
email: "[email protected]", | ||
}, | ||
companyInfo: { | ||
name: "Request Network Inc.", | ||
address: { | ||
street: "123 Crypto Street", | ||
city: "San Francisco", | ||
state: "CA", | ||
postalCode: "94105", | ||
country: "USA", | ||
}, | ||
taxId: "US123456789", | ||
email: "[email protected]", | ||
phone: "+1 (555) 123-4567", | ||
website: "https://request.network", | ||
}, | ||
items: [ | ||
{ | ||
id: "1", | ||
description: "Payment via Request Network", | ||
quantity: 1, | ||
unitPrice: "10.0", | ||
total: "10.0", | ||
currency: "USD", | ||
}, | ||
], | ||
totals: { | ||
totalDiscount: "0", | ||
totalTax: "0", | ||
total: "10.0", | ||
totalUSD: "10.0", | ||
}, | ||
}} | ||
onSuccess={handleSuccess} | ||
onError={handleError} | ||
> | ||
<div className="flex p-3 bg-blue-500 items-center rounded-2xl text-white"> | ||
Pay using crypto | ||
</div> | ||
</PaymentWidget> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.