mirror of
https://github.com/Qortal/qortal-mobile.git
synced 2025-03-31 01:35:54 +00:00
save new wallet
This commit is contained in:
parent
1b94584375
commit
3e261e6d05
25
src/App.tsx
25
src/App.tsx
@ -92,10 +92,12 @@ import {
|
|||||||
cleanUrl,
|
cleanUrl,
|
||||||
getFee,
|
getFee,
|
||||||
getProtocol,
|
getProtocol,
|
||||||
|
getWallets,
|
||||||
groupApi,
|
groupApi,
|
||||||
groupApiLocal,
|
groupApiLocal,
|
||||||
groupApiSocket,
|
groupApiSocket,
|
||||||
groupApiSocketLocal,
|
groupApiSocketLocal,
|
||||||
|
storeWallets,
|
||||||
} from "./background";
|
} from "./background";
|
||||||
import {
|
import {
|
||||||
executeEvent,
|
executeEvent,
|
||||||
@ -1096,6 +1098,26 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const saveWalletToLocalStorage = async (newWallet)=> {
|
||||||
|
try {
|
||||||
|
getWallets().then((res)=> {
|
||||||
|
|
||||||
|
if(res && Array.isArray(res)){
|
||||||
|
const wallets = [...res, newWallet]
|
||||||
|
storeWallets(wallets)
|
||||||
|
} else {
|
||||||
|
storeWallets([newWallet])
|
||||||
|
}
|
||||||
|
setIsLoading(false)
|
||||||
|
}).catch((error)=> {
|
||||||
|
console.error(error)
|
||||||
|
setIsLoading(false)
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const createAccountFunc = async () => {
|
const createAccountFunc = async () => {
|
||||||
try {
|
try {
|
||||||
if (!walletToBeDownloadedPassword) {
|
if (!walletToBeDownloadedPassword) {
|
||||||
@ -1131,6 +1153,7 @@ function App() {
|
|||||||
},120000)
|
},120000)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response && !response.error) {
|
if (response && !response.error) {
|
||||||
|
saveWalletToLocalStorage(wallet)
|
||||||
setRawWallet(wallet);
|
setRawWallet(wallet);
|
||||||
setWalletToBeDownloaded({
|
setWalletToBeDownloaded({
|
||||||
wallet,
|
wallet,
|
||||||
@ -2612,7 +2635,7 @@ function App() {
|
|||||||
fontSize: "12px",
|
fontSize: "12px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{"Using gateway"}
|
{"Using public node"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -702,7 +702,7 @@ export const decryptData = async (data) => {
|
|||||||
export const getListItems = async (data, isFromExtension) => {
|
export const getListItems = async (data, isFromExtension) => {
|
||||||
const isGateway = await isRunningGateway()
|
const isGateway = await isRunningGateway()
|
||||||
if(isGateway){
|
if(isGateway){
|
||||||
throw new Error('This action cannot be done through a gateway')
|
throw new Error('This action cannot be done through a public node')
|
||||||
}
|
}
|
||||||
const requiredFields = ["list_name"];
|
const requiredFields = ["list_name"];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -756,7 +756,7 @@ export const getListItems = async (data, isFromExtension) => {
|
|||||||
export const addListItems = async (data, isFromExtension) => {
|
export const addListItems = async (data, isFromExtension) => {
|
||||||
const isGateway = await isRunningGateway()
|
const isGateway = await isRunningGateway()
|
||||||
if(isGateway){
|
if(isGateway){
|
||||||
throw new Error('This action cannot be done through a gateway')
|
throw new Error('This action cannot be done through a public node')
|
||||||
}
|
}
|
||||||
const requiredFields = ["list_name", "items"];
|
const requiredFields = ["list_name", "items"];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -811,7 +811,7 @@ export const addListItems = async (data, isFromExtension) => {
|
|||||||
export const deleteListItems = async (data, isFromExtension) => {
|
export const deleteListItems = async (data, isFromExtension) => {
|
||||||
const isGateway = await isRunningGateway()
|
const isGateway = await isRunningGateway()
|
||||||
if(isGateway){
|
if(isGateway){
|
||||||
throw new Error('This action cannot be done through a gateway')
|
throw new Error('This action cannot be done through a public node')
|
||||||
}
|
}
|
||||||
const requiredFields = ["list_name"];
|
const requiredFields = ["list_name"];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -2041,7 +2041,7 @@ export const getWalletBalance = async (data, bypassPermission?: boolean, isFromE
|
|||||||
const getPirateWallet = async (arrrSeed58)=> {
|
const getPirateWallet = async (arrrSeed58)=> {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("Retrieving PIRATECHAIN balance is not allowed through a gateway.");
|
throw new Error("Retrieving PIRATECHAIN balance is not allowed through a public node.");
|
||||||
}
|
}
|
||||||
await checkArrrSyncStatus(arrrSeed58)
|
await checkArrrSyncStatus(arrrSeed58)
|
||||||
|
|
||||||
@ -2328,7 +2328,7 @@ export const getTxActivitySummary = async (data) => {
|
|||||||
export const updateForeignFee = async (data) => {
|
export const updateForeignFee = async (data) => {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
const requiredFields = ['coin', 'type', 'value'];
|
const requiredFields = ['coin', 'type', 'value'];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -2427,7 +2427,7 @@ export const getTxActivitySummary = async (data) => {
|
|||||||
export const setCurrentForeignServer = async (data) => {
|
export const setCurrentForeignServer = async (data) => {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
const requiredFields = ['coin'];
|
const requiredFields = ['coin'];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -2488,7 +2488,7 @@ export const getTxActivitySummary = async (data) => {
|
|||||||
export const addForeignServer = async (data) => {
|
export const addForeignServer = async (data) => {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
const requiredFields = ['coin'];
|
const requiredFields = ['coin'];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -2548,7 +2548,7 @@ export const getTxActivitySummary = async (data) => {
|
|||||||
export const removeForeignServer = async (data) => {
|
export const removeForeignServer = async (data) => {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
const requiredFields = ['coin'];
|
const requiredFields = ['coin'];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
@ -3112,7 +3112,7 @@ const crosschainAtInfo = await Promise.all(atPromises);
|
|||||||
}, 0)
|
}, 0)
|
||||||
)}
|
)}
|
||||||
${` ${crosschainAtInfo?.[0]?.foreignBlockchain}`}`,
|
${` ${crosschainAtInfo?.[0]?.foreignBlockchain}`}`,
|
||||||
highlightedText: `Is using gateway: ${isGateway}`,
|
highlightedText: `Is using public node: ${isGateway}`,
|
||||||
fee: '',
|
fee: '',
|
||||||
foreignFee: `${sellerForeignFee[foreignBlockchain].value} ${sellerForeignFee[foreignBlockchain].ticker}`
|
foreignFee: `${sellerForeignFee[foreignBlockchain].value} ${sellerForeignFee[foreignBlockchain].ticker}`
|
||||||
}, isFromExtension);
|
}, isFromExtension);
|
||||||
@ -3409,7 +3409,7 @@ export const adminAction = async (data, isFromExtension) => {
|
|||||||
}
|
}
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
|
|
||||||
let apiEndpoint = "";
|
let apiEndpoint = "";
|
||||||
@ -3713,7 +3713,7 @@ export const createAndCopyEmbedLink = async (data, isFromExtension) => {
|
|||||||
export const getHostedData = async (data, isFromExtension) => {
|
export const getHostedData = async (data, isFromExtension) => {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
@ -3749,7 +3749,7 @@ export const getHostedData = async (data, isFromExtension) => {
|
|||||||
export const deleteHostedData = async (data, isFromExtension) => {
|
export const deleteHostedData = async (data, isFromExtension) => {
|
||||||
const isGateway = await isRunningGateway();
|
const isGateway = await isRunningGateway();
|
||||||
if (isGateway) {
|
if (isGateway) {
|
||||||
throw new Error("This action cannot be done through a gateway");
|
throw new Error("This action cannot be done through a public node");
|
||||||
}
|
}
|
||||||
const requiredFields = ["hostedData"];
|
const requiredFields = ["hostedData"];
|
||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user