Ambisafe Ethereum Utils

To begin, do: setRpcUrl('ethereumRpcUrlHere'); setPrivateKey('yourPkHere'); in the browser javascript console.

Also try help();

Example usage, test func will return false if there is less than 500000 gas available inside it:

var ambiUtils = web3.eth.contract([{"constant":false,"inputs":[],"name":"kill","outputs":[],"type":"function"},{"constant":false,"inputs":[],"name":"test","outputs":[{"name":"","type":"bool"}],"type":"function"}]).at("0x75c5751b5eca193c5e38e1128f543b0250e24b0a");

safeTransaction(ambiUtils.test, [], sender, {testRun: true});

safeTransaction(ambiUtils.test, [], sender, {testRun: true, ignoreCallResponse: true});

safeTransaction(ambiUtils.test, [], sender, {testRun: true, gas: 1000000});

safeTransaction(ambiUtils.test, [], sender, {waitReceipt: true}); // Will fail on checks.

safeTransaction(ambiUtils.test, [], sender, {waitReceipt: true, gas: 1000000}); // Submitting real transaction!

var tx1 = safeTransactionFunction(ambiUtils.test, [], sender, {gas: 1000000});

var tx2 = safeTransactionFunction(ambiUtils.test, [], sender); // Will stop on this one.

var tx3 = safeTransactionFunction(ambiUtils.test, [], sender, {ignoreCallResponse: true});

safeTransactions([tx1, tx2, tx3], true); // true means testRun for all transactions;

safeSend(ambiUtils.address, 1000, sender, {testRun: true}); // Send 100 wei.

safeSendAll(ambiUtils.address, sender, {testRun: true}); // Send all you have available, will result in 0 wei on sender.

safeTopup(ambiUtils.address, 1488, sender, {testRun: true}); // Send enough for the receiver to have exactly 1488 wei.

fastTopups([ // Will topup to the specified balance.
  fastTopupFunction('0x1c4a10b09f54c2a2601b71e7644124efefd2cd7b', 20000000000000001, sender),
  fastTopupFunction('0x4793f63e6e270a78c9533ba2743905beeade40a6', 20000000000000100, sender),
  fastTopupFunction('0x787f0a7639fd444ae6464e02f29763f06c76232f', 10000000000000000, sender),
  fastTopupFunction('0x8622c07a3b6496df703ab644698162c3f265a98b', 20000200020000000, sender)
], 0, true); // 0 is the first unused nonce. Testrun true.

Logs