Bug fixes
This commit is contained in:
parent
b6d97322fd
commit
6b9623ada2
19
css/main.css
19
css/main.css
@ -813,13 +813,15 @@ h3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#verification_list {
|
#verification_list {
|
||||||
display: grid;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.verification-item {
|
.verification-item {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 6rem 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
|
grid-template-areas: "time status" "doc-info doc-info";
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
@ -828,9 +830,16 @@ h3 {
|
|||||||
background-color: rgba(var(--foreground-color), 1);
|
background-color: rgba(var(--foreground-color), 1);
|
||||||
}
|
}
|
||||||
.verification-item time {
|
.verification-item time {
|
||||||
|
grid-area: time;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
color: rgba(var(--text-color), 0.8);
|
color: rgba(var(--text-color), 0.8);
|
||||||
}
|
}
|
||||||
|
.verification-item :nth-child(2) {
|
||||||
|
grid-area: doc-info;
|
||||||
|
}
|
||||||
|
.verification-item :nth-child(3) {
|
||||||
|
grid-area: status;
|
||||||
|
}
|
||||||
|
|
||||||
#verifier_wrapper > * {
|
#verifier_wrapper > * {
|
||||||
background-color: rgba(var(--foreground-color), 1);
|
background-color: rgba(var(--foreground-color), 1);
|
||||||
@ -879,6 +888,7 @@ h3 {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
.revoke-card input {
|
.revoke-card input {
|
||||||
accent-color: var(--accent-color);
|
accent-color: var(--accent-color);
|
||||||
@ -900,6 +910,7 @@ h3 {
|
|||||||
#view_file_popup img {
|
#view_file_popup img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#commit_approvals {
|
#commit_approvals {
|
||||||
@ -999,6 +1010,10 @@ h3 {
|
|||||||
#approve_verifier_popup {
|
#approve_verifier_popup {
|
||||||
--width: min(32rem, 100%);
|
--width: min(32rem, 100%);
|
||||||
}
|
}
|
||||||
|
.verification-item {
|
||||||
|
grid-template-columns: 6rem 1fr auto;
|
||||||
|
grid-template-areas: "time doc-info status";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (any-hover: hover) {
|
@media (any-hover: hover) {
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -775,12 +775,14 @@ h3 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#verification_list {
|
#verification_list {
|
||||||
display: grid;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
}
|
}
|
||||||
.verification-item {
|
.verification-item {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 6rem 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
|
grid-template-areas: "time status" "doc-info doc-info";
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
@ -788,9 +790,16 @@ h3 {
|
|||||||
border-radius: 0.5rem;
|
border-radius: 0.5rem;
|
||||||
background-color: rgba(var(--foreground-color), 1);
|
background-color: rgba(var(--foreground-color), 1);
|
||||||
time {
|
time {
|
||||||
|
grid-area: time;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
color: rgba(var(--text-color), 0.8);
|
color: rgba(var(--text-color), 0.8);
|
||||||
}
|
}
|
||||||
|
:nth-child(2) {
|
||||||
|
grid-area: doc-info;
|
||||||
|
}
|
||||||
|
:nth-child(3) {
|
||||||
|
grid-area: status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#verifier_wrapper {
|
#verifier_wrapper {
|
||||||
& > * {
|
& > * {
|
||||||
@ -837,6 +846,7 @@ h3 {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
input {
|
input {
|
||||||
accent-color: var(--accent-color);
|
accent-color: var(--accent-color);
|
||||||
@ -859,6 +869,7 @@ h3 {
|
|||||||
img {
|
img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
margin: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#commit_approvals {
|
#commit_approvals {
|
||||||
@ -947,6 +958,10 @@ h3 {
|
|||||||
#approve_verifier_popup {
|
#approve_verifier_popup {
|
||||||
--width: min(32rem, 100%);
|
--width: min(32rem, 100%);
|
||||||
}
|
}
|
||||||
|
.verification-item {
|
||||||
|
grid-template-columns: 6rem 1fr auto;
|
||||||
|
grid-template-areas: "time doc-info status";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@media (any-hover: hover) {
|
@media (any-hover: hover) {
|
||||||
::-webkit-scrollbar {
|
::-webkit-scrollbar {
|
||||||
|
|||||||
169
index.html
169
index.html
@ -15,10 +15,9 @@
|
|||||||
/* Constants for FLO blockchain operations !!Make sure to add this at beginning!! */
|
/* Constants for FLO blockchain operations !!Make sure to add this at beginning!! */
|
||||||
const floGlobals = {
|
const floGlobals = {
|
||||||
blockchain: "FLO",
|
blockchain: "FLO",
|
||||||
adminID: "FKAEdnPfjXLHSYwrXQu377ugN4tXU7VGdf",
|
adminID: "FJ4KcVQ6HeHZ54DjrtE3rUYmYjV3FHhXSM",
|
||||||
application: "TEST_MODE",
|
application: "KYC_Docs",
|
||||||
SNStorageID: "FSF5igBd9xC7ZBB511DZG8PVB2eT93YE3M",
|
SNStorageID: "FSF5igBd9xC7ZBB511DZG8PVB2eT93YE3M"
|
||||||
masterAddress: 'FRSUrLuy5nhz6PCyuxMmo7vg9JmTFX5Goi'
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
@ -149,7 +148,7 @@
|
|||||||
<script src="scripts/compactIDB.js"></script>
|
<script src="scripts/compactIDB.js"></script>
|
||||||
<script src="scripts/floCloudAPI.js"></script>
|
<script src="scripts/floCloudAPI.js"></script>
|
||||||
<script src="scripts/floDapps.js"></script>
|
<script src="scripts/floDapps.js"></script>
|
||||||
<script src="scripts/main.js"></script>
|
<!-- <script src="scripts/main.js"></script> -->
|
||||||
<script>
|
<script>
|
||||||
const { html, render: renderElem } = uhtml;
|
const { html, render: renderElem } = uhtml;
|
||||||
// Use instead of document.getElementById
|
// Use instead of document.getElementById
|
||||||
@ -500,6 +499,7 @@
|
|||||||
`);
|
`);
|
||||||
if (!floGlobals.isPrivKeySecured)
|
if (!floGlobals.isPrivKeySecured)
|
||||||
getRef('private_key_field').customValidation = floCrypto.getPubKeyHex;
|
getRef('private_key_field').customValidation = floCrypto.getPubKeyHex;
|
||||||
|
getRef('private_key_field').focusIn();
|
||||||
})
|
})
|
||||||
function handleSignUp() {
|
function handleSignUp() {
|
||||||
const privKey = getRef('generated_private_key').value.trim();
|
const privKey = getRef('generated_private_key').value.trim();
|
||||||
@ -619,9 +619,11 @@
|
|||||||
})
|
})
|
||||||
const kycRequests = getUserKycRequests(floAddress);
|
const kycRequests = getUserKycRequests(floAddress);
|
||||||
const verifiedRequest = Object.values(kycRequests).find(request => {
|
const verifiedRequest = Object.values(kycRequests).find(request => {
|
||||||
const wasSentByAddress = request.senderID === floAddress || request.senderID === btcAddress
|
const { senderID, tag_key, tag } = request;
|
||||||
const isApproved = request.tag?.includes('approved')
|
const wasSentByAddress = senderID === floAddress || senderID === btcAddress
|
||||||
return wasSentByAddress && isApproved
|
const isApproved = tag?.includes('approved')
|
||||||
|
const isApprovedByValidVerifier = floGlobals.subAdmins.some(subAdmin => floCrypto.isSameAddr(subAdmin, floCrypto.getFloID(tag_key)))
|
||||||
|
return wasSentByAddress && isApproved && isApprovedByValidVerifier
|
||||||
});
|
});
|
||||||
if (verifiedRequest) {
|
if (verifiedRequest) {
|
||||||
const { tag_key, tag_time } = verifiedRequest;
|
const { tag_key, tag_time } = verifiedRequest;
|
||||||
@ -660,7 +662,10 @@
|
|||||||
<div class="grid justify-items-center text-center gap-0-5" style="margin: 2rem">
|
<div class="grid justify-items-center text-center gap-0-5" style="margin: 2rem">
|
||||||
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/></svg>
|
<svg class="icon" xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><path d="M0 0h24v24H0z" fill="none"/><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/></svg>
|
||||||
<h4>KYC data not found</h4>
|
<h4>KYC data not found</h4>
|
||||||
<a class="button button--primary" href="#/sign_in">Sign in to apply for KYC</a>
|
${myFloID ?
|
||||||
|
html`<a class="button button--primary" href="#/home">Start KYC process</a>` :
|
||||||
|
html`<a class="button button--primary" href="#/sign_in">Sign in to apply for KYC</a>`
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
getRef('verification_result').dataset.status = 'invalid';
|
getRef('verification_result').dataset.status = 'invalid';
|
||||||
@ -702,19 +707,9 @@
|
|||||||
`
|
`
|
||||||
},
|
},
|
||||||
pendingKycRequest(request) {
|
pendingKycRequest(request) {
|
||||||
const { senderID, time, files } = request;
|
const { message: { docType, docVectorClock }, vectorClock, senderID, time, } = request;
|
||||||
const floAddress = getFloAddress(senderID)
|
const floAddress = getFloAddress(senderID)
|
||||||
const btcAddress = getBtcAddress(floAddress)
|
const btcAddress = getBtcAddress(floAddress)
|
||||||
const fileButtons = files.map(file => {
|
|
||||||
const { message: { docType, docVectorClock }, vectorClock } = file;
|
|
||||||
return html`
|
|
||||||
<div class="multi-state-button">
|
|
||||||
<button class="button button--primary" .dataset=${{ requestVC: vectorClock, docVC: docVectorClock }} onclick=${viewFile}>
|
|
||||||
Check ${docTypeNames[docType]}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
return html`
|
return html`
|
||||||
<li class="kyc-request">
|
<li class="kyc-request">
|
||||||
<time>${getFormattedTime(time)}</time>
|
<time>${getFormattedTime(time)}</time>
|
||||||
@ -726,38 +721,36 @@
|
|||||||
<p>FLO Address</p>
|
<p>FLO Address</p>
|
||||||
<sm-copy value=${floAddress}></sm-copy>
|
<sm-copy value=${floAddress}></sm-copy>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-1 flex-wrap">${fileButtons}</div>
|
<div class="multi-state-button margin-right-auto">
|
||||||
|
<button class="button button--primary" .dataset=${{ requestVC: vectorClock, docVC: docVectorClock }} onclick=${viewFile}>
|
||||||
|
Check ${docTypeNames[docType]}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</li>`
|
</li>`
|
||||||
},
|
},
|
||||||
approvedKycRequest(request) {
|
approvedKycRequest(request) {
|
||||||
const { senderID, time, files, tag } = request;
|
const { message: { docType, docVectorClock }, vectorClock, senderID, time, } = request;
|
||||||
const floAddress = getFloAddress(senderID)
|
const floAddress = getFloAddress(senderID)
|
||||||
const btcAddress = getBtcAddress(floAddress)
|
const btcAddress = getBtcAddress(floAddress)
|
||||||
const fileButtons = files.map(file => {
|
|
||||||
const { message: { docType, docVectorClock }, vectorClock, tag } = file;
|
|
||||||
return html`
|
|
||||||
<div class="multi-state-button">
|
|
||||||
<button class="button button--primary" .dataset=${{ requestVC: vectorClock, docVC: docVectorClock }} onclick=${viewFile}>
|
|
||||||
View ${docTypeNames[docType]}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
return html`
|
return html`
|
||||||
<li class="revoke-card">
|
<li class="revoke-card">
|
||||||
<label class="flex align-center">
|
<label class="flex align-center">
|
||||||
<input type="checkbox" value=${floAddress}/>
|
<input type="checkbox" value=${floAddress} .dataset=${{ requestVC: vectorClock, docVC: docVectorClock }}/>
|
||||||
<div class="grid gap-0-3">
|
<div class="grid gap-0-3">
|
||||||
<span class="wrap-around">BTC: ${btcAddress}</span>
|
<span class="wrap-around">BTC: ${btcAddress}</span>
|
||||||
<span class="wrap-around">FLO: ${floAddress}</span>
|
<span class="wrap-around">FLO: ${floAddress}</span>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<div class="flex gap-1 flex-wrap">${fileButtons}</div>
|
<div class="multi-state-button margin-right-auto">
|
||||||
|
<button class="button button--primary" .dataset=${{ requestVC: vectorClock, docVC: docVectorClock }} onclick=${viewFile}>
|
||||||
|
View ${docTypeNames[docType]}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
rejectedKycRequest(request) {
|
rejectedKycRequest(request) {
|
||||||
const { senderID, time, files } = request;
|
const { message: { docType, docVectorClock }, vectorClock, senderID, time, } = request;
|
||||||
const floAddress = getFloAddress(senderID)
|
const floAddress = getFloAddress(senderID)
|
||||||
const btcAddress = getBtcAddress(floAddress)
|
const btcAddress = getBtcAddress(floAddress)
|
||||||
return html`
|
return html`
|
||||||
@ -784,24 +777,9 @@
|
|||||||
kycRequests(options = {}) {
|
kycRequests(options = {}) {
|
||||||
const { status = 'pending', address } = options;
|
const { status = 'pending', address } = options;
|
||||||
const kycRequests = floDapps.getNextGeneralData('userKycRequests', '0');
|
const kycRequests = floDapps.getNextGeneralData('userKycRequests', '0');
|
||||||
const filteredRequests = {};
|
const filteredRequests = [];
|
||||||
// group requests by senderID
|
Object.values(kycRequests).forEach((request) => {
|
||||||
for (const [key, request] of Object.entries(kycRequests)) {
|
const { time, tag, note, senderID } = request;
|
||||||
const { message, senderID, time, tag, vectorClock, note } = request;
|
|
||||||
const floAddress = getFloAddress(senderID)
|
|
||||||
if (!filteredRequests[floAddress]) {
|
|
||||||
filteredRequests[floAddress] = {
|
|
||||||
time,
|
|
||||||
tag: tag?.includes('approved') ? 'approved' : tag,
|
|
||||||
files: [],
|
|
||||||
note
|
|
||||||
};
|
|
||||||
}
|
|
||||||
filteredRequests[floAddress].files.push({ message, vectorClock, tag });
|
|
||||||
}
|
|
||||||
const result = []
|
|
||||||
Object.entries(filteredRequests).forEach(([senderID, request]) => {
|
|
||||||
const { time, tag, files, note } = request;
|
|
||||||
const floAddress = getFloAddress(senderID)
|
const floAddress = getFloAddress(senderID)
|
||||||
if (status) {
|
if (status) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -820,16 +798,16 @@
|
|||||||
const query = address.toLowerCase();
|
const query = address.toLowerCase();
|
||||||
if (!floAddress.toLowerCase().includes(query) && !getBtcAddress(floAddress).toLowerCase().includes(query)) return;
|
if (!floAddress.toLowerCase().includes(query) && !getBtcAddress(floAddress).toLowerCase().includes(query)) return;
|
||||||
}
|
}
|
||||||
switch (tag || note) {
|
switch (tag?.split('|')[0] || note) {
|
||||||
case 'approved':
|
case 'approved':
|
||||||
return result.push(render.approvedKycRequest({ senderID: floAddress, time, tag, files }));
|
return filteredRequests.push(render.approvedKycRequest(request));
|
||||||
case 'rejected':
|
case 'rejected':
|
||||||
return result.push(render.rejectedKycRequest({ senderID: floAddress, time, tag, files }));
|
return filteredRequests.push(render.rejectedKycRequest(request));
|
||||||
default:
|
default:
|
||||||
return result.push(render.pendingKycRequest({ senderID: floAddress, time, tag, files }));
|
return filteredRequests.push(render.pendingKycRequest(request));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return result.reverse();
|
return filteredRequests.reverse();
|
||||||
},
|
},
|
||||||
userRequests() {
|
userRequests() {
|
||||||
let isVerified = false;
|
let isVerified = false;
|
||||||
@ -837,24 +815,32 @@
|
|||||||
const requests = getUserKycRequests();
|
const requests = getUserKycRequests();
|
||||||
let hasUploaded = {}
|
let hasUploaded = {}
|
||||||
const renderedRequests = Object.keys(requests).map((key) => {
|
const renderedRequests = Object.keys(requests).map((key) => {
|
||||||
const { time, tag, message: { docType } } = requests[key];
|
const { time, tag, message: { docType }, note } = requests[key];
|
||||||
|
const txId = tag?.split('|')[1] || undefined;
|
||||||
if (!isVerified && tag?.includes('approved'))
|
if (!isVerified && tag?.includes('approved'))
|
||||||
isVerified = true;
|
isVerified = true;
|
||||||
if (!tag) {
|
if (!tag && !note) {
|
||||||
concurrentRequests++;
|
concurrentRequests++;
|
||||||
hasUploaded[docType] = true;
|
hasUploaded[docType] = true;
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<li class="verification-item">
|
<li class="verification-item">
|
||||||
<time>${getFormattedTime(time)}</time>
|
<time>${getFormattedTime(time)}</time>
|
||||||
<h4>${docTypeNames[docType]}</h4>
|
<div class="flex flex-direction-column gap-0-5">
|
||||||
|
<h4>${docTypeNames[docType]}</h4>
|
||||||
|
${txId ? html`
|
||||||
|
<a href=${`https://blockbook.ranchimall.net/tx/${txId}`} target="_blank">
|
||||||
|
Check on blockchain
|
||||||
|
</a>
|
||||||
|
`: ''}
|
||||||
|
</div>
|
||||||
${isVerified ? html`
|
${isVerified ? html`
|
||||||
<div class="flex gap-0-3 align-center">
|
<div class="flex gap-0-3 align-center">
|
||||||
<svg class="icon"style="fill: var(--green)" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M23,12l-2.44-2.79l0.34-3.69l-3.61-0.82L15.4,1.5L12,2.96L8.6,1.5L6.71,4.69L3.1,5.5L3.44,9.2L1,12l2.44,2.79l-0.34,3.7 l3.61,0.82L8.6,22.5l3.4-1.47l3.4,1.46l1.89-3.19l3.61-0.82l-0.34-3.69L23,12z M10.09,16.72l-3.8-3.81l1.48-1.48l2.32,2.33 l5.85-5.87l1.48,1.48L10.09,16.72z"/></g></svg>
|
<svg class="icon"style="fill: var(--green)" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#000000"><g><rect fill="none" height="24" width="24"/></g><g><path d="M23,12l-2.44-2.79l0.34-3.69l-3.61-0.82L15.4,1.5L12,2.96L8.6,1.5L6.71,4.69L3.1,5.5L3.44,9.2L1,12l2.44,2.79l-0.34,3.7 l3.61,0.82L8.6,22.5l3.4-1.47l3.4,1.46l1.89-3.19l3.61-0.82l-0.34-3.69L23,12z M10.09,16.72l-3.8-3.81l1.48-1.48l2.32,2.33 l5.85-5.87l1.48,1.48L10.09,16.72z"/></g></svg>
|
||||||
<b>Verified</b>
|
<b>Verified</b>
|
||||||
</div>
|
</div>
|
||||||
`: html`
|
`: html`
|
||||||
<p>Status: <b>${tag || 'Processing'}</b></p>
|
<p>Status: <b>${tag || note || 'Processing'}</b></p>
|
||||||
`}
|
`}
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
@ -895,9 +881,8 @@
|
|||||||
<h3>KYC requests</h3>
|
<h3>KYC requests</h3>
|
||||||
<sm-chips id="kyc_request_filter" onchange=${handleRequestFilter}>
|
<sm-chips id="kyc_request_filter" onchange=${handleRequestFilter}>
|
||||||
<sm-chip value="pending" ?selected=${filter === "pending"}>Pending</sm-chip>
|
<sm-chip value="pending" ?selected=${filter === "pending"}>Pending</sm-chip>
|
||||||
<sm-chip value="rejected" ?selected=${filter === "rejected"}>Rejected</sm-chip>
|
|
||||||
<sm-chip value="approved" ?selected=${filter === "approved"}>Approved</sm-chip>
|
<sm-chip value="approved" ?selected=${filter === "approved"}>Approved</sm-chip>
|
||||||
<sm-chip value="all" ?selected=${filter === "all"}>All</sm-chip>
|
<sm-chip value="rejected" ?selected=${filter === "rejected"}>Rejected</sm-chip>
|
||||||
</sm-chips>
|
</sm-chips>
|
||||||
</div>
|
</div>
|
||||||
<sm-input id="search_approved" type="search" placeholder="Search address" oninput=${handleRequestSearch}>
|
<sm-input id="search_approved" type="search" placeholder="Search address" oninput=${handleRequestSearch}>
|
||||||
@ -912,7 +897,7 @@
|
|||||||
<button id="revoke_kyc_button" class="button button--primary" onclick=${revokeKycs}>Revoke selected</button>
|
<button id="revoke_kyc_button" class="button button--primary" onclick=${revokeKycs}>Revoke selected</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
${filter === "approved" ? html`
|
${filter === "approved" && renderedKycRequests?.length ? html`
|
||||||
<p>Select KYC verification to revoke</p>
|
<p>Select KYC verification to revoke</p>
|
||||||
`: ''}
|
`: ''}
|
||||||
<ul id="kyc_requests_list" class="flex flex-direction-column gap-0-5" onchange=${handleAddressSelection}>
|
<ul id="kyc_requests_list" class="flex flex-direction-column gap-0-5" onchange=${handleAddressSelection}>
|
||||||
@ -938,7 +923,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul id="approved_verifiers_list" onchange=${handleVerifierSelection}>
|
<ul id="approved_verifiers_list" onchange=${handleVerifierSelection}>
|
||||||
${renderedSubAdmins}
|
${renderedSubAdmins.length ? renderedSubAdmins : html`<li style="padding: 1rem 0;">No KYC verifiers found</li>`}
|
||||||
</ul>
|
</ul>
|
||||||
<div class="multi-state-button margin-right-auto">
|
<div class="multi-state-button margin-right-auto">
|
||||||
<button id="add_sub_admin_button" class="button button--small button--colored" onclick=${() => openPopup('approve_verifier_popup')}>
|
<button id="add_sub_admin_button" class="button button--small button--colored" onclick=${() => openPopup('approve_verifier_popup')}>
|
||||||
@ -1019,7 +1004,7 @@
|
|||||||
</section>
|
</section>
|
||||||
`;
|
`;
|
||||||
const tooManyRequestsSection = html`
|
const tooManyRequestsSection = html`
|
||||||
<section class="flex flex-direction-column gap-1 card justify-center">
|
<section class="flex flex-direction-column gap-1 card justify-items-center">
|
||||||
<h2 class="text-center">Request limit reached</h2>
|
<h2 class="text-center">Request limit reached</h2>
|
||||||
<p class="text-center">You have reached KYC verification request limit. Wait until your previous requests are processed.</p>
|
<p class="text-center">You have reached KYC verification request limit. Wait until your previous requests are processed.</p>
|
||||||
</section>
|
</section>
|
||||||
@ -1039,7 +1024,7 @@
|
|||||||
</section>
|
</section>
|
||||||
`: ''}
|
`: ''}
|
||||||
` : html`
|
` : html`
|
||||||
<section class="flex flex-direction-column gap-1 card justify-center">
|
<section class="flex flex-direction-column gap-1 card justify-items-center">
|
||||||
<h2 class="text-center">No KYC verifiers found</h2>
|
<h2 class="text-center">No KYC verifiers found</h2>
|
||||||
<p class="text-center">No KYC verifiers are available at the moment. Please try again later.</p>
|
<p class="text-center">No KYC verifiers are available at the moment. Please try again later.</p>
|
||||||
</section>
|
</section>
|
||||||
@ -1295,14 +1280,14 @@
|
|||||||
const addressesToRevoke = new Map()
|
const addressesToRevoke = new Map()
|
||||||
function handleAddressSelection(e) {
|
function handleAddressSelection(e) {
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
const floData = `KYC|REVOKE_KYC|${[...addressesToRevoke.keys()].join(',')}`
|
|
||||||
if (floData.length > 1040) {
|
|
||||||
return notify('Maximum limit reached for this batch. Revoke selected and continue the process.', 'error')
|
|
||||||
}
|
|
||||||
addressesToRevoke.set(e.target.value, {
|
addressesToRevoke.set(e.target.value, {
|
||||||
requestVC: e.target.dataset.requestVC,
|
requestVC: e.target.dataset.requestVC,
|
||||||
docVC: e.target.dataset.docVC,
|
docVC: e.target.dataset.docVC,
|
||||||
})
|
})
|
||||||
|
const floData = `KYC|REVOKE_KYC|${[...addressesToRevoke.keys()].join(',')}`
|
||||||
|
if (floData.length > 1040) {
|
||||||
|
return notify('Maximum limit reached for this batch. Revoke selected and continue the process.', 'error')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
addressesToRevoke.delete(e.target.value)
|
addressesToRevoke.delete(e.target.value)
|
||||||
}
|
}
|
||||||
@ -1387,7 +1372,9 @@
|
|||||||
renderElem(getRef('commit_approvals_popup__content'), html`
|
renderElem(getRef('commit_approvals_popup__content'), html`
|
||||||
<div class="flex gap-1 align-center space-between">
|
<div class="flex gap-1 align-center space-between">
|
||||||
<h4>KYCs to commit</h4>
|
<h4>KYCs to commit</h4>
|
||||||
<button class="button button--primary" onclick=${commitApprovals}>Commit</button>
|
<div class="multi-state-button">
|
||||||
|
<button id="approve_kyc_button" class="button button--primary" onclick=${commitApprovals}>Commit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul class="grid gap-1-5">
|
<ul class="grid gap-1-5">
|
||||||
${approvedAddress}
|
${approvedAddress}
|
||||||
@ -1412,14 +1399,14 @@
|
|||||||
const addresses = [...floGlobals.approvalsToBeCommitted.keys()]
|
const addresses = [...floGlobals.approvalsToBeCommitted.keys()]
|
||||||
// create multiple txs if addresses exceed 1040 characters
|
// create multiple txs if addresses exceed 1040 characters
|
||||||
const addressesPerTx = 30
|
const addressesPerTx = 30
|
||||||
const chunks = Math.ceil(addresses.size / addressesPerTx)
|
const chunks = Math.ceil(addresses.length / addressesPerTx)
|
||||||
let txPromises = []
|
let txPromises = []
|
||||||
for (let i = 0; i < chunks; i++) {
|
for (let i = 0; i < chunks; i++) {
|
||||||
const chunk = addresses.slice(i * addressesPerTx, (i + 1) * addressesPerTx)
|
const chunk = addresses.slice(i * addressesPerTx, (i + 1) * addressesPerTx)
|
||||||
const floData = `KYC|APPROVE_KYC|${chunk.join('+')}`
|
const floData = `KYC|APPROVE_KYC|${chunk.join('+')}`
|
||||||
txPromises.push(floBlockchainAPI.writeData(floGlobals.myFloID, floData, approverPrivateKey, floGlobals.myFloID))
|
txPromises.push(floBlockchainAPI.writeData(floGlobals.myFloID, floData, approverPrivateKey, floGlobals.myFloID))
|
||||||
}
|
}
|
||||||
buttonLoader(getRef('submit_kyc'), true)
|
buttonLoader(getRef('approve_kyc_button'), true)
|
||||||
try {
|
try {
|
||||||
const txIds = await Promise.all(txPromises)
|
const txIds = await Promise.all(txPromises)
|
||||||
const cloudPromises = [...floGlobals.approvalsToBeCommitted.values()].flatMap(({ requestVC, docVC }) => {
|
const cloudPromises = [...floGlobals.approvalsToBeCommitted.values()].flatMap(({ requestVC, docVC }) => {
|
||||||
@ -1429,6 +1416,7 @@
|
|||||||
floCloudAPI.tagApplicationData(docVC, `approved|${txIds.join('+')}`)
|
floCloudAPI.tagApplicationData(docVC, `approved|${txIds.join('+')}`)
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
await Promise.all(cloudPromises)
|
||||||
console.log(`Approval request submitted. TXIDs: ${txIds.join(', ')}`)
|
console.log(`Approval request submitted. TXIDs: ${txIds.join(', ')}`)
|
||||||
notify('Users approved successfully', 'success');
|
notify('Users approved successfully', 'success');
|
||||||
floGlobals.approvalsToBeCommitted.clear()
|
floGlobals.approvalsToBeCommitted.clear()
|
||||||
@ -1439,7 +1427,7 @@
|
|||||||
console.error(err)
|
console.error(err)
|
||||||
notify('Error approving users', 'error');
|
notify('Error approving users', 'error');
|
||||||
} finally {
|
} finally {
|
||||||
buttonLoader(getRef('submit_kyc'), false)
|
buttonLoader(getRef('approve_kyc_button'), false)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
checkBalance()
|
checkBalance()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
@ -1464,11 +1452,11 @@
|
|||||||
})
|
})
|
||||||
if (!confirmation) return
|
if (!confirmation) return
|
||||||
buttonLoader(getRef('revoke_kyc_button'), true)
|
buttonLoader(getRef('revoke_kyc_button'), true)
|
||||||
const cloudPromises = [...addressesToRevoke.keys()].flatMap((address, { requestVC, docVC }) => {
|
const cloudPromises = [...addressesToRevoke.values()].flatMap(({ requestVC, docVC }) => {
|
||||||
floGlobals.generalData[floCloudAPI.util.filterKey('userKycRequests')][requestVC].tag = 'revoked'
|
floGlobals.generalData[floCloudAPI.util.filterKey('userKycRequests')][requestVC].tag = 'revoked'
|
||||||
return [
|
return [
|
||||||
floCloudAPI.tagApplicationData(requestVC, 'revoked'),
|
floCloudAPI.tagApplicationData(requestVC, 'revoked'),
|
||||||
floCloudAPI.tagApplicationData(docVC, undefined)
|
floCloudAPI.tagApplicationData(docVC, 'revoked')
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
const [txId, ...cloudResponses] = await Promise.all([
|
const [txId, ...cloudResponses] = await Promise.all([
|
||||||
@ -1478,7 +1466,6 @@
|
|||||||
notify(`Revoke request submitted. TXID: ${txId}`, 'success');
|
notify(`Revoke request submitted. TXID: ${txId}`, 'success');
|
||||||
addressesToRevoke.clear()
|
addressesToRevoke.clear()
|
||||||
clearSelection()
|
clearSelection()
|
||||||
renderHome()
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
notify(e, 'error')
|
notify(e, 'error')
|
||||||
} finally {
|
} finally {
|
||||||
@ -1486,7 +1473,10 @@
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
checkBalance()
|
checkBalance()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
getRef('selected_addresses').textContent = ``
|
||||||
|
getRef('selected_wrapper').classList.add('hidden')
|
||||||
|
getRef('kyc_requests_header').classList.remove('hidden')
|
||||||
|
renderHome()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function setApproverName() {
|
function setApproverName() {
|
||||||
@ -1580,15 +1570,16 @@
|
|||||||
buttonLoader(getRef('approve_verifier_button'), true)
|
buttonLoader(getRef('approve_verifier_button'), true)
|
||||||
try {
|
try {
|
||||||
const adminPrivateKey = await floDapps.user.private
|
const adminPrivateKey = await floDapps.user.private
|
||||||
const floData = `KYC|APPROVE_AGGREGATOR|${addresses.join('+')}`
|
// const floData = `KYC|APPROVE_AGGREGATOR|${addresses.join('+')}`
|
||||||
if (floData.length > 1040) {
|
// if (floData.length > 1040) {
|
||||||
return notify('Too many addresses added. Try removing one.', 'error')
|
// return notify('Too many addresses added. Try removing one.', 'error')
|
||||||
}
|
// }
|
||||||
const [txId] = await Promise.all([
|
// const [txId] = await Promise.all([
|
||||||
floBlockchainAPI.writeData(floGlobals.myFloID, floData, adminPrivateKey, floGlobals.myFloID),
|
// floBlockchainAPI.writeData(floGlobals.myFloID, floData, adminPrivateKey, floGlobals.myFloID),
|
||||||
floDapps.manageAppConfig(adminPrivateKey, addresses)
|
// floDapps.manageAppConfig(adminPrivateKey, addresses)
|
||||||
])
|
// ])
|
||||||
notify(`Verifiers approval request submitted. TXID: ${txId}`, 'success');
|
await floDapps.manageAppConfig(adminPrivateKey, addresses)
|
||||||
|
notify(`Verifiers approval request submitted. May take upto 30 mins to complete.`, 'success');
|
||||||
floGlobals.subAdmins = [...new Set([...floGlobals.subAdmins, ...addresses])]
|
floGlobals.subAdmins = [...new Set([...floGlobals.subAdmins, ...addresses])]
|
||||||
closePopup()
|
closePopup()
|
||||||
renderHome()
|
renderHome()
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
function checkIfSentByMasterAddress(tx) {
|
function checkIfSentByMasterAddress(tx) {
|
||||||
return tx.vin.some(vin => vin.addresses[0] === floGlobals.masterAddress);
|
return tx.vin.some(vin => vin.addresses[0] === floGlobals.adminID);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getApprovedAggregators() {
|
function getApprovedAggregators() {
|
||||||
floGlobals.approvedKycAggregators = {};
|
floGlobals.approvedKycAggregators = {};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
floBlockchainAPI.readAllTxs(floGlobals.masterAddress).then(({ items: transactions }) => {
|
floBlockchainAPI.readAllTxs(floGlobals.adminID).then(({ items: transactions }) => {
|
||||||
console.log(transactions);
|
console.log(transactions);
|
||||||
transactions.filter(tx => checkIfSentByMasterAddress(tx) && tx.floData.startsWith('KYC'))
|
transactions.filter(tx => checkIfSentByMasterAddress(tx) && tx.floData.startsWith('KYC'))
|
||||||
.reverse()
|
.reverse()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user