Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

from parameter should accept a wallet #2825

@sshelton76

Description

@sshelton76

This is a feature request. Anytime we accept an address as a "from" parameter, it would be handy if we could pass it a wallet object instead of just an address. I realize the from address is used as a lookup into a currently decrypted wallet. But the place to decrypt should be during whatever procedure we're trying to pass in the address. Otherwise we have to decrypt the wallet before calling the function and this is putting it back into the global space again.

The below is a really bad idea, but is presently the only way to handle it.

let result;
        if(window.confirm(`Would you like to send ${amount} ${symbol} to ${dest}?`)){
            try{
                let ctr = await this.XTokens[symbol];
                let fin = (await ctr.displayToRaw(amount)).toString();
                let wallet = await this.pinPrompt();
                let params = {
                    from : wallet[0].address
                }
                params.gas = await ctr.methods.transfer(dest,fin).estimateGas(params);
                console.debug("params: ",params);
                result = await ctr.methods.transfer(dest,fin).send(params);
                console.debug("result: ",result);
                window.alert(`Successfully sent ${amount} ${symbol} to ${dest}! Transaction Hash is ${result.transactionHash}`);
            }catch(err){
                window.alert(err);
            }
        }

FYI the "this.pinPrompt" prompts a user for a password, decrypts the wallet and hands back the decrypted wallet.
It would be far better if I could just hand in "wallet" and perhaps the password.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.x2.0 related issuesFeature RequestStaleHas not received enough activity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions