admin: updated dist files

This commit is contained in:
Richard Moore 2022-10-19 04:19:51 -04:00
parent 706d3ca27c
commit 0bfa7f497d
25 changed files with 298 additions and 110 deletions

@ -4,19 +4,14 @@ Changelog
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
ethers/v5.7.2 (2022-10-18 23:41)
ethers/v5.7.2 (2022-10-19 04:19)
--------------------------------
- Updated tests to use goerli instead of ropsten. ([1392803](https://github.com/ethers-io/ethers.js/commit/139280390c32b80c533e6a74c84595e6bea706b9))
- Updated tests to use goerli instead of ropsten. ([1392803](https://github.com/ethers-io/ethers.js/commit/139280390c32b80c533e6a74c84595e6bea706b9), [706d3ca](https://github.com/ethers-io/ethers.js/commit/706d3ca27c233385944877eb64c099c74109b6c2))
- Added new error strings Pocket returns. ([9f990c5](https://github.com/ethers-io/ethers.js/commit/9f990c57f0486728902d4b8e049536f2bb3487ee))
- Fixed Alchemy goerli URL. ([#3320](https://github.com/ethers-io/ethers.js/issues/3320), [#3323](https://github.com/ethers-io/ethers.js/issues/3323), [#3340](https://github.com/ethers-io/ethers.js/issues/3340), [#3358](https://github.com/ethers-io/ethers.js/issues/3358), [#3423](https://github.com/ethers-io/ethers.js/issues/3423); [74e3d98](https://github.com/ethers-io/ethers.js/commit/74e3d98d1df2bd97be258202a63517d4aa1ba8fd))
- Update testnets for third-party providers. ([#3320](https://github.com/ethers-io/ethers.js/issues/3320), [#3323](https://github.com/ethers-io/ethers.js/issues/3323), [#3340](https://github.com/ethers-io/ethers.js/issues/3340), [#3358](https://github.com/ethers-io/ethers.js/issues/3358), [#3423](https://github.com/ethers-io/ethers.js/issues/3423); [2a3a2e1](https://github.com/ethers-io/ethers.js/commit/2a3a2e1feda7b18c8e234c84e4de32d4246f18ed))
ethers/v5.7.2 (2022-10-18 20:35)
--------------------------------
- Update testnets for third-party providers. ([#3320](https://github.com/ethers-io/ethers.js/issues/3320), [#3323](https://github.com/ethers-io/ethers.js/issues/3323), [#3340](https://github.com/ethers-io/ethers.js/issues/3340), [#3358](https://github.com/ethers-io/ethers.js/issues/3358), [#3423](https://github.com/ethers-io/ethers.js/issues/3423); [2a3a2e1](https://github.com/ethers-io/ethers.js/commit/2a3a2e1feda7b18c8e234c84e4de32d4246f18ed))
ethers/v5.7.1 (2022-09-13 21:28)
--------------------------------

26
package-lock.json generated

@ -39,7 +39,7 @@
"flatworm": "0.0.2-beta.7",
"jison": "0.4.18",
"karma": "^6.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-chrome-launcher": "3.1.1",
"karma-mocha": "2.0.1",
"libnpmpublish": "3.0.1",
"mocha": "^9.1.3",
@ -1839,9 +1839,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001421",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001421.tgz",
"integrity": "sha512-Sw4eLbgUJAEhjLs1Fa+mk45sidp1wRn5y6GtDpHGBaNJ9OCDJaVh2tIaWWUnGfuXfKf1JCBaIarak3FkVAvEeA==",
"version": "1.0.30001422",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001422.tgz",
"integrity": "sha512-hSesn02u1QacQHhaxl/kNMZwqVG35Sz/8DgvmgedxSH8z9UUpcDYSPYgsj3x5dQNRcNp6BwpSfQfVzYUTm+fog==",
"dev": true,
"funding": [
{
@ -3875,9 +3875,9 @@
}
},
"node_modules/karma-chrome-launcher": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz",
"integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz",
"integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==",
"dev": true,
"dependencies": {
"which": "^1.2.1"
@ -8441,9 +8441,9 @@
"dev": true
},
"caniuse-lite": {
"version": "1.0.30001421",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001421.tgz",
"integrity": "sha512-Sw4eLbgUJAEhjLs1Fa+mk45sidp1wRn5y6GtDpHGBaNJ9OCDJaVh2tIaWWUnGfuXfKf1JCBaIarak3FkVAvEeA==",
"version": "1.0.30001422",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001422.tgz",
"integrity": "sha512-hSesn02u1QacQHhaxl/kNMZwqVG35Sz/8DgvmgedxSH8z9UUpcDYSPYgsj3x5dQNRcNp6BwpSfQfVzYUTm+fog==",
"dev": true
},
"caseless": {
@ -10006,9 +10006,9 @@
}
},
"karma-chrome-launcher": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz",
"integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz",
"integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==",
"dev": true,
"requires": {
"which": "^1.2.1"

@ -516,10 +516,10 @@ describe("Test ParamType Parser", function () {
});
});
describe('Test EIP-838 Error Codes', function () {
const addr = "0xbd0B4B009a76CA97766360F04f75e05A3E449f1E";
const addr = "0x9FC52a97e59aeea064D9c24a383B70e8475b3e0B";
it("testError1", function () {
return __awaiter(this, void 0, void 0, function* () {
const provider = new ethers.providers.InfuraProvider("ropsten", "49a0efa3aaee4fd99797bfa94d8ce2f1");
const provider = new ethers.providers.InfuraProvider("goerli", "49a0efa3aaee4fd99797bfa94d8ce2f1");
const contract = new ethers.Contract(addr, [
"function testError1(bool pass, address addr, uint256 value) pure returns (bool)",
"function testError2(bool pass, bytes data) pure returns (bool)",
@ -549,8 +549,9 @@ describe("Additional test cases", function () {
const iface = new ethers.utils.Interface([
"function test(address foo) view returns (bool)"
]);
const tx = iface.encodeFunctionData("test", ["c1912fee45d61c87cc5ea59dae31190fffff232d"]);
console.log(tx);
//const tx =
iface.encodeFunctionData("test", ["c1912fee45d61c87cc5ea59dae31190fffff232d"]);
//console.log(tx);
});
});
//# sourceMappingURL=test-contract-interface.js.map

File diff suppressed because one or more lines are too long

@ -10,8 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
import assert from "assert";
import { ethers } from "ethers";
import { sendTransaction } from "./utils";
import contractData from "./test-contract.json";
const provider = new ethers.providers.InfuraProvider("rinkeby", "49a0efa3aaee4fd99797bfa94d8ce2f1");
const provider = new ethers.providers.InfuraProvider("goerli", "49a0efa3aaee4fd99797bfa94d8ce2f1");
//const provider = ethers.getDefaultProvider("rinkeby");
const TIMEOUT_PERIOD = 120000;
const contract = (function () {
@ -92,8 +93,11 @@ function TestContractEvents() {
resolve(result);
});
});
const data = yield ethers.utils.fetchJson('https://api.ethers.io/api/v1/?action=triggerTest&address=' + contract.address);
console.log('*** Triggered Transaction Hash: ' + data.hash);
const hash = yield sendTransaction({
to: "0x63c5bd7ef280f150aca761a5e9a922959eb26732",
data: "0xbabf890100000000000000000000000006b5955a67d827cdf91823e3bb8f069e6c89c1d600000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000a48656c6c6f576f726c6400000000000000000000000000000000000000000000"
});
console.log('*** Triggered Transaction Hash: ' + hash);
return running;
});
}

File diff suppressed because one or more lines are too long

@ -1,5 +1,6 @@
{
"deployer": "0xE78e48deF8A432Ed0e9287d5678496E759e8A564",
"_updated": "I redployed this to goerli on 2022-10-19",
"deployer": "0x75544911a6f2e69ceea374f3f7e5ea9c987ece09",
"source": "pragma solidity ^0.4.20;\npragma experimental ABIEncoderV2;\n\ncontract TestContract {\n struct TestStruct {\n address p0;\n uint256 p1;\n }\n\n struct TestStructParent {\n address p0;\n uint256 p1;\n TestStruct child;\n }\n\n event Test(address p0, uint256 p2);\n event TestP0(address indexed p0, uint256 p2);\n event TestP0P1(address indexed p0, uint256 indexed p2);\n\n event TestAnon(address p0, uint256 p2) anonymous;\n event TestAnonP0(address indexed p0, uint256 p2) anonymous;\n event TestAnonP0P1(address indexed p0, uint256 indexed p2) anonymous;\n\n event TestIndexedString(string indexed p2, uint256 p1);\n\n event TestV2(TestStruct indexed p0, TestStruct p1);\n event TestV2Nested(TestStructParent indexed p0, TestStructParent p1);\n\n /*\n event TestV2Array(TestStruct indexed p0[2], TestStruct p1[2]);\n event TestV2NestedArray(TestStructParent indexed p0[2], TestStructParent p1[2]);\n\n event TestV2DynamicArray(TestStruct indexed p0[], TestStruct p1[]);\n event TestV2NestedDynamicArray(TestStructParent indexed p0[], TestStructParent p1[]);\n */\n\n event TestHash(string name, bytes32 hash);\n\n function testEvents(address p0, uint256 p1, string p2) public {\n\n Test(p0, p1);\n TestP0(p0, p1);\n TestP0P1(p0, p1);\n\n TestAnon(p0, p1);\n TestAnonP0(p0, p1);\n TestAnonP0P1(p0, p1);\n\n TestIndexedString(p2, p1);\n\n TestStruct memory testStruct;\n testStruct.p0 = p0;\n testStruct.p1 = p1;\n\n TestStructParent memory testStructParent;\n testStructParent.p0 = address(uint160(p0) + 1);\n testStructParent.p1 = p1 + 1;\n testStructParent.child = testStruct;\n\n TestV2(testStruct, testStruct);\n TestV2Nested(testStructParent, testStructParent);\n\n TestHash(\"TestStructKeccak256\", keccak256(testStruct));\n TestHash(\"TestStructParentKeccak256\", keccak256(testStructParent));\n }\n\n function testV2(TestStructParent p0) public pure returns (TestStructParent result) {\n p0.p0 = address(uint160(p0.p0) + 0xf0);\n p0.p1 += 0xf0;\n p0.child.p0 = address(uint160(p0.child.p0) + 0x0f);\n p0.child.p1 += 0x0f;\n\n return p0;\n }\n\n function testSingleResult(uint32 p0) public pure returns (uint32 r0) {\n r0 = p0 + 1;\n }\n\n function testMultiResult(uint32 p0) public pure returns (uint32 r0, uint32 r1) {\n r0 = p0 + 1;\n r1 = p0 + 2;\n }\n}\n",
"optimize": 1,
"timestamp": 1528239748494,
@ -14,7 +15,7 @@
"interface": "[{\"constant\":true,\"inputs\":[{\"name\":\"p0\",\"type\":\"uint32\"}],\"name\":\"testSingleResult\",\"outputs\":[{\"name\":\"r0\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"p0\",\"type\":\"uint32\"}],\"name\":\"testMultiResult\",\"outputs\":[{\"name\":\"r0\",\"type\":\"uint32\"},{\"name\":\"r1\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"name\":\"p0\",\"type\":\"tuple\"}],\"name\":\"testV2\",\"outputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"name\":\"result\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"name\":\"p2\",\"type\":\"string\"}],\"name\":\"testEvents\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"Test\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestP0\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestP0P1\",\"type\":\"event\"},{\"anonymous\":true,\"inputs\":[{\"indexed\":false,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestAnon\",\"type\":\"event\"},{\"anonymous\":true,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestAnonP0\",\"type\":\"event\"},{\"anonymous\":true,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestAnonP0P1\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"p2\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"TestIndexedString\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"indexed\":true,\"name\":\"p0\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"indexed\":false,\"name\":\"p1\",\"type\":\"tuple\"}],\"name\":\"TestV2\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"indexed\":true,\"name\":\"p0\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"indexed\":false,\"name\":\"p1\",\"type\":\"tuple\"}],\"name\":\"TestV2Nested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"TestHash\",\"type\":\"event\"}]",
"runtimeBytecode": "0x6060604052600436106100615763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663132414eb811461006657806361096af31461009a57806370e4a0e6146100c6578063babf8901146100f1575b600080fd5b341561007157600080fd5b61008461007f36600461063d565b610111565b60405161009191906107b5565b60405180910390f35b34156100a557600080fd5b6100b86100b336600461063d565b610117565b6040516100919291906107c3565b34156100d157600080fd5b6100e46100df366004610617565b610124565b604051610091919061078b565b34156100fc57600080fd5b61010f61010a3660046105b2565b61017b565b005b60010190565b6001810191600290910190565b61012c610453565b8151600160a060020a0360f09182011683526020830181815101905250604082015151600f018260400151600160a060020a039091169052600f60408301516020018181510190525090919050565b610183610479565b61018b610453565b7f4ba54330f8090ac87ed0a0b470fd9c8a6bbec84bfe94f4fa7776d1dc27da9f9c85856040516101bc92919061073b565b60405180910390a184600160a060020a03167f02d0f5cbd3582d62980b4541ea596241400b46b70e62e8f5d4191b59e5256b79856040516101fd91906107a7565b60405180910390a28385600160a060020a03167f259f1a317c656f6d04907e133c9444121c489db10cc9ae0cb8e5089fb24579bd60405160405180910390a3848460405161024c92919061073b565b60405180910390a084600160a060020a03168460405161026c91906107a7565b60405180910390a18385600160a060020a031660405160405180910390a2826040518082805190602001908083835b602083106102ba5780518252601f19909201916020918201910161029b565b6001836020036101000a038019825116818451161790925250505091909101925060409150505180910390207f64c167146cf1edcaf437640ce9016042b5d80b35064b04ad29af4b8b1420db908560405161031591906107a7565b60405180910390a2600160a060020a03808616835260208084018690526001808801909216835290850190820152604080820183905282907fe85f025e05a85adc87cd1791754b085143ee32261f66e8b6118e8229b494dcdb9082905161037c9190610799565b60405180910390a2807fe0f519dd634b43e6774158c4064aeaeb81762b6577a8c8b8c65b53053fd915fc826040516103b4919061078b565b60405180910390a27fd8b63a613757c85c5a7bc41a52505a0a5d424f9c1a0cdb6d86c53af2f392d8188260405190815260200160405180910390206040516103fc9190610756565b60405180910390a17fd8b63a613757c85c5a7bc41a52505a0a5d424f9c1a0cdb6d86c53af2f392d818816040519081526020016040518091039020604051610444919061077b565b60405180910390a15050505050565b60806040519081016040908152600080835260208301528101610474610479565b905290565b604080519081016040526000808252602082015290565b600061049c8235610831565b9392505050565b6000601f82018390126104b557600080fd5b81356104c86104c382610809565b6107de565b915080825260208301602083018583830111156104e457600080fd5b6104ef838284610849565b50505092915050565b60006080828403121561050a57600080fd5b61051460606107de565b905060006105228484610490565b82525060206105338484830161059a565b602083015250604061054784828501610553565b60408301525092915050565b60006040828403121561056557600080fd5b61056f60406107de565b9050600061057d8484610490565b825250602061058e8484830161059a565b60208301525092915050565b600061049c823561083d565b600061049c8235610840565b6000806000606084860312156105c757600080fd5b60006105d38686610490565b93505060206105e48682870161059a565b925050604084013567ffffffffffffffff81111561060157600080fd5b61060d868287016104a3565b9150509250925092565b60006080828403121561062957600080fd5b600061063584846104f8565b949350505050565b60006020828403121561064f57600080fd5b600061063584846105a6565b61066481610831565b82525050565b6106648161083d565b601381527f546573745374727563744b656363616b32353600000000000000000000000000602082015260400190565b601981527f54657374537472756374506172656e744b656363616b32353600000000000000602082015260400190565b6080820181516106e3848261065b565b5060208201516106f6602085018261066a565b506040820151610709604085018261070f565b50505050565b60408201815161071f848261065b565b506020820151610709602085018261066a565b61066481610840565b60408101610749828561065b565b61049c602083018461066a565b6040808252810161076681610673565b9050610775602083018461066a565b92915050565b60408082528101610766816106a3565b6080810161077582846106d3565b60408101610775828461070f565b60208101610775828461066a565b602081016107758284610732565b604081016107d18285610732565b61049c6020830184610732565b6000604051905081810181811067ffffffffffffffff8211171561080157600080fd5b604052919050565b600067ffffffffffffffff82111561082057600080fd5b506020601f91909101601f19160190565b600160a060020a031690565b90565b63ffffffff1690565b828183375060009101525600a265627a7a72305820738426ffc61b45a331eec053537d02526e13fd71949a31290da38ec04e43f1f46c6578706572696d656e74616cf50037",
"transactionHash": "0x19d1edeaa4f9b40cd0f08e8896bba04d1e74b97ddf4dabaa36e852512edf189d",
"contractAddress": "0x94d28bB6cd09f0488039a1870FbDB496Bc6ce98B",
"contractAddress": "0x63c5bd7ef280f150aca761a5e9a922959eb26732",
"blockHash": "0xa5d83b96fb8002004d31ab6a5e20c48f6928169dae8bc70257b115f950e9d39c",
"blockNumber": 2411314
}

@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
import assert from "assert";
//import Web3HttpProvider from "web3-providers-http";
import { ethers } from "ethers";
import { fundAddress, returnFunds } from "./utils";
const bnify = ethers.BigNumber.from;
const blockchainData = {
homestead: {
@ -638,23 +639,14 @@ testFunctions.push({
});
describe("Test Provider Methods", function () {
let fundReceipt = null;
const provider = new ethers.providers.InfuraProvider("goerli", getApiKeys("goerli").infura);
let faucetWallet;
try {
faucetWallet = new ethers.Wallet(process.env.FAUCET_PRIVATEKEY, provider);
}
catch (error) {
console.log("ERROR getting faucet", error);
}
before(function () {
return __awaiter(this, void 0, void 0, function* () {
this.timeout(300000);
// Get some ether from the faucet
//const funder = await ethers.utils.fetchJson(`https:/\/api.ethers.io/api/v1/?action=fundAccount&address=${ fundWallet.address.toLowerCase() }`);
const tx = yield faucetWallet.sendTransaction({ to: fundWallet.address, value: "314159265358979323" });
fundReceipt = tx.wait(); //provider.waitForTransaction(funder.hash);
fundReceipt.then((receipt) => {
fundReceipt = fundAddress(fundWallet.address).then((hash) => {
console.log(`*** Funded: ${fundWallet.address}`);
return hash;
});
});
});
@ -664,16 +656,8 @@ describe("Test Provider Methods", function () {
// Wait until the funding is complete
yield fundReceipt;
// Refund all unused ether to the faucet
const provider = new ethers.providers.InfuraProvider("goerli", getApiKeys("goerli").infura);
const gasPrice = yield provider.getGasPrice();
const balance = yield provider.getBalance(fundWallet.address);
const tx = yield fundWallet.connect(provider).sendTransaction({
to: faucetWallet.address,
gasLimit: 21000,
gasPrice: gasPrice,
value: balance.sub(gasPrice.mul(21000))
});
console.log(`*** Sweep Transaction:`, tx.hash);
const hash = yield returnFunds(fundWallet);
console.log(`*** Sweep Transaction:`, hash);
});
});
providerFunctions.forEach(({ name, networks, create }) => {

File diff suppressed because one or more lines are too long

@ -1,6 +1,10 @@
import { ethers } from "ethers";
declare function randomBytes(seed: string, lower: number, upper?: number): Uint8Array;
declare function randomHexString(seed: string, lower: number, upper?: number): string;
declare function randomNumber(seed: string, lower: number, upper: number): number;
declare function equals(a: any, b: any): boolean;
export declare function fundAddress(address: string): Promise<string>;
export declare function returnFunds(wallet: ethers.Wallet): Promise<string>;
export declare function sendTransaction(txObj: ethers.providers.TransactionRequest): Promise<string>;
export { randomBytes, randomHexString, randomNumber, equals };
//# sourceMappingURL=utils.d.ts.map

@ -1 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAMA,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAc5E;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,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ul ignore file */
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { ethers } from "ethers";
function randomBytes(seed, lower, upper) {
if (!upper) {
@ -59,5 +68,74 @@ function equals(a, b) {
// Something else
return a === b;
}
function getWallet() {
const provider = new ethers.providers.InfuraProvider("goerli", "49a0efa3aaee4fd99797bfa94d8ce2f1");
let key = null;
// browser
if (key == null) {
try {
if (typeof window !== "undefined") {
key = window.__karma__.config.args[0];
if (typeof (key) !== "string") {
key = null;
}
}
}
catch (error) { }
}
// node.js
if (key == null) {
try {
key = process.env.FAUCET_PRIVATEKEY;
if (typeof (key) !== "string") {
key = null;
}
}
catch (error) { }
}
if (key == null) {
throw new Error("could not find faucet private key");
}
return new ethers.Wallet(key, provider);
}
export function fundAddress(address) {
return __awaiter(this, void 0, void 0, function* () {
try {
const faucetWallet = getWallet();
const tx = yield faucetWallet.sendTransaction({
to: address,
value: "314159265358979323"
});
return tx.wait().then((resp) => resp.transactionHash);
}
catch (error) {
console.log("ERROR getting faucet", error);
throw error;
}
});
}
export function returnFunds(wallet) {
return __awaiter(this, void 0, void 0, function* () {
const faucet = getWallet();
const provider = faucet.provider;
// Refund all unused ether to the faucet
const gasPrice = yield provider.getGasPrice();
const balance = yield provider.getBalance(wallet.address);
const tx = yield wallet.connect(provider).sendTransaction({
to: faucet.address,
gasLimit: 21000,
gasPrice: gasPrice,
value: balance.sub(gasPrice.mul(21000))
});
return tx.hash;
});
}
export function sendTransaction(txObj) {
return __awaiter(this, void 0, void 0, function* () {
const wallet = getWallet();
const tx = yield wallet.sendTransaction(txObj);
return tx.hash;
});
}
export { randomBytes, randomHexString, randomNumber, equals };
//# sourceMappingURL=utils.js.map

@ -1 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,YAAY,CAAC;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa,EAAE,KAAc;IAC5D,IAAI,CAAC,KAAK,EAAE;QAAE,KAAK,GAAG,KAAK,CAAC;KAAE;IAE9B,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,KAAK,EAAE;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;KAAE;IAEjE,IAAI,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC3F,OAAO,MAAM,CAAC,MAAM,GAAG,KAAK,EAAE;QAC1B,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACvG;IAED,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,IAAI,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC;IAErE,OAAO,MAAM,CAAC,KAAK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f75e05A3E449f1E";
var addr = "0x9FC52a97e59aeea064D9c24a383B70e8475b3e0B";
it("testError1", function () {
return __awaiter(this, void 0, void 0, function () {
var provider, contract, result, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
provider = new ethers_1.ethers.providers.InfuraProvider("ropsten", "49a0efa3aaee4fd99797bfa94d8ce2f1");
provider = new ethers_1.ethers.providers.InfuraProvider("goerli", "49a0efa3aaee4fd99797bfa94d8ce2f1");
contract = new ethers_1.ethers.Contract(addr, [
"function testError1(bool pass, address addr, uint256 value) pure returns (bool)",
"function testError2(bool pass, bytes data) pure returns (bool)",
@ -592,8 +592,9 @@ describe("Additional test cases", function () {
var iface = new ethers_1.ethers.utils.Interface([
"function test(address foo) view returns (bool)"
]);
var tx = iface.encodeFunctionData("test", ["c1912fee45d61c87cc5ea59dae31190fffff232d"]);
console.log(tx);
//const tx =
iface.encodeFunctionData("test", ["c1912fee45d61c87cc5ea59dae31190fffff232d"]);
//console.log(tx);
});
});
//# sourceMappingURL=test-contract-interface.js.map

File diff suppressed because one or more lines are too long

@ -41,8 +41,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
var assert_1 = __importDefault(require("assert"));
var ethers_1 = require("ethers");
var utils_1 = require("./utils");
var test_contract_json_1 = __importDefault(require("./test-contract.json"));
var provider = new ethers_1.ethers.providers.InfuraProvider("rinkeby", "49a0efa3aaee4fd99797bfa94d8ce2f1");
var provider = new ethers_1.ethers.providers.InfuraProvider("goerli", "49a0efa3aaee4fd99797bfa94d8ce2f1");
//const provider = ethers.getDefaultProvider("rinkeby");
var TIMEOUT_PERIOD = 120000;
var contract = (function () {
@ -107,7 +108,7 @@ function TestContractEvents() {
}
});
}
var running, data;
var running, hash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@ -127,10 +128,13 @@ function TestContractEvents() {
resolve(result);
});
});
return [4 /*yield*/, ethers_1.ethers.utils.fetchJson('https://api.ethers.io/api/v1/?action=triggerTest&address=' + contract.address)];
return [4 /*yield*/, (0, utils_1.sendTransaction)({
to: "0x63c5bd7ef280f150aca761a5e9a922959eb26732",
data: "0xbabf890100000000000000000000000006b5955a67d827cdf91823e3bb8f069e6c89c1d600000000000000000000000000000000000000000000000000000000000000420000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000a48656c6c6f576f726c6400000000000000000000000000000000000000000000"
})];
case 1:
data = _a.sent();
console.log('*** Triggered Transaction Hash: ' + data.hash);
hash = _a.sent();
console.log('*** Triggered Transaction Hash: ' + hash);
return [2 /*return*/, running];
}
});

File diff suppressed because one or more lines are too long

@ -1,5 +1,6 @@
{
"deployer": "0xE78e48deF8A432Ed0e9287d5678496E759e8A564",
"_updated": "I redployed this to goerli on 2022-10-19",
"deployer": "0x75544911a6f2e69ceea374f3f7e5ea9c987ece09",
"source": "pragma solidity ^0.4.20;\npragma experimental ABIEncoderV2;\n\ncontract TestContract {\n struct TestStruct {\n address p0;\n uint256 p1;\n }\n\n struct TestStructParent {\n address p0;\n uint256 p1;\n TestStruct child;\n }\n\n event Test(address p0, uint256 p2);\n event TestP0(address indexed p0, uint256 p2);\n event TestP0P1(address indexed p0, uint256 indexed p2);\n\n event TestAnon(address p0, uint256 p2) anonymous;\n event TestAnonP0(address indexed p0, uint256 p2) anonymous;\n event TestAnonP0P1(address indexed p0, uint256 indexed p2) anonymous;\n\n event TestIndexedString(string indexed p2, uint256 p1);\n\n event TestV2(TestStruct indexed p0, TestStruct p1);\n event TestV2Nested(TestStructParent indexed p0, TestStructParent p1);\n\n /*\n event TestV2Array(TestStruct indexed p0[2], TestStruct p1[2]);\n event TestV2NestedArray(TestStructParent indexed p0[2], TestStructParent p1[2]);\n\n event TestV2DynamicArray(TestStruct indexed p0[], TestStruct p1[]);\n event TestV2NestedDynamicArray(TestStructParent indexed p0[], TestStructParent p1[]);\n */\n\n event TestHash(string name, bytes32 hash);\n\n function testEvents(address p0, uint256 p1, string p2) public {\n\n Test(p0, p1);\n TestP0(p0, p1);\n TestP0P1(p0, p1);\n\n TestAnon(p0, p1);\n TestAnonP0(p0, p1);\n TestAnonP0P1(p0, p1);\n\n TestIndexedString(p2, p1);\n\n TestStruct memory testStruct;\n testStruct.p0 = p0;\n testStruct.p1 = p1;\n\n TestStructParent memory testStructParent;\n testStructParent.p0 = address(uint160(p0) + 1);\n testStructParent.p1 = p1 + 1;\n testStructParent.child = testStruct;\n\n TestV2(testStruct, testStruct);\n TestV2Nested(testStructParent, testStructParent);\n\n TestHash(\"TestStructKeccak256\", keccak256(testStruct));\n TestHash(\"TestStructParentKeccak256\", keccak256(testStructParent));\n }\n\n function testV2(TestStructParent p0) public pure returns (TestStructParent result) {\n p0.p0 = address(uint160(p0.p0) + 0xf0);\n p0.p1 += 0xf0;\n p0.child.p0 = address(uint160(p0.child.p0) + 0x0f);\n p0.child.p1 += 0x0f;\n\n return p0;\n }\n\n function testSingleResult(uint32 p0) public pure returns (uint32 r0) {\n r0 = p0 + 1;\n }\n\n function testMultiResult(uint32 p0) public pure returns (uint32 r0, uint32 r1) {\n r0 = p0 + 1;\n r1 = p0 + 2;\n }\n}\n",
"optimize": 1,
"timestamp": 1528239748494,
@ -14,7 +15,7 @@
"interface": "[{\"constant\":true,\"inputs\":[{\"name\":\"p0\",\"type\":\"uint32\"}],\"name\":\"testSingleResult\",\"outputs\":[{\"name\":\"r0\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"p0\",\"type\":\"uint32\"}],\"name\":\"testMultiResult\",\"outputs\":[{\"name\":\"r0\",\"type\":\"uint32\"},{\"name\":\"r1\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"name\":\"p0\",\"type\":\"tuple\"}],\"name\":\"testV2\",\"outputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"name\":\"result\",\"type\":\"tuple\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"name\":\"p2\",\"type\":\"string\"}],\"name\":\"testEvents\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"Test\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestP0\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestP0P1\",\"type\":\"event\"},{\"anonymous\":true,\"inputs\":[{\"indexed\":false,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestAnon\",\"type\":\"event\"},{\"anonymous\":true,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestAnonP0\",\"type\":\"event\"},{\"anonymous\":true,\"inputs\":[{\"indexed\":true,\"name\":\"p0\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"p2\",\"type\":\"uint256\"}],\"name\":\"TestAnonP0P1\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"p2\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"TestIndexedString\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"indexed\":true,\"name\":\"p0\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"indexed\":false,\"name\":\"p1\",\"type\":\"tuple\"}],\"name\":\"TestV2\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"indexed\":true,\"name\":\"p0\",\"type\":\"tuple\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"},{\"components\":[{\"name\":\"p0\",\"type\":\"address\"},{\"name\":\"p1\",\"type\":\"uint256\"}],\"name\":\"child\",\"type\":\"tuple\"}],\"indexed\":false,\"name\":\"p1\",\"type\":\"tuple\"}],\"name\":\"TestV2Nested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"name\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"hash\",\"type\":\"bytes32\"}],\"name\":\"TestHash\",\"type\":\"event\"}]",
"runtimeBytecode": "0x6060604052600436106100615763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663132414eb811461006657806361096af31461009a57806370e4a0e6146100c6578063babf8901146100f1575b600080fd5b341561007157600080fd5b61008461007f36600461063d565b610111565b60405161009191906107b5565b60405180910390f35b34156100a557600080fd5b6100b86100b336600461063d565b610117565b6040516100919291906107c3565b34156100d157600080fd5b6100e46100df366004610617565b610124565b604051610091919061078b565b34156100fc57600080fd5b61010f61010a3660046105b2565b61017b565b005b60010190565b6001810191600290910190565b61012c610453565b8151600160a060020a0360f09182011683526020830181815101905250604082015151600f018260400151600160a060020a039091169052600f60408301516020018181510190525090919050565b610183610479565b61018b610453565b7f4ba54330f8090ac87ed0a0b470fd9c8a6bbec84bfe94f4fa7776d1dc27da9f9c85856040516101bc92919061073b565b60405180910390a184600160a060020a03167f02d0f5cbd3582d62980b4541ea596241400b46b70e62e8f5d4191b59e5256b79856040516101fd91906107a7565b60405180910390a28385600160a060020a03167f259f1a317c656f6d04907e133c9444121c489db10cc9ae0cb8e5089fb24579bd60405160405180910390a3848460405161024c92919061073b565b60405180910390a084600160a060020a03168460405161026c91906107a7565b60405180910390a18385600160a060020a031660405160405180910390a2826040518082805190602001908083835b602083106102ba5780518252601f19909201916020918201910161029b565b6001836020036101000a038019825116818451161790925250505091909101925060409150505180910390207f64c167146cf1edcaf437640ce9016042b5d80b35064b04ad29af4b8b1420db908560405161031591906107a7565b60405180910390a2600160a060020a03808616835260208084018690526001808801909216835290850190820152604080820183905282907fe85f025e05a85adc87cd1791754b085143ee32261f66e8b6118e8229b494dcdb9082905161037c9190610799565b60405180910390a2807fe0f519dd634b43e6774158c4064aeaeb81762b6577a8c8b8c65b53053fd915fc826040516103b4919061078b565b60405180910390a27fd8b63a613757c85c5a7bc41a52505a0a5d424f9c1a0cdb6d86c53af2f392d8188260405190815260200160405180910390206040516103fc9190610756565b60405180910390a17fd8b63a613757c85c5a7bc41a52505a0a5d424f9c1a0cdb6d86c53af2f392d818816040519081526020016040518091039020604051610444919061077b565b60405180910390a15050505050565b60806040519081016040908152600080835260208301528101610474610479565b905290565b604080519081016040526000808252602082015290565b600061049c8235610831565b9392505050565b6000601f82018390126104b557600080fd5b81356104c86104c382610809565b6107de565b915080825260208301602083018583830111156104e457600080fd5b6104ef838284610849565b50505092915050565b60006080828403121561050a57600080fd5b61051460606107de565b905060006105228484610490565b82525060206105338484830161059a565b602083015250604061054784828501610553565b60408301525092915050565b60006040828403121561056557600080fd5b61056f60406107de565b9050600061057d8484610490565b825250602061058e8484830161059a565b60208301525092915050565b600061049c823561083d565b600061049c8235610840565b6000806000606084860312156105c757600080fd5b60006105d38686610490565b93505060206105e48682870161059a565b925050604084013567ffffffffffffffff81111561060157600080fd5b61060d868287016104a3565b9150509250925092565b60006080828403121561062957600080fd5b600061063584846104f8565b949350505050565b60006020828403121561064f57600080fd5b600061063584846105a6565b61066481610831565b82525050565b6106648161083d565b601381527f546573745374727563744b656363616b32353600000000000000000000000000602082015260400190565b601981527f54657374537472756374506172656e744b656363616b32353600000000000000602082015260400190565b6080820181516106e3848261065b565b5060208201516106f6602085018261066a565b506040820151610709604085018261070f565b50505050565b60408201815161071f848261065b565b506020820151610709602085018261066a565b61066481610840565b60408101610749828561065b565b61049c602083018461066a565b6040808252810161076681610673565b9050610775602083018461066a565b92915050565b60408082528101610766816106a3565b6080810161077582846106d3565b60408101610775828461070f565b60208101610775828461066a565b602081016107758284610732565b604081016107d18285610732565b61049c6020830184610732565b6000604051905081810181811067ffffffffffffffff8211171561080157600080fd5b604052919050565b600067ffffffffffffffff82111561082057600080fd5b506020601f91909101601f19160190565b600160a060020a031690565b90565b63ffffffff1690565b828183375060009101525600a265627a7a72305820738426ffc61b45a331eec053537d02526e13fd71949a31290da38ec04e43f1f46c6578706572696d656e74616cf50037",
"transactionHash": "0x19d1edeaa4f9b40cd0f08e8896bba04d1e74b97ddf4dabaa36e852512edf189d",
"contractAddress": "0x94d28bB6cd09f0488039a1870FbDB496Bc6ce98B",
"contractAddress": "0x63c5bd7ef280f150aca761a5e9a922959eb26732",
"blockHash": "0xa5d83b96fb8002004d31ab6a5e20c48f6928169dae8bc70257b115f950e9d39c",
"blockNumber": 2411314
}

@ -42,6 +42,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
var assert_1 = __importDefault(require("assert"));
//import Web3HttpProvider from "web3-providers-http";
var ethers_1 = require("ethers");
var utils_1 = require("./utils");
var bnify = ethers_1.ethers.BigNumber.from;
var blockchainData = {
homestead: {
@ -767,36 +768,23 @@ testFunctions.push({
});
describe("Test Provider Methods", function () {
var fundReceipt = null;
var provider = new ethers_1.ethers.providers.InfuraProvider("goerli", getApiKeys("goerli").infura);
var faucetWallet;
try {
faucetWallet = new ethers_1.ethers.Wallet(process.env.FAUCET_PRIVATEKEY, provider);
}
catch (error) {
console.log("ERROR getting faucet", error);
}
before(function () {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.timeout(300000);
return [4 /*yield*/, faucetWallet.sendTransaction({ to: fundWallet.address, value: "314159265358979323" })];
case 1:
tx = _a.sent();
fundReceipt = tx.wait(); //provider.waitForTransaction(funder.hash);
fundReceipt.then(function (receipt) {
console.log("*** Funded: " + fundWallet.address);
});
return [2 /*return*/];
}
this.timeout(300000);
// Get some ether from the faucet
//const funder = await ethers.utils.fetchJson(`https:/\/api.ethers.io/api/v1/?action=fundAccount&address=${ fundWallet.address.toLowerCase() }`);
fundReceipt = (0, utils_1.fundAddress)(fundWallet.address).then(function (hash) {
console.log("*** Funded: " + fundWallet.address);
return hash;
});
return [2 /*return*/];
});
});
});
after(function () {
return __awaiter(this, void 0, void 0, function () {
var provider, gasPrice, balance, tx;
var hash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
@ -806,22 +794,10 @@ describe("Test Provider Methods", function () {
case 1:
// Wait until the funding is complete
_a.sent();
provider = new ethers_1.ethers.providers.InfuraProvider("goerli", getApiKeys("goerli").infura);
return [4 /*yield*/, provider.getGasPrice()];
return [4 /*yield*/, (0, utils_1.returnFunds)(fundWallet)];
case 2:
gasPrice = _a.sent();
return [4 /*yield*/, provider.getBalance(fundWallet.address)];
case 3:
balance = _a.sent();
return [4 /*yield*/, fundWallet.connect(provider).sendTransaction({
to: faucetWallet.address,
gasLimit: 21000,
gasPrice: gasPrice,
value: balance.sub(gasPrice.mul(21000))
})];
case 4:
tx = _a.sent();
console.log("*** Sweep Transaction:", tx.hash);
hash = _a.sent();
console.log("*** Sweep Transaction:", hash);
return [2 /*return*/];
}
});

File diff suppressed because one or more lines are too long

@ -1,6 +1,10 @@
import { ethers } from "ethers";
declare function randomBytes(seed: string, lower: number, upper?: number): Uint8Array;
declare function randomHexString(seed: string, lower: number, upper?: number): string;
declare function randomNumber(seed: string, lower: number, upper: number): number;
declare function equals(a: any, b: any): boolean;
export declare function fundAddress(address: string): Promise<string>;
export declare function returnFunds(wallet: ethers.Wallet): Promise<string>;
export declare function sendTransaction(txObj: ethers.providers.TransactionRequest): Promise<string>;
export { randomBytes, randomHexString, randomNumber, equals };
//# sourceMappingURL=utils.d.ts.map

@ -1 +1 @@
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAMA,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAc5E;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED,iBAAS,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CA6BvC;AAED,OAAO,EACH,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,MAAM,EACT,CAAA"}
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,iBAAS,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAc5E;AAED,iBAAS,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED,iBAAS,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CA6BvC;AAgCD,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYlE;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBxE;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAIjG;AAED,OAAO,EACH,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,MAAM,EACT,CAAA"}

@ -1,7 +1,43 @@
/* istanbul ignore file */
'use strict';
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.equals = exports.randomNumber = exports.randomHexString = exports.randomBytes = void 0;
exports.equals = exports.randomNumber = exports.randomHexString = exports.randomBytes = exports.sendTransaction = exports.returnFunds = exports.fundAddress = void 0;
var ethers_1 = require("ethers");
function randomBytes(seed, lower, upper) {
if (!upper) {
@ -65,4 +101,103 @@ function equals(a, b) {
return a === b;
}
exports.equals = equals;
function getWallet() {
var provider = new ethers_1.ethers.providers.InfuraProvider("goerli", "49a0efa3aaee4fd99797bfa94d8ce2f1");
var key = null;
// browser
if (key == null) {
try {
if (typeof window !== "undefined") {
key = window.__karma__.config.args[0];
if (typeof (key) !== "string") {
key = null;
}
}
}
catch (error) { }
}
// node.js
if (key == null) {
try {
key = process.env.FAUCET_PRIVATEKEY;
if (typeof (key) !== "string") {
key = null;
}
}
catch (error) { }
}
if (key == null) {
throw new Error("could not find faucet private key");
}
return new ethers_1.ethers.Wallet(key, provider);
}
function fundAddress(address) {
return __awaiter(this, void 0, void 0, function () {
var faucetWallet, tx, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 2, , 3]);
faucetWallet = getWallet();
return [4 /*yield*/, faucetWallet.sendTransaction({
to: address,
value: "314159265358979323"
})];
case 1:
tx = _a.sent();
return [2 /*return*/, tx.wait().then(function (resp) { return resp.transactionHash; })];
case 2:
error_1 = _a.sent();
console.log("ERROR getting faucet", error_1);
throw error_1;
case 3: return [2 /*return*/];
}
});
});
}
exports.fundAddress = fundAddress;
function returnFunds(wallet) {
return __awaiter(this, void 0, void 0, function () {
var faucet, provider, gasPrice, balance, tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
faucet = getWallet();
provider = faucet.provider;
return [4 /*yield*/, provider.getGasPrice()];
case 1:
gasPrice = _a.sent();
return [4 /*yield*/, provider.getBalance(wallet.address)];
case 2:
balance = _a.sent();
return [4 /*yield*/, wallet.connect(provider).sendTransaction({
to: faucet.address,
gasLimit: 21000,
gasPrice: gasPrice,
value: balance.sub(gasPrice.mul(21000))
})];
case 3:
tx = _a.sent();
return [2 /*return*/, tx.hash];
}
});
});
}
exports.returnFunds = returnFunds;
function sendTransaction(txObj) {
return __awaiter(this, void 0, void 0, function () {
var wallet, tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
wallet = getWallet();
return [4 /*yield*/, wallet.sendTransaction(txObj)];
case 1:
tx = _a.sent();
return [2 /*return*/, tx.hash];
}
});
});
}
exports.sendTransaction = sendTransaction;
//# sourceMappingURL=utils.js.map

@ -1 +1 @@
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src.ts/utils.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,YAAY,CAAC;;;AAEb,iC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