New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contract selection with url params #2729
Conversation
Staging build: MyCryptoBuilds |
contracts.map(con => { | ||
const addr = con.address ? `(${con.address.substr(0, 10)}...)` : ''; | ||
// if contract name from Url exists, then load this contract | ||
if (con.name === contractName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make a modification here to do the comparison as both strings in lowercase for a UX factor (ie: MyContract
contract name won't match mycontract
query string value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Thanks. Did just that. Still not working on a live version even tho it works on a localhost so making a bunch of console.log to understand what's happing
…en interacting with contract
Hi @OlivierDemeaux. I got curious when I saw you mention that strange localhost vs non-localhost bug on the MyCrypto Discord. As you've discovered, the problem is the undefined Turns out the reason it was crashing the development build but not the production build wasn't because of a localhost issue. The development build (when you run Babel (correctly, according to the proposed spec) transpiles the uninitialized Unless I'm missing something, it seems like the |
common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx
Outdated
Show resolved
Hide resolved
common/containers/Tabs/Contracts/components/Interact/components/InteractForm/index.tsx
Outdated
Show resolved
Hide resolved
common/containers/Tabs/Contracts/components/Interact/components/InteractForm/index.tsx
Outdated
Show resolved
Hide resolved
common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx
Outdated
Show resolved
Hide resolved
common/containers/Tabs/Contracts/components/Interact/components/InteractExplorer/index.tsx
Outdated
Show resolved
Hide resolved
…/ page with some params
} | ||
}; | ||
|
||
public getParamsFromUrl = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function seems to be repeated 3x. Is there any way that you can extract this out, or use it in a higher order component and pass the data down as props?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Took me longer than i want to admit but I managed to extract it! Tell me what you think about it!
const item = params[index]; | ||
if (index.substr(0, 5) === 'param') { | ||
count++; | ||
const element: any = document.getElementById(index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what this method is attempting to do and why this getElementById
is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just grab the params from the url and set them in the function's input fields according to their respective numbers. It needs getElementById in order to get the input and set the value to that input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @blurpesec. Any news?
Hi guys! From our point of view, it's a must have for adoption. If you have time I can give you a demo of our product to show you how crucial it is (and not only for ourselves.) |
Closing in favor of #2920 |
Description
Added some code to allow a contract, address and abi to be set on the mtCrypto/contracts/interact page with a param passed in the URL. No need to search the contract in the dropdown.
ex: "myCrypto/contracts/interact?name=BCdiploma - Evidenz".
If a param is passed in the URL, the contract, address and abi will be set and the button "access" will be click.
PROBLEME: The access button crashes the localhost i'm running myCrypto on. (Even when i click on access button after i manually clicked on the contract)
Changes
ex: "myCrypto//contracts/interact?name=BCdiploma%20-%20EvidenZ"
Steps to Test
Those lines are responsibles for the click on the "access" button after that the contract name, address and abi are set.
Zeplin Design
Quality Assurance