From dd2950639327f1e3dc210600f42b69d4de377ca2 Mon Sep 17 00:00:00 2001 From: ankushKun Date: Fri, 5 Jul 2024 13:06:41 +0530 Subject: [PATCH] payments --- next_app/src/components/menubar/index.tsx | 39 +++++++++++++++++++++-- next_app/src/pages/_app.tsx | 1 + 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/next_app/src/components/menubar/index.tsx b/next_app/src/components/menubar/index.tsx index bb965fc..6c18829 100644 --- a/next_app/src/components/menubar/index.tsx +++ b/next_app/src/components/menubar/index.tsx @@ -43,9 +43,31 @@ export default function Menubar() { , {position:"top-center", icon:"/icon.svg", duration:15000, style:{backgroundColor:"transparent", boxShadow:"none", color:"transparent"}}) } + + async function oneTime(amount: number) { + // connect to the extension + await window.arweaveWallet.connect(["ACCESS_ALL_ADDRESSES"]); + + // submit the subscription information + const subscription = await window.arweaveWallet.subscription({ + arweaveAccountAddress: "flBS223GKLwM0yiJGCk55BA_mdH_1QTLR5VFKejIi7c", + applicationName: "BetterIDEa", + subscriptionName: "BetterIDEa Sponsor", + subscriptionManagementUrl: "https://ide.betteridea.dev", + subscriptionFeeAmount: amount, + recurringPaymentFrequency: "Monthly", + // one day from today + subscriptionEndDate: new Date(Date.now() + 1000 * 60 * 60 * 24).toISOString(), + applicationIcon: "https://ide.betteridea.dev/icon.svg", + }); + + // Subscription will output the details and the initial payment txn + console.log("Subscription details with paymentHistory array:", subscription); + } + return
- Logo - + Logo + Project @@ -83,6 +105,19 @@ export default function Menubar() { globalState.closeOpenedFile(globalState.activeFile)}>Close File + + Sponsor Us + + + Sponsor a one time amount or a recurring amount (TODO) + + {/* oneTime(0.05)}>0.05 $AR (onetime) + oneTime(0.5)}>0.5 $AR (onetime) + oneTime(1)}>1 $AR (onetime) + + $5 (monthly) */} + +
diff --git a/next_app/src/pages/_app.tsx b/next_app/src/pages/_app.tsx index 8eae783..195e56a 100644 --- a/next_app/src/pages/_app.tsx +++ b/next_app/src/pages/_app.tsx @@ -15,6 +15,7 @@ declare global { disconnect: Function; getActiveAddress:()=> Promise; signDataItem: Function; + subscription: Function; }; } }