-
Notifications
You must be signed in to change notification settings - Fork 0
EthereumAccountSignable
This class won't be available unless the arc-web3-signable-accounts
addon is installed!
Before using this class, InitializeWeb3
must be called! See the following example:
{EthereumAccountSignable, InitializeWeb3} = require("arc-web3");
await InitializeWeb3(); // The EthereumAccountSignable constructor will throw an error until this resolves
let account = new EthereumAccountSignable(...);
EthereumAccountSignable
is an class representing... Ethereum accounts which can sign transactions, funny enough.
Properties:
- (AddressString)
address
: The account's address. - (PrivateKeyBuffer)
privKey
: The private key used to create this object - (Uint8Array)
pubKey
: The public key associated with the private key
Methods:
new EthereumAccountSignable(Web3Connection, PrivateKeyBuffer)
EthereumAccounts only act as an abstraction to check an account balance in a more object-oriented way.
// No example. (Feel free to suggest one!)
Returns the accounts balance in wei. If you want the ether value, divide by 1e18
. You can specify a block number if you wish to look up historical balance. If no arguments are given, it will return the latest balance.
// No example. (Feel free to suggest one!)
EthereumAccountSignable.setSenderFor(EthereumContract)
Any future calls to the specified contract will set the msg.sender
value to this EthereumAccount by default. The contract's writable functions will also use this EthereumAccountSignable to sign outgoing transactions.
// No example. (Feel free to suggest one!)
EthereumAccountSignable.setSignerFor(EthereumContract)
Alias of the above function.
// No example. (Feel free to suggest one!)
Promise(TransactionHash) EthereumAccountSignable.transfer(AddressString || EthereumContract || EthereumAccount || EthereumAccountSignable to, BigNumber amount, [Number gasPrice, Number gasLimit, Number nonce])
Sends the specified amount of wei to the specified account. If gasPrice
, gasLimit
, or nonce
aren't sent, they'll be automatically determined.
// No example. (Feel free to suggest one!)
The documentation and the library itself isn't feature-complete. It also may be unprofessional at times.