essential-eth 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/classes/Contract.js +6 -8
- package/dist/cjs/classes/utils/fetchers.js +4 -1
- package/dist/cjs/index.umd.js +1 -1
- package/dist/cjs/index.umd.js.map +1 -1
- package/dist/cjs/logger/package-version.d.ts +1 -1
- package/dist/cjs/logger/package-version.js +1 -1
- package/dist/esm/classes/Contract.js +3 -7
- package/dist/esm/logger/package-version.d.ts +1 -1
- package/dist/esm/logger/package-version.js +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
|
@@ -11,9 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Contract = exports.defineReadOnly = exports.BaseContract = void 0;
|
|
13
13
|
const encode_decode_transaction_1 = require("./utils/encode-decode-transaction");
|
|
14
|
-
const fetchers_1 = require("./utils/fetchers");
|
|
15
14
|
/**
|
|
16
|
-
*
|
|
17
15
|
* @param txnData
|
|
18
16
|
* @example
|
|
19
17
|
*/
|
|
@@ -57,12 +55,9 @@ class BaseContract {
|
|
|
57
55
|
? estimateGas(data)
|
|
58
56
|
: null;
|
|
59
57
|
const req = () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
-
return yield (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
: {})),
|
|
64
|
-
'latest',
|
|
65
|
-
]));
|
|
58
|
+
return yield this._provider.call(Object.assign({ to: this._address.toLowerCase(), data }, (decimalGas
|
|
59
|
+
? { gas: `0x${decimalGas.toString(16)}` }
|
|
60
|
+
: {})), 'latest');
|
|
66
61
|
});
|
|
67
62
|
const nodeResponse = yield req();
|
|
68
63
|
return (0, encode_decode_transaction_1.decodeRPCResponse)(jsonABIArgument, nodeResponse);
|
|
@@ -78,6 +73,7 @@ exports.BaseContract = BaseContract;
|
|
|
78
73
|
* @param object
|
|
79
74
|
* @param name
|
|
80
75
|
* @param value
|
|
76
|
+
* @internal
|
|
81
77
|
* @example
|
|
82
78
|
*/
|
|
83
79
|
function defineReadOnly(object, name, value) {
|
|
@@ -98,6 +94,8 @@ exports.defineReadOnly = defineReadOnly;
|
|
|
98
94
|
* // UNI airdrop contract
|
|
99
95
|
* const contractAddress = '0x090D4613473dEE047c3f2706764f49E0821D256e';
|
|
100
96
|
* const provider = new JsonRpcProvider();
|
|
97
|
+
* // for more robust contract calls, provide a fallback:
|
|
98
|
+
* // const provider = new FallthroughProvider(['bad', 'https://free-eth-node.com/api/eth']);
|
|
101
99
|
*
|
|
102
100
|
* const JSONABI = [
|
|
103
101
|
* {
|
|
@@ -17,8 +17,9 @@ const isomorphic_unfetch_1 = __importDefault(require("isomorphic-unfetch"));
|
|
|
17
17
|
/**
|
|
18
18
|
* Makes a post request with the specified JSON data, normally to the a Ethereum JSON RPC API endpoint
|
|
19
19
|
*
|
|
20
|
+
* @internal
|
|
20
21
|
* @param url the URL to send the request to
|
|
21
|
-
* @param body
|
|
22
|
+
* @param body JSON POST body
|
|
22
23
|
* @returns the JSON response from the server
|
|
23
24
|
* @example
|
|
24
25
|
* ```javascript
|
|
@@ -58,6 +59,7 @@ exports.post = post;
|
|
|
58
59
|
/**
|
|
59
60
|
* Prepares data to be sent using the {@link post} function. Data is prepared per the {@link https://en.wikipedia.org/wiki/JSON-RPC#Examples JSON RPC v2 spec}
|
|
60
61
|
*
|
|
62
|
+
* @internal
|
|
61
63
|
* @param method the RPC method to be invoked
|
|
62
64
|
* @param params the parameters to be passed to the defined method
|
|
63
65
|
* @returns a POST method body matching the {@link https://en.wikipedia.org/wiki/JSON-RPC#Examples JSON RPC v2 spec}
|
|
@@ -73,6 +75,7 @@ exports.post = post;
|
|
|
73
75
|
function buildRPCPostBody(method, params) {
|
|
74
76
|
return {
|
|
75
77
|
jsonrpc: '2.0',
|
|
78
|
+
// TODO: Increment ID will be needed when websocket support is added
|
|
76
79
|
id: 1,
|
|
77
80
|
method,
|
|
78
81
|
params,
|