diff --git a/src/pages/Subscription/page-components/SecondStep.tsx b/src/pages/Subscription/page-components/SecondStep.tsx
index dfdc902..c1e6a12 100644
--- a/src/pages/Subscription/page-components/SecondStep.tsx
+++ b/src/pages/Subscription/page-components/SecondStep.tsx
@@ -2,14 +2,10 @@ import Separator from '../../../components/Separator';
import { ReactComponent as SpToken } from '../assets/sp-token.svg';
-import { ReactComponent as WalletIcon } from '../assets/wallet-icon.svg';
import { ReactComponent as QuotesIcon } from '../assets/quotes-icon.svg';
import AccountList from '../../../components/AccountList';
-import { useDaemonContext } from '../../../providers/DaemonProvider';
export default function SecondStep({ price, gasfee, updateCounter, spInUsd, solInUsd }: any) {
- const { profiles, purchasingPlan, purchasingPlanPaymentTime } = useDaemonContext();
-
return (
@@ -19,10 +15,19 @@ export default function SecondStep({ price, gasfee, updateCounter, spInUsd, solI
-
{purchasingPlan === 'premium' ? 'Premium' : 'Standard'} Passport
-
{purchasingPlanPaymentTime === 'monthly' ? '30' : '365'} days
+
Premium Passport
+
365 days
-
{purchasingPlan === 'premium' ? '5' : '1'} Device{purchasingPlan === 'premium' ? 's' : ''}
+
Quantity: 03
+
+
+
+
+
+
Premium Passport
+
30 days
+
+
Quantity: 05
@@ -31,18 +36,7 @@ export default function SecondStep({ price, gasfee, updateCounter, spInUsd, solI
Paying with
-
-
-
-
{purchasingPlan === 'premium' ? 'Premium' : 'Standard'} Passport
+
Monthly Premium Passport
+
{parseFloat(price).toFixed(4)} $SP
+
+
+
+
Yearly Premium Passport
{parseFloat(price).toFixed(4)} $SP
diff --git a/src/pages/Wallet/assets/recover-icon.svg b/src/pages/Wallet/assets/recover-icon.svg
new file mode 100644
index 0000000..06af69d
--- /dev/null
+++ b/src/pages/Wallet/assets/recover-icon.svg
@@ -0,0 +1,8 @@
+
diff --git a/src/pages/Wallet/index.css b/src/pages/Wallet/index.css
index dff9cfe..3a7367d 100644
--- a/src/pages/Wallet/index.css
+++ b/src/pages/Wallet/index.css
@@ -8,6 +8,7 @@
.cta-buttons > div {
display: flex;
flex-direction: column;
+ gap: 24px;
}
.cta-buttons > div > p {
@@ -16,7 +17,7 @@
color: #989899;
}
-.cta-buttons button.cta-button {
+.cta-buttons button {
width: 100%;
display: flex;
@@ -27,12 +28,6 @@
text-align: left;
font-size: 16px;
- background: linear-gradient(
- 0deg,
- rgba(0, 0, 0, 0.2) 0%,
- rgba(0, 0, 0, 0.2) 100%
- ),
- linear-gradient(93deg, #4e72b6 0%, #9fbfe5 100%);
border-radius: 8px;
cursor: pointer;
@@ -40,14 +35,12 @@
.cta-buttons div.highlight-1 button {
padding: 16px;
- background: rgba(159, 191, 229, 0.2);
+ background: rgba(159, 191, 229, 0.20);
justify-content: center;
- border-radius: 16px;
-
font-weight: bold;
- color: rgba(159, 191, 229, 1);
+ color: rgba(159, 191, 229, 1.00);
}
.cta-buttons div.highlight-1 button p {
@@ -55,15 +48,40 @@
}
.cta-buttons div.highlight-2 button {
- background: linear-gradient(
- 0deg,
- rgba(0, 0, 0, 0.2) 0%,
- rgba(0, 0, 0, 0.2) 100%
- ),
- linear-gradient(93deg, #4e72b6 0%, #9fbfe5 100%);
+ background: linear-gradient(0deg, rgba(0, 0, 0, 0.20) 0%, rgba(0, 0, 0, 0.20) 100%), linear-gradient(93deg, #4E72B6 0%, #9FBFE5 100%);
}
.cta-buttons button img {
width: 26px;
height: 26px;
}
+
+.wallet-heading {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+
+ margin-bottom: 32px;
+}
+
+.wallet-heading button {
+ gap: 8px;
+
+ cursor: pointer;
+}
+
+.wallet-heading button p {
+ color: #9FBFE5FE;
+ font-weight: 700;
+}
+
+.page-container .toggle-button {
+ position: absolute;
+ top: 16px;
+ right: 41%;
+
+ background: rgba(159, 191, 229, 1.00);;
+ color: black;
+ padding: 8px;
+ border-radius: 8px;
+}
\ No newline at end of file
diff --git a/src/pages/Wallet/index.tsx b/src/pages/Wallet/index.tsx
index 568c798..281314a 100644
--- a/src/pages/Wallet/index.tsx
+++ b/src/pages/Wallet/index.tsx
@@ -2,20 +2,28 @@ import { useNavigate } from 'react-router-dom';
import Footer from '../../components/Footer';
import './index.css';
import AccountList from '../../components/AccountList';
-import SpClub from '../../components/AccountList/SpClub';
-import ReferralProgram from '../../components/AccountList/ReferralProgram';
import RedeemPassport from '../../components/RedeemPassport';
+import { ReactComponent as RecoverIcon } from './assets/recover-icon.svg';
+import { useEffect } from 'react';
+
+import { useDaemonContext } from "../../providers/DaemonProvider";
export default function Wallet() {
+ const { profiles } = useDaemonContext();
const navigate = useNavigate();
return (
-
My Account
+
+
My Account
+ {/*
*/}
+
-
-
+
{/*
*/}
-
- {/*
-
-
-
*/}
-
+
diff --git a/src/providers/DaemonProvider.tsx b/src/providers/DaemonProvider.tsx
index 62d7d38..05ebf12 100644
--- a/src/providers/DaemonProvider.tsx
+++ b/src/providers/DaemonProvider.tsx
@@ -46,6 +46,10 @@ type DaemonContext = {
setIsLocalProxy: (val: boolean)=> void
globalProxy: boolean,
setGlobalProxy: (val: boolean)=> void
+ paymentKind: number,
+ setPaymentKind: (val: number) => void
+ successNFTID: number,
+ setSuccessNFTID: (val: number) => void
};
type DaemonProps = {
@@ -97,8 +101,11 @@ const defaultContextValue: DaemonContext = {
isLocalProxy: false,
setIsLocalProxy(val) {},
globalProxy: false,
- setGlobalProxy: () => {}
-
+ setGlobalProxy: () => {},
+ paymentKind: 0,
+ setPaymentKind: () => {},
+ successNFTID: 0,
+ setSuccessNFTID: () => {}
};
const Daemon = createContext
(defaultContextValue);
@@ -132,6 +139,8 @@ export function DaemonProvider({ children }: DaemonProps) {
const [randomSolanaRPC, setRandomSolanaRPC] = useState(null);
const [isIOS, setIsIOS] = useState(false);
const [isLocalProxy, setIsLocalProxy] = useState(false);
+ const [paymentKind, setPaymentKind] = useState(0)
+ const [successNFTID, setSuccessNFTID] = useState(0)
useEffect(() => {
{
@@ -149,7 +158,8 @@ export function DaemonProvider({ children }: DaemonProps) {
isPassportInfoPopupOpen, setIsPassportInfoPopupOpen, activePassportUpdated, setActivePassportUpdated,
activePassport, setActivePassport, isSelectPassportPopupOpen, setIsSelectPassportPopupOpen,
purchasingPlan, setPurchasingPlan, purchasingPlanPaymentTime, setPurchasingPlanPaymentTime,
- setRandomSolanaRPC, randomSolanaRPC, isIOS, setIsIOS, isLocalProxy, setIsLocalProxy, globalProxy, setGlobalProxy }}>,
+ setRandomSolanaRPC, randomSolanaRPC, isIOS, setIsIOS, isLocalProxy, setIsLocalProxy, globalProxy, setGlobalProxy,
+ paymentKind, setPaymentKind, successNFTID, setSuccessNFTID }}>,
{children}
diff --git a/src/services/wallets.ts b/src/services/wallets.ts
index db5b816..acf6bfa 100644
--- a/src/services/wallets.ts
+++ b/src/services/wallets.ts
@@ -13,6 +13,7 @@ import {
localDatabaseName,
rewardWalletAddress,
solanaRpc,
+ payment_endpoint
} from "../utils/constants";
import {} from './listeners'
import contracts from "../utils/contracts";
@@ -1246,6 +1247,7 @@ const waitingNFT = (wallet: ethers.Wallet) => new Promise(async resolve => {
}
}
}
+
conetDepinProvider.on('block', listenning)
const _time = setTimeout(() => {
// TimeOUT
@@ -1320,6 +1322,63 @@ const checkFreePassport = async () => {
return true
}
+const getPaymentUrl = async (price: number) => {
+ if (!CoNET_Data?.profiles?.length) {
+ return null;
+ }
+ const profile = CoNET_Data?.profiles[0]
+ const solanaWallet = CoNET_Data?.profiles[1].keyID
+ if (!solanaWallet||!profile) {
+ return null;
+ }
+
+ const url = `${payment_endpoint}payment_stripe`
+ const message = JSON.stringify({ walletAddress: profile.keyID, solanaWallet, price})
+ const wallet = new ethers.Wallet(profile.privateKeyArmor)
+ const signMessage = await wallet.signMessage(message)
+ const sendData = {
+ message, signMessage
+ }
+ const result = await postToEndpoint(url, true, sendData)
+ return result
+}
+
+const waitingPaymentStatus = async (): Promise => {
+ if (!CoNET_Data?.profiles?.length) {
+ return false;
+ }
+ const profile = CoNET_Data?.profiles[0]
+ const solanaWallet = CoNET_Data?.profiles[1].keyID
+ if (!solanaWallet||!profile) {
+ return false;
+ }
+
+ const url = `${payment_endpoint}payment_stripe_waiting`
+ const message = JSON.stringify({ walletAddress: profile.keyID})
+ const wallet = new ethers.Wallet(profile.privateKeyArmor)
+ const signMessage = await wallet.signMessage(message)
+ const sendData = {
+ message, signMessage
+ }
+
+ const waiting = async (): Promise => new Promise(async resolve => {
+ const result = await postToEndpoint(url, true, sendData)
+ if (!result || !result?.status) {
+ return resolve (false)
+ }
+ if (result.status < 100) {
+ return setTimeout(() => {
+ return waiting().then (jj => resolve(jj))
+ }, 10 * 1000)
+ }
+ return resolve(result.status)
+ })
+ const result = await waiting ()
+ return result
+}
+
+
+
export {
createOrGetWallet,
createGPGKey,
@@ -1340,5 +1399,7 @@ export {
getReceivedAmounts,
RealizationRedeem,
checkFreePassport,
- checkFreePassportProcess
+ checkFreePassportProcess,
+ getPaymentUrl,
+ waitingPaymentStatus
};
diff --git a/src/utils/abis.ts b/src/utils/abis.ts
index 061fce9..f6436c6 100644
--- a/src/utils/abis.ts
+++ b/src/utils/abis.ts
@@ -5002,4 +5002,187 @@ export const Distributor = [
"stateMutability": "nonpayable",
"type": "function"
}
+]
+export const PaymentPassport = [
+ {
+ "inputs": [],
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": false,
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "indexed": false,
+ "internalType": "uint256",
+ "name": "status",
+ "type": "uint256"
+ }
+ ],
+ "name": "paymentStatus",
+ "type": "event"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "status",
+ "type": "uint256"
+ }
+ ],
+ "name": "ChangePaymentStatus",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "adminList",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "internalType": "bool",
+ "name": "monthly",
+ "type": "bool"
+ },
+ {
+ "internalType": "string",
+ "name": "_payID",
+ "type": "string"
+ },
+ {
+ "internalType": "uint256",
+ "name": "totalNFT",
+ "type": "uint256"
+ }
+ ],
+ "name": "batchMintPassport",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "addr",
+ "type": "address"
+ },
+ {
+ "internalType": "bool",
+ "name": "status",
+ "type": "bool"
+ }
+ ],
+ "name": "changeAddressInAdminlist",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "name": "distributor",
+ "outputs": [
+ {
+ "internalType": "contract SPPassportDistributor",
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "string",
+ "name": "_payID",
+ "type": "string"
+ }
+ ],
+ "name": "getPayID",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "address",
+ "name": "to",
+ "type": "address"
+ },
+ {
+ "internalType": "uint256",
+ "name": "expiresDayes",
+ "type": "uint256"
+ },
+ {
+ "internalType": "string",
+ "name": "_payID",
+ "type": "string"
+ }
+ ],
+ "name": "mintPassport",
+ "outputs": [],
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [
+ {
+ "internalType": "bytes32",
+ "name": "",
+ "type": "bytes32"
+ }
+ ],
+ "name": "payID",
+ "outputs": [
+ {
+ "internalType": "bool",
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+ }
]
\ No newline at end of file
diff --git a/src/utils/constants.ts b/src/utils/constants.ts
index 001c6cd..6d235ef 100644
--- a/src/utils/constants.ts
+++ b/src/utils/constants.ts
@@ -3,7 +3,8 @@ import { ethers } from "ethers";
const localDatabaseName = "conet";
const apiv3_endpoint = `https://apiv3.conet.network/api/`;
const apiv4_endpoint = `https://apiv4.conet.network/api/`;
-const XMLHttpRequestTimeout = 30 * 1000;
+const payment_endpoint = `https://hooks.conet.network/api/`;
+const XMLHttpRequestTimeout = 90 * 1000;
const conetRpc = "https://cancun-rpc.conet.network";
const mainChain_rpc = "https://mainnet-rpc.conet.network";
const _ethRpc = [
@@ -15,6 +16,8 @@ const _ethRpc = [
const solanaRpc = "https://solana-rpc.conet.network";
const ethRpc = () => _ethRpc[Math.round(Math.random() * (_ethRpc.length - 1))];
const rewardWalletAddress = "GUq7PhyAUZko2mPhv3CupmdJKQ61LH8VyrdsRL25q7zg";
+const stripe_pay_monthly = 'https://buy.stripe.com/test_9AQ16b6Du82p0Ja9AG?client_reference_id='
+const stripe_pay_Annual ='https://buy.stripe.com/test_eVa2af5zqdmJ2Ri14b?client_reference_id='
const conetProvider = new ethers.JsonRpcProvider(conetRpc);
let ethProvider = new ethers.JsonRpcProvider(ethRpc());
@@ -34,5 +37,8 @@ export {
conetProvider,
ethProvider,
conetDepinProvider,
- changeRPC
+ changeRPC,
+ stripe_pay_monthly,
+ stripe_pay_Annual,
+ payment_endpoint
};
diff --git a/src/utils/contracts.ts b/src/utils/contracts.ts
index b077a3d..36e5676 100644
--- a/src/utils/contracts.ts
+++ b/src/utils/contracts.ts
@@ -6,6 +6,7 @@ import {
ConetStorageAbi,
PassportCancunAbi,
ConetDepinAbi,
+ PaymentPassport,
PassportMainnetAbi,
SpOracleAbi,
PurchasePassportAbi,
@@ -77,6 +78,11 @@ import {
abi: SpClubAbi,
network: "CONET DePIN",
},
+ PaymentPassport: {
+ address: '0xDa961275aAb40aCb1943D8969aB40efdA3719943',
+ network: "CONET DePIN",
+ abi: PaymentPassport
+ }
};
export default contracts;
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index f603226..e2b6ed5 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -76,7 +76,7 @@ export const initProfileTokens = () => {
return ret;
};
-export const postToEndpoint = (url: string, post: boolean, jsonData: any): Promise<""|boolean|{error: string}> => {
+export const postToEndpoint = (url: string, post: boolean, jsonData: any): Promise<""|boolean|any> => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.onload = () => {
@@ -111,18 +111,23 @@ export const postToEndpoint = (url: string, post: boolean, jsonData: any): Promi
return resolve(false);
};
- xhr.onerror = (err) => {
- console.log(`xhr.onerror`, err);
- clearTimeout(timeCount);
- return reject(err);
- };
-
- xhr.open(post ? "POST" : "GET", url, true);
-
- xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
-
- xhr.send(jsonData ? JSON.stringify(jsonData) : "");
-
+ // xhr.onerror = (err) => {
+ // console.log(`xhr.onerror`, err);
+ // clearTimeout(timeCount);
+ // return reject(err);
+ // }
+
+
+ xhr.onabort = ev => {
+ console.log(`ev`)
+ reject(ev)
+ }
+ xhr.onerror = err => {
+ reject (err)
+ }
+ xhr.open(post ? "POST" : "GET", url, true)
+ xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
+ xhr.send(jsonData ? JSON.stringify(jsonData) : "")
const timeCount = setTimeout(() => {
const Err = `Timeout!`;
console.log(`postToEndpoint ${url} Timeout Error`, Err);