Added option to label multisig addresses
This commit is contained in:
parent
edc9718ff7
commit
777c8280c8
@ -2212,12 +2212,16 @@ sm-chip .badge {
|
|||||||
.multisig-option {
|
.multisig-option {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: 0.5rem;
|
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
border-bottom: thin solid rgba(var(--text-color), 0.3);
|
||||||
}
|
}
|
||||||
.multisig-option .wrap-around {
|
.multisig-option .wrap-around {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
.multisig-option__label {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
.multisig-option__balance {
|
.multisig-option__balance {
|
||||||
color: rgba(var(--text-color), 0.8);
|
color: rgba(var(--text-color), 0.8);
|
||||||
}
|
}
|
||||||
|
|||||||
2
css/main.min.css
vendored
2
css/main.min.css
vendored
File diff suppressed because one or more lines are too long
@ -2282,11 +2282,15 @@ sm-chip {
|
|||||||
.multisig-option {
|
.multisig-option {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
border-radius: 0.5rem;
|
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
border-bottom: thin solid rgba(var(--text-color), 0.3);
|
||||||
.wrap-around {
|
.wrap-around {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
&__label {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
&__balance {
|
&__balance {
|
||||||
color: rgba(var(--text-color), 0.8);
|
color: rgba(var(--text-color), 0.8);
|
||||||
}
|
}
|
||||||
|
|||||||
30
index.html
30
index.html
@ -31,7 +31,6 @@
|
|||||||
<script id="onLoadStartUp">
|
<script id="onLoadStartUp">
|
||||||
function onLoadStartUp() {
|
function onLoadStartUp() {
|
||||||
routeTo('loading')
|
routeTo('loading')
|
||||||
floDapps.setAppObjectStores({ userSettings: {} })
|
|
||||||
document.body.classList.remove('hidden')
|
document.body.classList.remove('hidden')
|
||||||
|
|
||||||
floDapps.setCustomPrivKeyInput(getSignedIn)
|
floDapps.setCustomPrivKeyInput(getSignedIn)
|
||||||
@ -943,10 +942,14 @@
|
|||||||
</button>
|
</button>
|
||||||
<p id="multisig_creation__warning" class="info info--warning"></p>
|
<p id="multisig_creation__warning" class="info info--warning"></p>
|
||||||
<sm-form>
|
<sm-form>
|
||||||
<p>Enter minimum signatures required for approval of a transaction</p>
|
<sm-input id="multisig_label" placeholder="Label" error-text="Please add a label" animated
|
||||||
|
required></sm-input>
|
||||||
|
<div class="grid gap-0-5">
|
||||||
|
<p>Minimum signatures required for transaction approval</p>
|
||||||
<sm-input id="min_sign_required" placeholder="Min required" min="2" type="number"
|
<sm-input id="min_sign_required" placeholder="Min required" min="2" type="number"
|
||||||
error-text="At least 2 members are required" animate required>
|
error-text="At least 2 members are required" animate required>
|
||||||
</sm-input>
|
</sm-input>
|
||||||
|
</div>
|
||||||
<div class="multi-state-button">
|
<div class="multi-state-button">
|
||||||
<button id="create_multisig_button" class="button button--primary" type="submit" disabled>
|
<button id="create_multisig_button" class="button button--primary" type="submit" disabled>
|
||||||
Create
|
Create
|
||||||
@ -2646,7 +2649,7 @@
|
|||||||
</button>
|
</button>
|
||||||
`
|
`
|
||||||
},
|
},
|
||||||
multisigOption(address) {
|
multisigOption(address, label) {
|
||||||
btcOperator.getBalance(address).then(balance => {
|
btcOperator.getBalance(address).then(balance => {
|
||||||
const target = getRef('select_multisig_list').querySelector(`[data-address="${address}"]`);
|
const target = getRef('select_multisig_list').querySelector(`[data-address="${address}"]`);
|
||||||
if (target)
|
if (target)
|
||||||
@ -2654,6 +2657,7 @@
|
|||||||
}).catch(err => notify(err, 'error'))
|
}).catch(err => notify(err, 'error'))
|
||||||
return html`
|
return html`
|
||||||
<li class="grid gap-0-5 align-center multisig-option" data-address=${address}>
|
<li class="grid gap-0-5 align-center multisig-option" data-address=${address}>
|
||||||
|
<text-field class="multisig-option__label" placeholder="Label" value=${label || 'Add a label'}></text-field>
|
||||||
<sm-copy clip-text value=${address}></sm-copy>
|
<sm-copy clip-text value=${address}></sm-copy>
|
||||||
<div class="flex align-center space-between">
|
<div class="flex align-center space-between">
|
||||||
<span class="multisig-option__balance flex align-center">Balance: <sm-spinner><sm-spinner></span>
|
<span class="multisig-option__balance flex align-center">Balance: <sm-spinner><sm-spinner></span>
|
||||||
@ -2663,8 +2667,9 @@
|
|||||||
`
|
`
|
||||||
},
|
},
|
||||||
multisigAddresses() {
|
multisigAddresses() {
|
||||||
messenger.multisig.listAddress().then(addresses => {
|
Promise.all([messenger.multisig.listAddress(), compactIDB.readAllData('multisigLabels')])
|
||||||
const list = Object.keys(addresses).map(address => render.multisigOption(address))
|
.then(([addresses, labels]) => {
|
||||||
|
const list = Object.keys(addresses).map(address => render.multisigOption(address, labels[address]))
|
||||||
if (list.length) {
|
if (list.length) {
|
||||||
renderElem(getRef('select_multisig_list'), html`${list}`)
|
renderElem(getRef('select_multisig_list'), html`${list}`)
|
||||||
}
|
}
|
||||||
@ -3295,7 +3300,7 @@
|
|||||||
getRef('skip_members_button').addEventListener('click', e => {
|
getRef('skip_members_button').addEventListener('click', e => {
|
||||||
if (getRef('creation_popup').dataset.type === 'multisig') {
|
if (getRef('creation_popup').dataset.type === 'multisig') {
|
||||||
showChildElement('creation_process', 2, { entry: slideInLeft, exit: slideOutLeft }).then(() => {
|
showChildElement('creation_process', 2, { entry: slideInLeft, exit: slideOutLeft }).then(() => {
|
||||||
getRef('min_sign_required').focusIn()
|
getRef('multisig_label').focusIn()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
showChildElement('creation_process', 1, { entry: slideInLeft, exit: slideOutLeft }).then(() => {
|
showChildElement('creation_process', 1, { entry: slideInLeft, exit: slideOutLeft }).then(() => {
|
||||||
@ -3316,18 +3321,31 @@
|
|||||||
selectedMembers.add(floDapps.user.id)
|
selectedMembers.add(floDapps.user.id)
|
||||||
const selctedPubKeys = [...selectedMembers].map(id => floGlobals.pubKeys[id]);
|
const selctedPubKeys = [...selectedMembers].map(id => floGlobals.pubKeys[id]);
|
||||||
const minRequired = parseInt(getRef('min_sign_required').value.trim());
|
const minRequired = parseInt(getRef('min_sign_required').value.trim());
|
||||||
|
const label = getRef('multisig_label').value.trim();
|
||||||
buttonLoader('create_multisig_button', true)
|
buttonLoader('create_multisig_button', true)
|
||||||
messenger.multisig.createAddress(selctedPubKeys, minRequired).then(multisigAddress => {
|
messenger.multisig.createAddress(selctedPubKeys, minRequired).then(multisigAddress => {
|
||||||
|
compactIDB.writeData('multisigLabels', label, multisigAddress).then(() => {
|
||||||
notify('Created multisig address', 'success');
|
notify('Created multisig address', 'success');
|
||||||
closePopup();
|
closePopup();
|
||||||
clearAllMembers();
|
clearAllMembers();
|
||||||
render.multisigAddresses();
|
render.multisigAddresses();
|
||||||
}).catch(error => notify(error, 'error'))
|
}).catch(error => notify(error, 'error'))
|
||||||
|
}).catch(error => notify(error, 'error'))
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
buttonLoader('create_multisig_button', false)
|
buttonLoader('create_multisig_button', false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
getRef('select_multisig_list').addEventListener('change', e => {
|
||||||
|
const multisigAddress = e.target.closest('.multisig-option').dataset.address;
|
||||||
|
let label = e.target.value.trim();
|
||||||
|
if (label === '')
|
||||||
|
label = 'Unnamed'
|
||||||
|
compactIDB.writeData('multisigLabels', label, multisigAddress).then(() => {
|
||||||
|
notify('Updated label', 'success');
|
||||||
|
}).catch(error => notify(error, 'error'))
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('create_group_button').addEventListener('click', () => {
|
document.getElementById('create_group_button').addEventListener('click', () => {
|
||||||
const groupName = getRef('group_name_field').value.trim()
|
const groupName = getRef('group_name_field').value.trim()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -153,7 +153,8 @@
|
|||||||
response_received: {},
|
response_received: {},
|
||||||
flodata: {},
|
flodata: {},
|
||||||
appendix: {},
|
appendix: {},
|
||||||
userSettings: {}
|
userSettings: {},
|
||||||
|
multisigLabels: {}
|
||||||
}
|
}
|
||||||
let user_db = `${floGlobals.application}_${floCrypto.toFloID(user.id)}`;
|
let user_db = `${floGlobals.application}_${floCrypto.toFloID(user.id)}`;
|
||||||
compactIDB.initDB(user_db, obj).then(result => {
|
compactIDB.initDB(user_db, obj).then(result => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user