Make Wallet first-class citizens (#3990)
* Fixed hint in Address Select + Wallet as first-class-citizen * Separate Owned and not Owned Wallets * Fix balance not updating * Fix MethodDecoding for Contract Deployment * Fix TypedInput params * Fix Token Transfer for Wallet * Small change to contracts * Fix wallets shown twice * Fix separation of accounts and wallets in Accounts * Fix linting * Execute contract methods from Wallet ✓ * Fixing linting * Wallet as first-class citizen: Part 1 (Manual) #3784 * Lower level wallet transaction convertion * Fix linting * Proper autoFocus on right Signer input * PR Grumble: don't show Wallets in dApps Permissions * Add postTransaction and gasEstimate wrapper methods * Extract Wallet postTx and gasEstimate to utils + PATCH api * Remove invalid test It's totally valid for input's length not to be a multiple of 32 bytes. EG. for Wallet Contracts * Merge master * Fix linting * Fix merge issue * Rename Portal * Rename Protal => Portal (typo)
This commit is contained in:
committed by
Gav Wood
parent
88c0329a31
commit
fd41a10319
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import Abi from '../../abi';
|
||||
import Abi from '~/abi';
|
||||
|
||||
let nextSubscriptionId = 0;
|
||||
|
||||
@@ -53,6 +53,10 @@ export default class Contract {
|
||||
|
||||
this._subscribedToBlock = false;
|
||||
this._blockSubscriptionId = null;
|
||||
|
||||
if (api && api.patch && api.patch.contract) {
|
||||
api.patch.contract(this);
|
||||
}
|
||||
}
|
||||
|
||||
get address () {
|
||||
@@ -90,8 +94,10 @@ export default class Contract {
|
||||
}
|
||||
|
||||
deployEstimateGas (options, values) {
|
||||
const _options = this._encodeOptions(this.constructors[0], options, values);
|
||||
|
||||
return this._api.eth
|
||||
.estimateGas(this._encodeOptions(this.constructors[0], options, values))
|
||||
.estimateGas(_options)
|
||||
.then((gasEst) => {
|
||||
return [gasEst, gasEst.mul(1.2)];
|
||||
});
|
||||
@@ -115,8 +121,10 @@ export default class Contract {
|
||||
|
||||
setState({ state: 'postTransaction', gas });
|
||||
|
||||
const _options = this._encodeOptions(this.constructors[0], options, values);
|
||||
|
||||
return this._api.parity
|
||||
.postTransaction(this._encodeOptions(this.constructors[0], options, values))
|
||||
.postTransaction(_options)
|
||||
.then((requestId) => {
|
||||
setState({ state: 'checkRequest', requestId });
|
||||
return this._pollCheckRequest(requestId);
|
||||
@@ -199,7 +207,7 @@ export default class Contract {
|
||||
getCallData = (func, options, values) => {
|
||||
let data = options.data;
|
||||
|
||||
const tokens = func ? this._abi.encodeTokens(func.inputParamTypes(), values) : null;
|
||||
const tokens = func ? Abi.encodeTokens(func.inputParamTypes(), values) : null;
|
||||
const call = tokens ? func.encodeCall(tokens) : null;
|
||||
|
||||
if (data && data.substr(0, 2) === '0x') {
|
||||
@@ -221,6 +229,8 @@ export default class Contract {
|
||||
}
|
||||
|
||||
_bindFunction = (func) => {
|
||||
func.contract = this;
|
||||
|
||||
func.call = (options, values = []) => {
|
||||
const callParams = this._encodeOptions(func, this._addOptionsTo(options), values);
|
||||
|
||||
@@ -233,13 +243,13 @@ export default class Contract {
|
||||
|
||||
if (!func.constant) {
|
||||
func.postTransaction = (options, values = []) => {
|
||||
return this._api.parity
|
||||
.postTransaction(this._encodeOptions(func, this._addOptionsTo(options), values));
|
||||
const _options = this._encodeOptions(func, this._addOptionsTo(options), values);
|
||||
return this._api.parity.postTransaction(_options);
|
||||
};
|
||||
|
||||
func.estimateGas = (options, values = []) => {
|
||||
return this._api.eth
|
||||
.estimateGas(this._encodeOptions(func, this._addOptionsTo(options), values));
|
||||
const _options = this._encodeOptions(func, this._addOptionsTo(options), values);
|
||||
return this._api.eth.estimateGas(_options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user