Skip to content

Commit

Permalink
Merge pull request #16 from ardriveapp/share-credit-page
Browse files Browse the repository at this point in the history
feat(share credits): init credit sharing UI MVP
  • Loading branch information
fedellen authored Nov 7, 2024
2 parents f54a1e0 + d58069f commit 47f4ea4
Show file tree
Hide file tree
Showing 8 changed files with 635 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "turbo-app",
"version": "1.1.0",
"version": "1.2.0",
"type": "module",
"description": "ArDrive Turbo App",
"homepage": "./",
Expand All @@ -19,7 +19,7 @@
"test": "echo \"TODO: add tests\" && exit 0"
},
"dependencies": {
"@ardrive/turbo-sdk": "1.19.0",
"@ardrive/turbo-sdk": "1.20.2",
"@solana/web3.js": "^1.95.3",
"ethers": "^6.13.3",
"react": "^18.2.0",
Expand Down
2 changes: 2 additions & 0 deletions src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RedeemPage } from "./pages/RedeemPage";
import { FiatTopUpPage } from "./pages/FiatTopUpPage";
import { CryptoTopUpPage } from "./pages/CryptoTopUpPage";
import { UploadPage } from "./pages/UploadPage";
import { ShareCreditsPage } from "./pages/ShareCreditPage";

export function Router() {
return (
Expand All @@ -15,6 +16,7 @@ export function Router() {
<Route path="/top-up/fiat" element={<FiatTopUpPage />} />
<Route path="/top-up/crypto" element={<CryptoTopUpPage />} />
<Route path="/upload" element={<UploadPage />} />
<Route path="/share-credits" element={<ShareCreditsPage />} />

<Route
path="/"
Expand Down
4 changes: 4 additions & 0 deletions src/components/TurboWalletConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ export default function TurboWalletConnector({
TurboFactory.authenticated({
token: "ethereum",
walletAdapter: {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore -- ethers.signer types are mismatched
getSigner: () => signer,
},
...turboConfig,
}),
);

Expand Down Expand Up @@ -89,6 +92,7 @@ export default function TurboWalletConnector({
TurboFactory.authenticated({
token: "solana",
walletAdapter: wallet,
...turboConfig,
}),
);
setCurrentToken("solana");
Expand Down
16 changes: 11 additions & 5 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
export const paymentServiceUrl =
import.meta.env.PROD === true
? "https://payment.ardrive.io"
: "http://localhost:3000";
import { TurboUnauthenticatedConfiguration } from "@ardrive/turbo-sdk";

const isProd = import.meta.env.PROD === true;
export const paymentServiceUrl = isProd
? "https://payment.ardrive.io"
: "https://payment.ardrive.dev";
export const uploadServiceUrl = isProd
? "https://upload.ardrive.io"
: "https://upload.ardrive.dev";
export const termsOfServiceUrl = "https://ardrive.io/tos-and-privacy/";
export const defaultUSDAmount = 10.0;
export const turboConfig = {
export const turboConfig: TurboUnauthenticatedConfiguration = {
paymentServiceConfig: { url: paymentServiceUrl },
uploadServiceConfig: { url: uploadServiceUrl },
};
export const wincPerCredit = 1_000_000_000_000;
export const defaultDebounceMs = 500;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CryptoTopUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function CryptoTopUpForm({ errorCallback }: ErrMsgCallbackAsProps) {
.topUpWithTokens({ tokenAmount: ARToTokenAmount(arAmount) })

.catch((err: unknown) => {
console.log("err", err);
console.error("err", err);
errorCallback(
`Error topping up: ${err instanceof Error ? err.message : err}`,
);
Expand Down
Loading

0 comments on commit 47f4ea4

Please sign in to comment.