|
|
@ -124,15 +124,10 @@ class MultiParamManager { |
|
|
|
var onClick = (domEl) => { |
|
|
|
var onClick = (domEl) => { |
|
|
|
this.clickCallBack(this.funABI.inputs, this.basicInputField.value) |
|
|
|
this.clickCallBack(this.funABI.inputs, this.basicInputField.value) |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO: if this is a lookup only make this button btn-info
|
|
|
|
let funcButton = yo`<button onclick=${() => onClick()} class="${css.instanceButton} btn btn-sm">${title}</button>` |
|
|
|
// otherwise it needs to have btn-warning injected
|
|
|
|
|
|
|
|
// or do we need to only do this in 1 place - I have a feeling that this will happen in multiple places
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.contractActionsContainerSingle = yo` |
|
|
|
this.contractActionsContainerSingle = yo` |
|
|
|
<div class="${css.contractActionsContainerSingle}" > |
|
|
|
<div class="${css.contractActionsContainerSingle}" > |
|
|
|
<button onclick=${() => onClick()} class="${css.instanceButton} btn btn-sm"> |
|
|
|
${funcButton} |
|
|
|
${title} |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
${this.basicInputField} |
|
|
|
${this.basicInputField} |
|
|
|
<i class="fas fa-angle-down ${css.methCaret}" onclick=${() => this.switchMethodViewOn()} title=${title} ></i> |
|
|
|
<i class="fas fa-angle-down ${css.methCaret}" onclick=${() => this.switchMethodViewOn()} title=${title} ></i> |
|
|
|
</div>` |
|
|
|
</div>` |
|
|
@ -148,7 +143,7 @@ class MultiParamManager { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var button = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}"></button>` |
|
|
|
var expandedButton = yo`<button onclick=${() => { multiOnClick() }} class="${css.instanceButton}"></button>` |
|
|
|
|
|
|
|
|
|
|
|
this.contractActionsContainerMulti = yo`<div class="${css.contractActionsContainerMulti}" >
|
|
|
|
this.contractActionsContainerMulti = yo`<div class="${css.contractActionsContainerMulti}" >
|
|
|
|
<div class="${css.contractActionsContainerMultiInner} text-dark" > |
|
|
|
<div class="${css.contractActionsContainerMultiInner} text-dark" > |
|
|
@ -158,7 +153,7 @@ class MultiParamManager { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
${this.multiFields} |
|
|
|
${this.multiFields} |
|
|
|
<div class="${css.group} ${css.multiArg}" > |
|
|
|
<div class="${css.group} ${css.multiArg}" > |
|
|
|
${button} |
|
|
|
${expandedButton} |
|
|
|
${copyToClipboard( |
|
|
|
${copyToClipboard( |
|
|
|
() => { |
|
|
|
() => { |
|
|
|
var multiString = this.getMultiValsString() |
|
|
|
var multiString = this.getMultiValsString() |
|
|
@ -179,19 +174,32 @@ class MultiParamManager { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div>` |
|
|
|
</div>` |
|
|
|
|
|
|
|
|
|
|
|
var contractProperty = yo`<div class="${css.contractProperty}">${this.contractActionsContainerSingle} ${this.contractActionsContainerMulti}</div>` |
|
|
|
var contractProperty = yo` |
|
|
|
// TODO: add class for btn-info to the button and remove stuff from the class
|
|
|
|
<div class="${css.contractProperty}"> |
|
|
|
|
|
|
|
${this.contractActionsContainerSingle} ${this.contractActionsContainerMulti} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
` |
|
|
|
if (this.lookupOnly) { |
|
|
|
if (this.lookupOnly) { |
|
|
|
contractProperty.classList.add(css.constant) |
|
|
|
// call. stateMutability is either pure or view
|
|
|
|
button.setAttribute('title', (title + ' - call')) |
|
|
|
expandedButton.setAttribute('title', (title + ' - call')) |
|
|
|
button.innerHTML = 'call' |
|
|
|
expandedButton.innerHTML = 'call' |
|
|
|
this.contractActionsContainerSingle.querySelector(`.${css.instanceButton}`).setAttribute('title', (title + ' - call')) |
|
|
|
expandedButton.classList.add('btn-info') |
|
|
|
this.contractActionsContainerSingle.querySelector(`.${css.instanceButton}`).classList.add('btn-info') |
|
|
|
funcButton.setAttribute('title', (title + ' - call')) |
|
|
|
button.classList.add('btn-info') |
|
|
|
funcButton.classList.add('btn-info') |
|
|
|
|
|
|
|
} else if (this.funABI.stateMutability === 'payable' || this.funABI.payable === true) { |
|
|
|
|
|
|
|
// transact. stateMutability = payable
|
|
|
|
|
|
|
|
expandedButton.setAttribute('title', (title + ' - transact (payable)')) |
|
|
|
|
|
|
|
expandedButton.innerHTML = 'transact' |
|
|
|
|
|
|
|
expandedButton.classList.add('btn-danger') |
|
|
|
|
|
|
|
funcButton.setAttribute('title', (title + ' - transact (payable)')) |
|
|
|
|
|
|
|
funcButton.classList.add('btn-danger') |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.contractActionsContainerSingle.querySelector(`.${css.instanceButton}`).classList.add('btn-warning') |
|
|
|
// transact. stateMutability = not payable
|
|
|
|
button.innerHTML = 'transact' |
|
|
|
expandedButton.setAttribute('title', (title + ' - transact (not payable)')) |
|
|
|
button.classList.add('btn-warning') |
|
|
|
expandedButton.innerHTML = 'transact' |
|
|
|
|
|
|
|
expandedButton.classList.add('btn-warning') |
|
|
|
|
|
|
|
funcButton.classList.add('btn-warning') |
|
|
|
|
|
|
|
funcButton.setAttribute('title', (title + ' - transact (not payable)')) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.funABI.inputs && this.funABI.inputs.length > 0) { |
|
|
|
if (this.funABI.inputs && this.funABI.inputs.length > 0) { |
|
|
@ -204,17 +212,6 @@ class MultiParamManager { |
|
|
|
this.basicInputField.style.visibility = 'hidden' |
|
|
|
this.basicInputField.style.visibility = 'hidden' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.funABI.payable === true) { |
|
|
|
|
|
|
|
contractProperty.classList.add(css.payable) |
|
|
|
|
|
|
|
button.setAttribute('title', (title + ' - transact (payable)')) |
|
|
|
|
|
|
|
this.contractActionsContainerSingle.querySelector('button').setAttribute('title', (title + ' - transact (payable)')) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!this.lookupOnly && this.funABI.payable === false) { |
|
|
|
|
|
|
|
button.setAttribute('title', (title + ' - transact (not payable)')) |
|
|
|
|
|
|
|
this.contractActionsContainerSingle.querySelector('button').setAttribute('title', (title + ' - transact (not payable)')) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return contractProperty |
|
|
|
return contractProperty |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|