如何(在 Drizzle 中)获取 Metamask 中当前选择的帐户?
我有一个调用set
智能合约方法的函数,但当前帐户是“硬编码”的:
setValue = value => {
const { drizzle, drizzleState } = this.props;
const contract = drizzle.contracts.PartProduction;
// let drizzle know we want to call the `set` method with `value`
const stackId = contract.methods["set"].cacheSend(value, {
from: drizzleState.accounts[0]
});
// save the `stackId` for later reference
this.setState({ stackId });
};
即在:from: drizzleState.accounts[0]
。
如何更改from:
字段以使用 Metamask 中选择的帐户?