Compare commits

..
Author SHA1 Message Date
Luis Fernando Molina 5b52de8153 Merge pull request #1085 from Superalgos/develop
Beta 10 Release
2021-06-05 10:35:00 -04:00
Luis Fernando Molina db855b27ad Merge pull request #1084 from Superalgos/plugins-docs
Plugins docs into Develop
2021-06-05 10:26:45 -04:00
Luis Fernando Molina cabe806c1e Merge pull request #1083 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Demo Workspace cleaned
2021-06-05 10:20:45 -04:00
Luis Fernando Molina 8e703c2f0a API Data Fetcher Demo Workspace cleaned 2021-06-05 16:16:33 +02:00
Luis Fernando Molina 3cf13a37d0 Merge pull request #1081 from harrellbm/develop
Initial API Map and Mine docs edited and complete
2021-06-05 09:04:16 -04:00
Luis Fernando Molina cfa0a51fca Merge pull request #1078 from Smidy13/develop
Bug Fix: Display Error if Trading System Formula Evaluates as Undefined
2021-06-05 09:03:55 -04:00
B Harrell 15edbc807d Merge branch 'Superalgos:develop' into develop 2021-06-05 07:45:05 -05:00
Brenden Harrell cdb945b99b Initial API Map and Mine docs edited and complete 2021-06-05 07:43:54 -05:00
Julian Molina f18d9953ec Merge pull request #1079 from julian-molina/develop
Contribution: Small fixes to user variables docs
2021-06-05 12:21:32 +02:00
Julian Molina 1d2dc5a646 Merge branch 'develop' into develop 2021-06-05 12:21:23 +02:00
Julian Molina 4750803fae Small fixes to user variables docs 2021-06-05 12:19:45 +02:00
Smidy13 68697c7280 Bug Fix: Display Error if Trading System Formula Evaluates as Undefined 2021-06-05 16:51:25 +12:00
Luis Fernando Molina b3d37de39f Merge pull request #1077 from harrellbm/develop
Finish API Map node docs
2021-06-05 00:03:19 -04:00
Brenden Harrell ebe64b7f8e Finish API Map node docs 2021-06-04 22:41:48 -05:00
Julian Molina 1629752c80 Merge pull request #1076 from PLuv/develop
Change: Small change to complete user-defined-variables docs
2021-06-04 19:56:13 +02:00
Julian Molina b9647c1a35 Merge pull request #1075 from GENS-Tools/plugins-docs
Contribution: My Superalgos Review
2021-06-04 19:55:37 +02:00
Philip Love d0d25c42a3 Change: Small change to complete user-defined-variables docs 2021-06-04 13:45:39 -04:00
GENS-Tools 9c6a2a06a8 My Superalgos Review 2021-06-04 17:33:51 +02:00
Luis Fernando Molina a2c2e9e49c Merge pull request #1074 from harrellbm/develop
Optimize Coingecko API Map and Start on API Map docs
2021-06-03 23:04:27 -04:00
Brenden Harrell 25c007fb3f Start on API Map node docs 2021-06-03 21:49:34 -05:00
Brenden Harrell d3ff0c5c49 API Map config fix 2021-06-03 21:49:13 -05:00
Brenden Harrell b80b04a905 Optimize CoinGecko API Map with Query Parameters 2021-06-03 18:53:29 -05:00
Luis Fernando Molina dc9fa31163 Merge pull request #1071 from Smidy13/develop
Bug Fix: Tutorials Load for Plugin Workspaces
2021-06-03 07:51:07 -04:00
Luis Fernando Molina bc121adef5 Merge pull request #1069 from harrellbm/develop
Harden replaceBy config options, update coingecko map and add docs
2021-06-03 07:50:18 -04:00
Julian Molina 8dd57b239e Merge pull request #1070 from PLuv/develop
Add: Pluvtech Data Mine Docs
2021-06-03 13:27:55 +02:00
Smidy13 98cca71c5a Bug Fix: Load Tutorials for Plugins Workspaces 2021-06-03 23:23:51 +12:00
Smidy13 42741386f3 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-06-03 21:40:41 +12:00
Philip Love 76120c1028 Add: Pluvtech Data Mine Docs 2021-06-03 01:13:14 -04:00
B Harrell ee955824fb Merge branch 'Superalgos:develop' into develop 2021-06-02 22:31:42 -05:00
Brenden Harrell c35727f919 Docs for CoinGecko Api Map and Mine 2021-06-02 22:22:26 -05:00
Brenden Harrell 13119ad755 Update CoinGecko Api Map 2021-06-02 22:20:15 -05:00
Brenden Harrell 39e567c057 Harden replaceBy config options 2021-06-02 22:19:56 -05:00
Luis Fernando Molina de4e257a7e Merge pull request #1066 from harrellbm/develop
Initial CoinGecko Api map and data mine
2021-06-02 15:45:27 -04:00
Brenden Harrell d2c49e91be Initial CoinGecko Api map and data mine 2021-06-02 12:54:12 -05:00
Luis Fernando Molina 63c2b8dcf9 Merge pull request #1064 from harrellbm/develop
Fix Aggregate Avg and Min Methods
2021-06-02 12:36:45 -04:00
Brenden Harrell c88d398d5f Fix Aggregate Avg and Min Methods 2021-06-02 11:14:08 -05:00
Julian Molina 76b6fa4eb3 Merge pull request #1062 from julian-molina/develop
Contribution: Getting started tutorials repagination
2021-06-02 17:43:46 +02:00
Julian Molina 36b5856bbc Getting started tutorials repagination 2021-06-02 17:34:11 +02:00
Julian Molina 6b29a47117 Merge pull request #1061 from julian-molina/develop
Contribution: Mention of API Maps in Basic Education
2021-06-02 17:26:23 +02:00
Julian Molina 4ac8f90eee Mention of API Maps in Basic Education 2021-06-02 17:07:21 +02:00
Brenden Harrell 9971d6aa16 Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-06-02 09:22:11 -05:00
Brenden Harrell 894eada595 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-06-02 09:20:40 -05:00
B Harrell b0000d1439 Merge branch 'Superalgos:develop' into develop 2021-06-02 09:19:14 -05:00
Luis Fernando Molina 7fda589615 Merge pull request #1059 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher bot Bug Fixed. Timestamp record property expected only as Number.
2021-06-02 08:12:11 -04:00
Luis Fernando Molina fab078f38f API Data Fetcher bot Bug Fixed. Timestamp record property expected only as Number. 2021-06-02 14:11:15 +02:00
Julian Molina 3b36eda278 Merge pull request #1058 from julian-molina/develop
Contribution: Styles in workspaces panel
2021-06-02 13:34:19 +02:00
Julian Molina a2c8d31bfc Styles in workspaces panel 2 2021-06-02 13:33:37 +02:00
Julian Molina 8ae34f3d4e Styles in workspaces panel 2021-06-02 13:29:37 +02:00
Julian Molina e4f3e9b807 Merge pull request #1057 from julian-molina/develop
Contribution: Exchanges reorg 2
2021-06-02 11:48:48 +02:00
Julian Molina f2dad9389e Continuing reorg 2021-06-02 11:46:26 +02:00
Julian Molina c860d14e1e Exchanges reorg 2 2021-06-02 11:31:58 +02:00
Julian Molina 6c4975d051 Merge pull request #1056 from julian-molina/develop
Contribution: Workspaces reorg
2021-06-02 11:16:27 +02:00
Julian Molina 08a82d52cd Workspaces reorg 2021-06-02 11:15:14 +02:00
Brenden Harrell 1790cbf752 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-06-01 15:36:38 -05:00
Julian Molina 7723636f4b Merge pull request #1054 from julian-molina/develop
Contribution: Refactoring tradingEngine.current. - tradingEngine.tradingCurrent.
2021-06-01 22:14:27 +02:00
Julian Molina 2d7f2f7a79 Refactoring tradingEngine.current. - tradingEngine.tradingCurrent. 2021-06-01 21:59:05 +02:00
Julian Molina 804fa72d5f Merge pull request #1053 from julian-molina/develop
Contribution: Exchange Key Test workspace revision
2021-06-01 21:44:28 +02:00
Julian Molina f97b6286ec Exchange Key Test workspace revision 2021-06-01 21:36:26 +02:00
B Harrell 9afcbb56b4 Merge branch 'Superalgos:develop' into develop 2021-06-01 13:22:53 -05:00
Julian Molina 51f3119ad3 Merge pull request #1052 from julian-molina/develop
Contribution: BBTP finished
2021-06-01 18:27:52 +02:00
Julian Molina d936333bff BBTP finished 2021-06-01 18:23:12 +02:00
Julian Molina dc7d19efd9 Merge pull request #1051 from julian-molina/develop
Contribution:  TSDT finished
2021-06-01 16:44:42 +02:00
Julian Molina ebd825104c TSDT finished 2021-06-01 16:42:52 +02:00
Luis Fernando Molina 1e7a8869ed Merge pull request #1050 from Luis-Fernando-Molina/develop
Contribution: replaceBy config property extended
2021-06-01 10:31:51 -04:00
Luis Fernando Molina bac0e8be04 replaceBy config property extended 2021-06-01 16:28:39 +02:00
Julian Molina e26e5664fc Merge pull request #1047 from julian-molina/develop
Contribution: WHB Workspace and Install Market tutorial ready
2021-06-01 13:12:54 +02:00
Julian Molina d252bb108c WHB Workspace and Install Market tutorial ready 2021-06-01 13:11:50 +02:00
Brenden Harrell c8443b0c68 Pull Dia Plugin 2021-05-31 18:07:35 -05:00
Brenden Harrell 91e112c756 Map and Mine for Initial Dia Data endpoint 2021-05-31 17:15:51 -05:00
Julian Molina a02f03b334 Merge pull request #1045 from julian-molina/develop
Contribution: TSDT 3rd tutorial
2021-05-31 21:49:06 +02:00
Julian Molina cf7c1652f8 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-31 21:48:18 +02:00
Julian Molina 598ebcefcc TSDT 3rd tutorial 2021-05-31 21:47:58 +02:00
Luis Fernando Molina 7e5cb6bfdf Merge pull request #1043 from PLuv/develop
Modify: PluginFilePosition auto-spawn==true per Julian request
2021-05-31 14:49:06 -04:00
Philip Love d69e1ed670 Modify: PluginFilePosition auto-spawn==true per Julian request 2021-05-31 13:22:08 -04:00
Luis Fernando Molina fe615e979f Merge pull request #1042 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher replaceBy Config Property Extended
2021-05-31 12:17:58 -04:00
Luis Fernando Molina d26ce4bde1 Merge pull request #1041 from harrellbm/develop
Data mining Docs fixes and updates
2021-05-31 12:17:21 -04:00
Luis Fernando Molina e2dc178ec1 API Data Fetcher replaceBy Config Property Extended 2021-05-31 18:16:52 +02:00
Brenden Harrell 8127696f89 Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-05-31 10:33:50 -05:00
Brenden Harrell 5875921221 Small data mining docs addtions 2021-05-31 10:33:46 -05:00
B Harrell 449c49b552 Merge branch 'Superalgos:develop' into develop 2021-05-31 10:33:18 -05:00
Luis Fernando Molina b8211fa91b Merge pull request #1040 from Luis-Fernando-Molina/develop
Contribution: Docs Improved API Data Fetcher Bot not reference at API Map Reference node
2021-05-31 11:05:19 -04:00
Luis Fernando Molina 366336097e Docs Improved API Data Fetcher Bot not reference at API Map Reference node 2021-05-31 17:05:01 +02:00
Luis Fernando Molina 597227353b Merge pull request #1038 from Luis-Fernando-Molina/develop
Contribution: -Version Branch added
2021-05-31 09:59:59 -04:00
Luis Fernando Molina 991f05c335 -Version Branch added 2021-05-31 15:56:40 +02:00
Luis Fernando Molina 8dcb1667c6 Merge pull request #1037 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher node initial value bug fixed
2021-05-31 08:54:12 -04:00
Luis Fernando Molina d8711f68b8 API Data Fetcher node initial value bug fixed 2021-05-31 14:53:35 +02:00
Luis Fernando Molina b4d8f0bba6 Merge pull request #1035 from Smidy13/develop
Bug Fix: Tutorial Reference Missing
2021-05-31 08:30:42 -04:00
Julian Molina b70b244ed0 Merge pull request #1036 from julian-molina/develop
Contribution: Trading system design tutorials, 2nd
2021-05-31 13:47:18 +02:00
Brenden Harrell b95fbf127d Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-05-31 06:40:05 -05:00
Brenden Harrell e11fe7ccd3 more typo fixes 2021-05-31 06:40:01 -05:00
B Harrell d08fd76f5e Merge branch 'Superalgos:develop' into develop 2021-05-31 06:37:31 -05:00
Julian Molina 792fef2371 Trading system design tutorials, 2nd 2021-05-31 13:07:42 +02:00
Smidy13 b85218705d Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-31 19:42:47 +12:00
Smidy13 fd130bffe2 Merge branch 'master' of https://github.com/Superalgos/Superalgos into develop 2021-05-31 19:41:54 +12:00
Smidy 2396381390 Merge branch 'Superalgos:develop' into develop 2021-05-31 19:22:34 +12:00
Smidy13 a182a2c3df Bug Fix: Tutorial Reference Missing 2021-05-31 19:11:21 +12:00
Luis Fernando Molina d72ee8ab8c Merge pull request #1034 from Superalgos/dependabot/npm_and_yarn/Client/ws-7.4.6
Bump ws from 7.2.3 to 7.4.6 in /Client
2021-05-30 19:41:22 -04:00
dependabot[bot] 1ba978d9f7 Bump ws from 7.2.3 to 7.4.6 in /Client
Bumps [ws](https://github.com/websockets/ws) from 7.2.3 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.2.3...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-30 23:19:05 +00:00
Julian Molina 2303e58844 Merge pull request #1033 from julian-molina/develop
Contribution: Beyond the basics review
2021-05-30 18:52:42 +02:00
Julian Molina 1b9c70e14b Beyond the basics review 2021-05-30 18:50:11 +02:00
Julian Molina 2694a6a401 Merge pull request #1032 from 9808us/develop
Hello World Workspace + Tutorial Fix for Beta10
2021-05-30 17:23:48 +02:00
Julian Molina 0484b55077 Merge pull request #1030 from RalfWeiss/plugins-docs
Contribution: My Superalgos Review
2021-05-30 17:23:23 +02:00
Julian Molina e68d3e4dfc Merge pull request #1026 from brombispi/plugins-docs
Contribution: Best Ever
2021-05-30 17:22:33 +02:00
9808us 94a6f7b8a8 Hello World Workspace + Tutorial Fix for Beta10 2021-05-30 16:55:22 +02:00
Luis Fernando Molina 2e28514a00 Merge pull request #1031 from 9808us/develop
Hello World Workspace fix for Beta10
2021-05-30 10:26:42 -04:00
9808us f468b146d9 Hello World Workspace Fix for Beta10 2021-05-30 16:24:24 +02:00
ralf 9532c6cdb7 My Superalgos Review 2021-05-30 15:36:25 +02:00
Julian Molina f5202e36d4 Merge pull request #1029 from julian-molina/develop
Contribution: Basic education revision complete
2021-05-30 15:01:53 +02:00
Julian Molina 9f10e4b83b Basic education revision complete 2021-05-30 15:00:27 +02:00
9808us d978df049e Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-30 13:49:40 +02:00
Julian Molina bea3bf2de4 Merge pull request #1028 from julian-molina/develop
Contribution: Basic Education pages + Masters data mine
2021-05-30 13:47:06 +02:00
Julian Molina bfc8e6931f Basic Education pages + Masters data mine 2021-05-30 13:45:43 +02:00
Julian Molina 13a2a26f73 Merge pull request #1027 from julian-molina/develop
Contribution: Welcome tutorial finished
2021-05-30 12:38:07 +02:00
Julian Molina 129001a041 Welcome tutorial finished 2021-05-30 12:35:27 +02:00
9808us 2638ad0c4d Merge branch 'master' of https://github.com/Superalgos/Superalgos into develop 2021-05-30 12:28:45 +02:00
Razvan Dumitru 8f761c5477 Best Ever 2021-05-30 09:39:04 +02:00
Razvan Dumitru b3f197482f Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-30 09:04:39 +02:00
Julian Molina 1f91a84654 Merge pull request #1017 from julian-molina/develop
Contribution: Welcome tutorial updates
2021-05-30 00:41:17 +02:00
Luis Fernando Molina 50546e05f2 Merge pull request #1025 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Bot Demo Workspace Plugin updated
2021-05-29 16:18:16 -04:00
Luis Fernando Molina 79c79c54ef API Data Fetcher Bot Demo Workspace Plugin updated 2021-05-29 22:17:03 +02:00
Luis Fernando Molina 0e0c17b0f8 Merge pull request #1024 from Luis-Fernando-Molina/develop
Contribution: Plotting Improvements
2021-05-29 15:48:11 -04:00
Luis Fernando Molina 1538ab7f47 Plotting Improvements 2021-05-29 21:47:01 +02:00
Luis Fernando Molina fd599c254e Merge pull request #1022 from PLuv/develop
Docs Updates
2021-05-29 12:41:10 -04:00
Philip Love f97a35b005 Update: Docs for Close Stage Behaviour 2021-05-29 11:10:24 -04:00
Philip Love fa64a8d37b Update: Some Docs Definitions 2021-05-29 10:56:17 -04:00
Philip Love 6b2d6847c7 Merge remote-tracking branch 'upstream/develop' into develop 2021-05-29 10:54:15 -04:00
Brenden Harrell 2f47213ab8 Type Fixes 2021-05-29 08:35:40 -05:00
Luis Fernando Molina f814a03e0a Merge pull request #1020 from harrellbm/develop
Add Package.json for API Data Fetcher Dep Install
2021-05-29 09:04:51 -04:00
Luis Fernando Molina fbf6bd9339 Merge pull request #1021 from Luis-Fernando-Molina/develop
Contribution: Docs Imprevementes - Questions Answered
2021-05-29 09:03:23 -04:00
Luis Fernando Molina c7534a3a8e Docs Imprevementes - Questions Answered 2021-05-29 15:02:18 +02:00
Brenden Harrell f00cbc0409 Add Package.json for API Data Fetcher Dep Install 2021-05-28 22:08:26 -05:00
Philip Love ae0018348f Docs: user-defined-variables 2021-05-28 21:04:57 -04:00
Luis Fernando Molina 5fc83ea7eb Merge pull request #1018 from harrellbm/develop
Finish Initial Data Mining Docs Edit
2021-05-28 19:41:26 -04:00
Brenden Harrell 0edf17e5f1 Finish initial edit of data mining docs 2021-05-28 17:04:49 -05:00
Brenden Harrell 4a885047a5 Data Mining Docs Edit pp 11-15 2021-05-28 15:39:07 -05:00
Julian Molina 92295f3f3c Welcome tutorial updates 2021-05-28 22:36:12 +02:00
Luis Fernando Molina d69cefecb5 Merge pull request #1016 from harrellbm/develop
Data Mining Edit pp 6-10
2021-05-28 13:53:13 -04:00
B Harrell 12ea0c809b Merge branch 'Superalgos:develop' into develop 2021-05-28 12:44:13 -05:00
Brenden Harrell 33bffbbd5e Data Mining Edit pp 5-10 2021-05-28 12:42:54 -05:00
Luis Fernando Molina 55cb35be44 Merge pull request #1015 from Luis-Fernando-Molina/develop
Contribution: https module replaced by node-fetch, plus bug fixes at API Data Fetcher Bot
2021-05-28 13:12:23 -04:00
Luis Fernando Molina 6130e9e1e5 https module replaced by node-fetch, plus bug fixes at API Data Fetcher Bot 2021-05-28 19:10:51 +02:00
Julian Molina 82e4a1f141 Merge pull request #1014 from julian-molina/develop
Contribution: Delete workspace
2021-05-28 17:40:18 +02:00
Julian Molina 011c5fc5e0 Delete workspace 2021-05-28 17:39:42 +02:00
Luis Fernando Molina e897a554c6 Merge pull request #1013 from Jefferson111/plugins-docs
Contribution: My Superalgos Review
2021-05-28 10:49:28 -04:00
Jefferson111 89b52f3edc My Superalgos Review 2021-05-28 22:46:22 +08:00
Luis Fernando Molina 19455657ab Merge pull request #1002 from PLuv/develop
Manage Stage No longer required to exist ; Close-Stage now closes strategy if no Target asset exists to Trade
2021-05-28 10:44:17 -04:00
Luis Fernando Molina 0658d2d284 Merge pull request #1012 from harrellbm/develop
Update Charting Workspace for Mine Split and Edit Data Docs PP 1-5
2021-05-28 10:43:06 -04:00
Brenden Harrell 4b21756d1d Edit and Style PP 1-5 Data Mining Docs 2021-05-28 09:39:22 -05:00
Luis Fernando Molina 167a9bedd1 Merge pull request #1011 from Luis-Fernando-Molina/develop
Contribution: Bug Fixed Bollinger Bands Processes Failing after Master Data Mine Split
2021-05-28 10:37:31 -04:00
Luis Fernando Molina 8993f50169 Bug Fixed Bollinger Bands Processes Failing after Master Data Mine Split 2021-05-28 16:35:56 +02:00
Luis Fernando Molina 1ee6040f0f Merge pull request #1009 from Luis-Fernando-Molina/develop
Contribution: Default Workspace renamed
2021-05-28 10:05:32 -04:00
Luis Fernando Molina 5d5c04bc41 Default Workspace renamed 2021-05-28 16:05:08 +02:00
Luis Fernando Molina b89de0b437 Merge pull request #1008 from Luis-Fernando-Molina/develop
Contribution: BUG Fixed Tutorial Previous after Resume sending you to the begining
2021-05-28 09:56:36 -04:00
Luis Fernando Molina ec7654a9b7 BUG Fixed Tutorial Previous after Resume sending you to the begining 2021-05-28 15:55:09 +02:00
Julian Molina ae379e3086 Merge pull request #1007 from julian-molina/develop
Contribution: Getting Started Tutorials workspace revision
2021-05-28 15:32:09 +02:00
Julian Molina 91d990759b Getting Started Tutorials workspace and updates 2021-05-28 15:31:08 +02:00
Julian Molina 06d7679684 Getting Started Tutorials workspace revision 2021-05-28 15:20:37 +02:00
B Harrell 88826a90c7 Merge branch 'Superalgos:develop' into develop 2021-05-28 06:13:43 -05:00
Julian Molina bb9f5e391d Merge pull request #1006 from 9808us/develop
Misspelling Fix
2021-05-28 13:08:16 +02:00
9808us 4876963d85 Misspelling Fix 2021-05-28 13:05:20 +02:00
Julian Molina 6f1cdf099d Merge pull request #1005 from julian-molina/develop
Contribution: Getting started workspace
2021-05-28 10:05:24 +02:00
Julian Molina 838e01e358 Getting started workspace 2021-05-28 09:26:07 +02:00
Luis Fernando Molina 312d0740c6 Merge pull request #1004 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Demo Plugin Upated
2021-05-28 00:32:51 -04:00
Luis Fernando Molina 17f0a3631f API Data Fetcher Demo Plugin Upated 2021-05-28 06:31:25 +02:00
Brenden Harrell 3e45c646d8 Update Workspace and Tutorial for Masters Split 2021-05-27 22:32:41 -05:00
Luis Fernando Molina fd54e62137 Merge pull request #1003 from Luis-Fernando-Molina/develop
Contribution: API Maps now can be Plugins
2021-05-27 22:02:34 -04:00
Luis Fernando Molina 2a16d70393 API Maps now can be Plugins 2021-05-28 04:01:04 +02:00
Philip Love d633fb1ef3 Fix: Close-Stage not closing strategy in event no Target Asset available to be traded; Open-Stage force to closing when Close-Stage in Opening 2021-05-27 21:11:33 -04:00
Philip Love 7d4804940d Merge remote-tracking branch 'upstream/develop' into develop 2021-05-27 20:50:34 -04:00
Luis Fernando Molina 3a603a067d Merge pull request #1001 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher feature parameters with default values at the API Map
2021-05-27 20:31:35 -04:00
Luis Fernando Molina dfff4b387d API Data Fetcher DeepScan Bugs Fixed 2021-05-28 02:29:46 +02:00
Luis Fernando Molina d24604ec24 API Data Fetcher feature parameters with default values at the API Map 2021-05-28 02:05:22 +02:00
Luis Fernando Molina 126ea143a3 Merge pull request #1000 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Bot Resilience Improved: No Connection Exception Handled
2021-05-27 15:04:14 -04:00
Luis Fernando Molina b7f36f8d4c New Troubleshooting Page 2021-05-27 21:03:08 +02:00
Luis Fernando Molina ad8c47abc3 API Data Fetcher Bot Resilience Improved: No Connection Exception Handled 2021-05-27 20:12:05 +02:00
Luis Fernando Molina 304e1cf5ad Merge pull request #999 from Luis-Fernando-Molina/develop
Contribution: Bug Fixed at Dataset Type Converter
2021-05-27 11:54:00 -04:00
Luis Fernando Molina 128c4c14fb Bug Fixed at Dataset Type Converter 2021-05-27 17:45:37 +02:00
Luis Fernando Molina 0906b748ee Merge pull request #998 from Luis-Fernando-Molina/develop
Contribution: Node Docs Improved
2021-05-27 09:09:47 -04:00
Luis Fernando Molina 87116a5983 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-27 15:08:24 +02:00
Luis Fernando Molina b904277d8d Node Docs Improved 2021-05-27 15:07:58 +02:00
Julian Molina c00ef37516 Merge pull request #997 from julian-molina/develop
Contribution: Getting started provisional workspace
2021-05-27 11:53:57 +02:00
Julian Molina ac8556d18e Getting started provisional workspace 2021-05-27 11:52:11 +02:00
Philip Love 156786f8a7 Fix: Manage-Stage no longer needs to exist per the docs 2021-05-26 23:16:40 -04:00
Luis Fernando Molina 2be56c941e Merge pull request #996 from Luis-Fernando-Molina/develop
Contribution: Bug Fixed, Removing Masters Hardcoded name after Masters Data Mine splitted
2021-05-26 18:29:54 -04:00
Luis Fernando Molina 136f72c906 Bug Fixed, Removing Masters Hardcoded name after Masters Data Mine splitted 2021-05-27 00:26:22 +02:00
Luis Fernando Molina bcc103c73e Merge pull request #995 from Luis-Fernando-Molina/develop
Contribution: bug fixed Custom Plotters Code Moved
2021-05-26 17:05:27 -04:00
Luis Fernando Molina 74bdae6681 bug fixed Custom Plotters Code Moved 2021-05-26 23:03:13 +02:00
Luis Fernando Molina 37d510003f Merge pull request #994 from Luis-Fernando-Molina/develop
Contribution: bug fixed Plotters with hardcoded Data Mine Name
2021-05-26 16:50:18 -04:00
Luis Fernando Molina 11d48f3c0e bug fixed Plotters with hardcoded Data Mine Name 2021-05-26 22:49:15 +02:00
Luis Fernando Molina 2a35196c64 Merge pull request #993 from Luis-Fernando-Molina/develop
Contribution: bug fixed Bollinger Bands with hardcoded Data Mine Name
2021-05-26 16:12:11 -04:00
Luis Fernando Molina f52aaa40fd bug fixed Bollinger Bands with hardcoded Data Mine Name 2021-05-26 22:09:44 +02:00
Luis Fernando Molina 1c72dfaea1 Merge pull request #992 from Luis-Fernando-Molina/develop
Contribution: bug fixed Candles Volumes with hardcoded Data Mine Name
2021-05-26 15:41:30 -04:00
Luis Fernando Molina 178caee4b8 bug fixed Candles Volumes with hardcoded Data Mine Name 2021-05-26 21:34:46 +02:00
Luis Fernando Molina 6f58f3cc3f Merge pull request #990 from harrellbm/develop
Edit Refactor section of Readme
2021-05-26 15:05:36 -04:00
Luis Fernando Molina a9c1d15823 Merge pull request #991 from Luis-Fernando-Molina/develop
Contribution: New Superalgos Concepts at the Docs
2021-05-26 14:59:14 -04:00
Luis Fernando Molina 1a582183d0 bug fixed Exchange Raw Data with hardcoded mine name 2021-05-26 20:58:22 +02:00
Luis Fernando Molina 08e2e0f96f New Superalgos Concepts at the Docs 2021-05-26 20:37:59 +02:00
B Harrell 58b2e7d69e Edit Refactor section of Readme 2021-05-26 13:01:44 -05:00
Luis Fernando Molina 513c0fef75 Merge pull request #989 from harrellbm/develop
Clarify Readme language
2021-05-26 13:38:55 -04:00
B Harrell a48f7f6f05 Clarify Readme language 2021-05-26 12:26:19 -05:00
Luis Fernando Molina de873393f6 Update README.md 2021-05-26 18:48:18 +02:00
Luis Fernando Molina 9233783ded Merge pull request #988 from Luis-Fernando-Molina/develop
Contribution: Huge Refactoring Multi-Perio into Multi Time Frame
2021-05-26 12:46:48 -04:00
Luis Fernando Molina c77999c8e4 Huge Refactoring Multi-Perio into Multi Time Frame 2021-05-26 18:05:11 +02:00
Luis Fernando Molina 1b47e77a83 Merge pull request #987 from Superalgos/plugins-docs
Plugins docs into Develop in preparation for release of Beta 10
2021-05-26 10:09:14 -04:00
Luis Fernando Molina 530c87bfb6 Merge pull request #985 from julian-molina/plugins-docs
Contribution: Beyond the Basics tutorial...
2021-05-26 10:06:57 -04:00
Luis Fernando Molina 2907b9bf39 Merge pull request #983 from Luis-Fernando-Molina/develop
Contribution: Docs Inproved
2021-05-26 10:04:28 -04:00
Luis Fernando Molina c44b42b7a0 Merge pull request #986 from harrellbm/develop
Add Note for Setup Script to ReadMe
2021-05-26 10:02:40 -04:00
B Harrell 48a289085e Add Setup Script note to ReadMe 2021-05-26 08:06:04 -05:00
Julian Molina f24276a3da Beyond the Basics tutorial... 2021-05-26 14:02:38 +02:00
Julian Molina 622e8f83de Merge pull request #984 from julian-molina/plugins-docs
Contribution: Charts tutorial fixes
2021-05-26 09:28:56 +02:00
Julian Molina bb4954de9b Charts tutorial fixes 2021-05-26 09:27:53 +02:00
Luis Fernando Molina 82751bd9ba Docs Inproved 2021-05-26 04:03:46 +02:00
Luis Fernando Molina c9b0685db0 Merge pull request #982 from harrellbm/plugins-docs
Final Touches on First Charting Space Tutorial
2021-05-25 22:00:22 -04:00
B Harrell 3f3b08e578 Merge branch 'Superalgos:develop' into develop 2021-05-25 20:24:53 -05:00
Brenden Harrell f3685ffc4a Final Listing of First Charting Space Tutorial 2021-05-25 20:20:04 -05:00
Brenden Harrell 02986a1879 Update Tutorial Step for Binance.com 2021-05-25 19:47:51 -05:00
Brenden Harrell 2d9da9380c Update Workspace 2021-05-25 19:44:36 -05:00
Brenden Harrell c863353fce Update Tutorial Page 2021-05-25 18:54:41 -05:00
Brenden Harrell 01c4853fba Rename Charting Space Tutorial 2021-05-25 18:47:30 -05:00
Luis Fernando Molina 6788f1653d Merge pull request #981 from Luis-Fernando-Molina/develop
Contribution: API Fetcher Bot docs polishing iteration finished
2021-05-25 17:40:38 -04:00
Luis Fernando Molina 72c3e3d6ec API Fetcher Bot DeepScan Bug Fixed 2021-05-25 23:39:18 +02:00
Luis Fernando Molina 909412eeb9 API Fetcher Bot docs polishing iteration finished 2021-05-25 23:35:25 +02:00
B Harrell a08860d9fc Revert "Add Back tfjs Source Files"
This reverts commit 8ca90466e4.
2021-05-25 11:05:23 -05:00
B Harrell 42276e9c65 Revert "Remove TensorFlow Project from Setup Process"
This reverts commit f1cc1caf20.
2021-05-25 11:05:06 -05:00
B Harrell 6cdcbcede7 Revert "TensorFlow Source files"
This reverts commit cab277cf2c.
2021-05-25 11:04:58 -05:00
B Harrell f1da5ab2f0 Revert "TensorFlow Source"
This reverts commit e1791c2630.
2021-05-25 11:04:52 -05:00
B Harrell bcf55dfded Revert "Tensorflow Source"
This reverts commit a58bf292a9.
2021-05-25 11:04:46 -05:00
B Harrell 18ad1ad641 Revert "TensorFlow Source"
This reverts commit 3d3ab2548d.
2021-05-25 11:04:38 -05:00
B Harrell 58be63eca6 Revert "TensorFlow Source"
This reverts commit 8c7ff0c1d9.
2021-05-25 11:04:28 -05:00
B Harrell c83fab32a9 Revert "TensorFlow Source"
This reverts commit 45a00fb17f.
2021-05-25 11:04:19 -05:00
B Harrell c4269bbd3a Revert "TensorFlow Source"
This reverts commit 12d53f218e.
2021-05-25 11:04:10 -05:00
B Harrell bc9d981422 Revert "TensorFlow source"
This reverts commit 938b5fbfb4.
2021-05-25 11:04:03 -05:00
B Harrell ad1ad9bb27 Revert "TensorFlow Source"
This reverts commit 6c046725e5.
2021-05-25 11:03:55 -05:00
B Harrell 702fe61068 Revert "TensorFlow Linux Binaries"
This reverts commit 244c43a20e.
2021-05-25 11:03:45 -05:00
B Harrell 270bf7b96e Revert "TensorFlow Linux Binaries"
This reverts commit 59534f0846.
2021-05-25 11:03:39 -05:00
B Harrell a92ae52de0 Revert "TensorFlow Binary"
This reverts commit 74ad625e53.
2021-05-25 11:03:31 -05:00
B Harrell f19065dc2a Revert "Remove gitattributes"
This reverts commit 683d6d2948.
2021-05-25 11:03:24 -05:00
B Harrell ed3920b245 Revert "Revert Setup Process"
This reverts commit 044e2b63e9.
2021-05-25 11:03:12 -05:00
B Harrell 6088d1d50a Revert "Revert gitignore"
This reverts commit 9133f2cc73.
2021-05-25 11:03:04 -05:00
B Harrell 1c44426ff2 Revert "Remove tfjs-node Deps"
This reverts commit 831437c1aa.
2021-05-25 11:02:48 -05:00
B Harrell 076800ed2d Revert "Remove more node_module deps"
This reverts commit 2fca1d5e74.
2021-05-25 11:02:34 -05:00
B Harrell 0f0b8c0339 Revert "Finish removing tfjs-node"
This reverts commit 9ea4666211.
2021-05-25 11:02:13 -05:00
Brenden Harrell 9ea4666211 Finish removing tfjs-node 2021-05-25 10:49:15 -05:00
Brenden Harrell 2fca1d5e74 Remove more node_module deps 2021-05-25 10:48:22 -05:00
Brenden Harrell 831437c1aa Remove tfjs-node Deps 2021-05-25 10:47:22 -05:00
Brenden Harrell 9133f2cc73 Revert gitignore 2021-05-25 10:43:45 -05:00
Brenden Harrell 044e2b63e9 Revert Setup Process 2021-05-25 10:42:39 -05:00
B Harrell c4e16038a4 Merge branch 'Superalgos:develop' into develop 2021-05-25 10:33:12 -05:00
Luis Fernando Molina 1aaa39e284 Merge pull request #980 from Luis-Fernando-Molina/develop
Contribution: New Docs Concepts
2021-05-25 11:26:27 -04:00
Luis Fernando Molina f4c8f1abce New Docs Concepts 2021-05-25 17:25:21 +02:00
Brenden Harrell 683d6d2948 Remove gitattributes 2021-05-25 10:12:24 -05:00
Luis Fernando Molina 69bf426a08 Merge pull request #979 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Docs improved
2021-05-25 10:56:28 -04:00
Luis Fernando Molina 7d1fe263aa API Data Fetcher Docs improved 2021-05-25 16:54:35 +02:00
Brenden Harrell 74ad625e53 TensorFlow Binary 2021-05-25 09:44:30 -05:00
Brenden Harrell 59534f0846 TensorFlow Linux Binaries 2021-05-25 09:31:05 -05:00
Brenden Harrell 244c43a20e TensorFlow Linux Binaries 2021-05-25 09:28:55 -05:00
Brenden Harrell 6c046725e5 TensorFlow Source 2021-05-25 09:28:18 -05:00
Brenden Harrell 938b5fbfb4 TensorFlow source 2021-05-25 09:27:30 -05:00
Brenden Harrell 12d53f218e TensorFlow Source 2021-05-25 09:25:59 -05:00
Brenden Harrell 45a00fb17f TensorFlow Source 2021-05-25 09:24:25 -05:00
Brenden Harrell 8c7ff0c1d9 TensorFlow Source 2021-05-25 09:17:10 -05:00
Brenden Harrell 3d3ab2548d TensorFlow Source 2021-05-25 09:16:24 -05:00
Brenden Harrell a58bf292a9 Tensorflow Source 2021-05-25 09:15:39 -05:00
Brenden Harrell e1791c2630 TensorFlow Source 2021-05-25 09:14:13 -05:00
Brenden Harrell cab277cf2c TensorFlow Source files 2021-05-25 09:13:11 -05:00
Brenden Harrell f1cc1caf20 Remove TensorFlow Project from Setup Process 2021-05-25 09:01:19 -05:00
Brenden Harrell 8ca90466e4 Add Back tfjs Source Files 2021-05-25 08:37:47 -05:00
Luis Fernando Molina 0cc1d6b378 Merge pull request #978 from Luis-Fernando-Molina/develop
Contribution: BUG FIX Workspace List not loading plugins
2021-05-25 06:57:07 -04:00
Luis Fernando Molina 5e068f0012 BUG FIX Workspace List not loading plugins 2021-05-25 12:55:49 +02:00
Luis Fernando Molina ea7179d12b Merge pull request #977 from Luis-Fernando-Molina/develop
Contribution: Final set of icons for API Data Fetcher by Hirajin Koizuko (Ron)
2021-05-24 23:00:45 -04:00
Luis Fernando Molina 97572ed0a4 Final set of icons for API Data Fetcher by Hirajin Koizuko (Ron) 2021-05-25 04:57:06 +02:00
Luis Fernando Molina 1c4282b743 Merge pull request #976 from Luis-Fernando-Molina/develop
Contribution: Data Mining Docs Topic Reviewed
2021-05-24 21:30:50 -04:00
Luis Fernando Molina 0f8dce49c1 Merge pull request #975 from harrellbm/develop
Update Windows Launch Script and Rebuild Tensorflow Package files
2021-05-24 21:29:58 -04:00
Luis Fernando Molina 173f752dc1 Data Mining Docs Topic Reviewed 2021-05-25 03:25:30 +02:00
B Harrell dd2ad0397b Merge branch 'Superalgos:develop' into develop 2021-05-24 19:52:06 -05:00
Brenden Harrell cc50d576f1 Rebuild: Tensorflow Package Files 2021-05-24 19:51:37 -05:00
Luis Fernando Molina 347c15189b Merge pull request #974 from Luis-Fernando-Molina/develop
Contribution: Available Workspaces Look and Feel Improved
2021-05-24 19:22:04 -04:00
Luis Fernando Molina 0f0ede81b2 Available Workspaces Look and Feel Improved 2021-05-25 01:19:43 +02:00
Brenden Harrell 04dad67c01 Fix: remove unecissary dep for tensorflow 2021-05-24 15:09:49 -05:00
Luis Fernando Molina 543aac058c Refining the error handling 2021-05-24 21:47:04 +02:00
Brenden Harrell 38bd1badb9 Update: package files with windows-build-tools 2021-05-24 13:57:03 -05:00
Luis Fernando Molina 99376d2072 Utilities Error Handling Functions imlpemented 2021-05-24 20:03:16 +02:00
Julian Molina 4ed52e3df7 Merge pull request #973 from rjkilpatrick/patch-2
Update README.md
2021-05-24 20:00:23 +02:00
John Kilpatrick 9824567998 Update README.md
Fix small typos and grammar mistakes
2021-05-24 18:31:32 +01:00
Brenden Harrell 207311b14c Fix: Windows Launch for Shortcut on Diff Drive 2021-05-24 12:25:15 -05:00
Julian Molina a04b2be446 Merge pull request #972 from julian-molina/plugins-docs
Contribution: Contributing tutorials
2021-05-24 19:08:37 +02:00
Julian Molina 5f147eca7f Contributing tutorials 2021-05-24 19:04:40 +02:00
Luis Fernando Molina 350e45825a Merge pull request #970 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Bot Error Handling
2021-05-24 11:49:50 -04:00
Luis Fernando Molina b544a2e69c DeepScan Bug Fixed 2021-05-24 17:48:47 +02:00
Luis Fernando Molina 9b1714b2e7 API Data Fetcher Bot Error Handling 2021-05-24 17:43:51 +02:00
Luis Fernando Molina 258347bc94 Merge pull request #969 from Luis-Fernando-Molina/develop
Contribution: Some Error Handling at API Data Fetcher and reduced console log width
2021-05-24 09:16:56 -04:00
Luis Fernando Molina 15e2e1ac67 Some Error Handling at API Data Fetcher and reduced console log width 2021-05-24 15:12:44 +02:00
Luis Fernando Molina 81ac113e8f Making things more clear 2021-05-24 14:00:38 +02:00
Luis Fernando Molina d475ac95e3 Merge pull request #968 from harrellbm/develop
Unified Shortcut/Uninstall Scripts and Doc Updates
2021-05-23 22:05:07 -04:00
Brenden Harrell df1fb3f0ef Fix: clean up code 2021-05-23 20:24:06 -05:00
B Harrell e2ff7ecac6 Update: Readme for Unified Scripts
Explanations for automatic shortcut creation, noShortcuts flag and unified Uninstall added.
2021-05-23 16:55:51 -05:00
B Harrell 990f1c1c3c Merge branch 'Superalgos:develop' into develop 2021-05-23 16:15:20 -05:00
Brenden Harrell a3ff7c3116 Update: Docs for Launch-Scripts 2021-05-23 16:13:22 -05:00
Brenden Harrell b1bd4a350a Delete: Old Uninstall Script 2021-05-23 15:21:50 -05:00
Brenden Harrell 987eb76023 Add: Finish Unified Uninstall Script 2021-05-23 15:21:10 -05:00
Brenden Harrell 32eee83073 Add: Unified uninstall Script Finished Ubuntu side 2021-05-23 13:14:33 -06:00
Brenden Harrell 8319db6588 Modify: Optimize Launch Script for Linux and Mac 2021-05-23 12:52:13 -06:00
Brenden Harrell eef8f6e03c Fix: Adjust Paths for Setup Run 2021-05-23 12:06:13 -06:00
Brenden Harrell 8d64c231c0 Add: Create Shortcut Command to Setup Script 2021-05-23 12:01:34 -06:00
Brenden Harrell 8e87370cfb Delete: Old create-shortcut Scripts 2021-05-23 10:06:16 -06:00
Brenden Harrell 46cfe71c32 Modify: Unified create-shortcut Script 2021-05-23 10:05:09 -06:00
Luis Fernando Molina aa30e40791 Infraestructure Ready to integrate API Data Fetcher to the Docs 2021-05-23 17:13:13 +02:00
Luis Fernando Molina f9e276f1f6 Merge pull request #967 from Luis-Fernando-Molina/develop
Contribution: More Icons provided by Ron for API Data Fetcher Bot
2021-05-23 09:23:42 -04:00
Luis Fernando Molina 3764fcb274 More Icons provided by Ron for API Data Fetcher Bot 2021-05-23 15:22:40 +02:00
Brenden Harrell f2877386c8 Unified Shortcut Script, Windows finished 2021-05-22 21:21:37 -05:00
Luis Fernando Molina a0e37220ad Merge pull request #966 from Luis-Fernando-Molina/develop
Contribution: Data Mining Topic Documentation expanded.
2021-05-22 18:46:40 -04:00
Luis Fernando Molina e6061da09a Data Mining Topic Documentation expanded. 2021-05-23 00:45:13 +02:00
Luis Fernando Molina 1d5138753a Merge branch 'plugins-docs' into develop 2021-05-23 00:24:15 +02:00
Luis Fernando Molina 3042cede1d Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-23 00:23:23 +02:00
Luis Fernando Molina 387a8204fa Merge pull request #962 from PLuv/develop
Fixed: Bug where checkUserDefinedCode called even if stage didn't exist
2021-05-22 15:17:04 -04:00
Julian Molina c710014392 Merge pull request #963 from julian-molina/plugins-docs
Contribution: Basic Education tutorial fixes
2021-05-22 13:49:05 +02:00
Julian Molina 38550c54a5 Basic Education tutorial fixes 2021-05-22 13:47:28 +02:00
Julian Molina ce9acc2900 Merge pull request #960 from tikry2021/plugins-docs
Contribution: Workspace panel is on the left
2021-05-22 11:15:48 +02:00
Philip Love 6f1c506d9b Modify: Fix user variables in trading engine numbered 0-9 - add 2 more market buy/sell for users 2021-05-21 21:54:19 -04:00
Philip Love 5edc510c2c Fixed: Bug where checkUserDefinedCode called even if stage didn't exist 2021-05-21 21:52:32 -04:00
Luis Fernando Molina 2ef6136989 Merge pull request #961 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Daily Files working, all time high being plotted
2021-05-21 18:12:57 -04:00
Luis Fernando Molina f5a46b5a06 API Data Fetcher Daily Files working, all time high being plotted 2021-05-22 00:11:05 +02:00
Luis Fernando Molina 6c117f3eab Tyding up the code 2021-05-21 23:38:48 +02:00
Till Rupp ed76069cc3 Workspace panel is on the left 2021-05-21 22:14:12 +02:00
Luis Fernando Molina e3a2e60209 Merge pull request #959 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Daily Files being processed
2021-05-21 15:01:28 -04:00
Luis Fernando Molina 4fa59deaab Merge pull request #957 from ssplatt/docker-update
Update Dockerfile for latest code update dependencies
2021-05-21 15:01:07 -04:00
Julian Molina e4066686ea Merge pull request #958 from harrellbm/plugins-docs
Add Insertion Carat Back to Docs Textareas
2021-05-21 20:38:03 +02:00
ssplatt 97f816c113 fix volume mounts 2021-05-21 14:21:51 -04:00
Brenden Harrell b888018b22 Add Insertion Carat Back to Docs Textareas 2021-05-21 13:17:37 -05:00
Luis Fernando Molina 32c1ac5e56 Bug Fixed Daily is now running 2021-05-21 19:26:33 +02:00
Luis Fernando Molina 3676d4ac8c Refactoring TimePeriods for TimeFramesArray 2021-05-21 19:16:00 +02:00
Luis Fernando Molina ca5573459e Bug Fixes Daily partially running 2021-05-21 19:02:17 +02:00
Julian Molina 60fd72479d Merge pull request #956 from harrellbm/plugins-docs
Charting Space Tutorial Revision 5 and MapToggle option and Insertion Carat Css fix
2021-05-21 17:43:46 +02:00
Luis Fernando Molina 328963e196 Update FetchingProcess.js 2021-05-21 17:39:15 +02:00
ssplatt fc3037358d update dockerfile for latest code update dependencies 2021-05-21 11:27:09 -04:00
Brenden Harrell 4227252627 Update Custom Charts Workspace 2021-05-21 09:13:11 -05:00
Brenden Harrell b6be55f2d0 Fix Insertion Carat Showing up in Docs and Tutorial Panel 2021-05-21 09:09:22 -05:00
Luis Fernando Molina bda5920088 Merge pull request #955 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Bug Fixes & Aggregation Library
2021-05-21 09:44:00 -04:00
Luis Fernando Molina 74e4533d8e Merge pull request #954 from suttridge/develop
Contribution: Updated tested exchanges to indicate that Luno exchange is not longer suitable for use.
2021-05-21 09:43:37 -04:00
Luis Fernando Molina 88afcd237e Bug fixed with beginingOfTheMarket context variable 2021-05-21 15:40:37 +02:00
Brenden Harrell 0b9fdaf513 Repaginate Charting Space Tutorial 2021-05-21 08:36:21 -05:00
Luis Fernando Molina 4ab1b9d86c Data Aggregation Functions Library fully implemented and running 2021-05-21 14:46:18 +02:00
Steve Langridge e569c72573 Updated tested exchanges to indicate that Luno exchange is not longer suitable for use. 2021-05-21 11:09:07 +02:00
Luis Fernando Molina 198fc130b2 Merge pull request #953 from harrellbm/develop
Update Readme for New Dependency Setup
2021-05-20 22:51:15 -04:00
B Harrell bf053c688e Update Readme for New Dependency Setup 2021-05-20 21:27:57 -05:00
Luis Fernando Molina 4db9e0e3ce Common Function Library Implemented for Market and Daily Frameworks 2021-05-21 01:41:34 +02:00
Luis Fernando Molina 1a3ec7d03b Merge pull request #952 from Luis-Fernando-Molina/develop
Contribution: node_modules folders removed
2021-05-20 15:44:12 -04:00
Luis Fernando Molina 44111f6dea Update .gitignore 2021-05-20 21:39:31 +02:00
Luis Fernando Molina ac5774dfb2 node_modules folders removed from all places 2021-05-20 21:39:08 +02:00
Luis Fernando Molina f7423e26b2 Merge pull request #950 from harrellbm/develop
Initial Script to Install node dependencies
2021-05-20 15:28:03 -04:00
Luis Fernando Molina 94fe3511d0 Merge pull request #951 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher bot, working for Market Files with Messari demo.
2021-05-20 13:49:25 -04:00
Luis Fernando Molina ab3fe8ab6c API Data Fetcher bot, working for Market Files with Messari demo. 2021-05-20 19:29:57 +02:00
Luis Fernando Molina 9eb6732638 Market Files Working up to All Time High Plotter 2021-05-20 19:23:55 +02:00
Brenden Harrell 2a6632f159 Charting Space Tutorial Revision 5 2021-05-20 10:17:29 -05:00
Luis Fernando Molina 26a5567f1c Update FromOneMinToMultiPeriodMarket.js 2021-05-20 16:26:54 +02:00
B Harrell b3710db27d Merge branch 'Superalgos:plugins-docs' into plugins-docs 2021-05-20 09:04:46 -05:00
Brenden Harrell 518c993e39 Type Fix 2021-05-19 20:01:33 -05:00
Brenden Harrell 77c00b8a3c Finished Initial Setup Script 2021-05-19 19:58:47 -05:00
Luis Fernando Molina 9d0e5aa3da API Data Fetcher Aggregated File Being Saved 2021-05-19 23:26:58 +02:00
Luis Fernando Molina afc81903c5 API Data Fetcher bot process improved 2021-05-19 22:38:11 +02:00
Brenden Harrell a337f6f4c0 Tweaks for setup script 2021-05-19 15:23:17 -05:00
Brenden Harrell 4b32d7c30a Add node_modules to .gitignore 2021-05-19 13:28:46 -05:00
Brenden Harrell a3afb73cf2 Package.jsons to Handle npm ci Command 2021-05-19 13:22:19 -05:00
Brenden Harrell ec2db1e887 Initial Setup Script to install Node Dependencies 2021-05-19 12:50:34 -05:00
Luis Fernando Molina 98f79f5162 Merge pull request #946 from Luis-Fernando-Molina/develop
Contribution: This is my contribution to Superalgos
2021-05-19 12:29:02 -04:00
Luis Fernando Molina 232b2ef63c API Data Fetcher DeepScan more fixes 2021-05-19 18:26:59 +02:00
Luis Fernando Molina 5bd2f0c554 API Data Fetcher DeepScan fixes 2021-05-19 18:23:30 +02:00
Luis Fernando Molina a5928dc51d Update Footer.js 2021-05-19 18:02:03 +02:00
Luis Fernando Molina e7e39bb5bd docs improvements: buttons for User Manual, Data Mines and Reviews 2021-05-19 17:29:11 +02:00
Luis Fernando Molina 098843221f Updated Icons 2021-05-19 16:35:15 +02:00
Julian Molina aefa41cd83 Merge pull request #949 from Spodeian/plugins-docs
Contribution: My Superalgos Review
2021-05-19 13:10:27 +02:00
Spodeian efe3f90eaa My Superalgos Review 2021-05-19 20:45:58 +10:00
Julian Molina b8ec01b52d Merge pull request #948 from tikry2021/plugins-docs
Contribution: My Superalgos Review
2021-05-19 08:58:01 +02:00
Julian Molina 7d615ac2f6 Merge pull request #947 from MarcelloPersico/plugins-docs
Contribution: review
2021-05-19 08:56:25 +02:00
Luis Fernando Molina 30644ff9e4 Aggregation Functions fully implemented 2021-05-18 23:58:50 +02:00
Luis Fernando Molina 35164873c2 Aggregation Function semi implemented 2021-05-18 23:36:17 +02:00
Till Rupp 3fe4517286 My Superalgos Review 2021-05-18 23:20:12 +02:00
Marcello Persico 783ea687ba review 2021-05-18 22:41:19 +02:00
Luis Fernando Molina 1b421bfec7 loadExistingFiles function implemented 2021-05-18 21:11:30 +02:00
Luis Fernando Molina 2bccf3518c Some Icons for API Data Fetcher Bot and getContextVariables function implementation 2021-05-18 20:36:27 +02:00
Luis Fernando Molina d18f8cefd7 Hooking the new Framework module to the Indicator Bot 2021-05-18 19:07:45 +02:00
Luis Fernando Molina 2b076c7c41 removing referencies to Candle 2021-05-18 18:19:39 +02:00
Luis Fernando Molina 6030725029 All volume related stuff removed from code 2021-05-18 18:11:24 +02:00
Luis Fernando Molina b787498759 Merge pull request #945 from Luis-Fernando-Molina/develop
Contribution: API CodeBase general mantainance: let thisObject missing fixed
2021-05-18 11:13:51 -04:00
Luis Fernando Molina 29702850b5 API CodeBase general mantainance: let thisObject missing fixed 2021-05-18 16:52:13 +02:00
Luis Fernando Molina 3322ae7272 Merge pull request #944 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher bot, One Min datasets handling
2021-05-18 09:17:00 -04:00
Luis Fernando Molina adcd2f8169 API Data Fetcher bot, One Min datasets handling 2021-05-18 15:16:39 +02:00
B Harrell 20e13e348a Merge branch 'Superalgos:plugins-docs' into plugins-docs 2021-05-18 08:02:31 -05:00
Till Rupp 8483f6b9a9 My Superalgos Review 2021-05-18 00:47:12 +02:00
Luis Fernando Molina 4376ffc3e8 Merge pull request #943 from Luis-Fernando-Molina/develop
Contribution: Legacy Code Mantainance
2021-05-17 14:23:09 -04:00
Luis Fernando Molina e873f5379f Legacy Code Mantainance 2021-05-17 20:21:54 +02:00
Luis Fernando Molina 0de5eba7a5 Merge pull request #941 from PLuv/develop
Fixed: Limit Buy & Sell Quoted Panels
2021-05-17 11:49:15 -04:00
Philip Love 523cd53a9f Fixed: Limit Buy & Sell Quoted Panels 2021-05-17 10:27:57 -04:00
Philip Love 0ff245bdd5 Merge remote-tracking branch 'upstream/develop' into develop 2021-05-17 10:24:13 -04:00
Luis Fernando Molina d072fae4bf Merge pull request #940 from Superalgos/plugins-docs
Plugins docs Service Pack: Include bug fixes at plugins, new Docs, etc.
2021-05-17 10:10:19 -04:00
Luis Fernando Molina 2c125dbe38 Merge pull request #939 from Luis-Fernando-Molina/develop
Contribution: Plugins Docs Merged
2021-05-17 09:58:26 -04:00
Luis Fernando Molina f1d9a05b1f Merge branch 'plugins-docs' into develop 2021-05-17 15:57:40 +02:00
Luis Fernando Molina 68d6bd9c0f Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-17 15:57:06 +02:00
Luis Fernando Molina 8c795d79c2 Merge pull request #938 from Luis-Fernando-Molina/develop
Contribution: API Fetcher Bot: Messari Data Mine with first indicator and plotter tested.
2021-05-17 09:56:31 -04:00
Julian Molina 4a2ffa4ed3 Merge pull request #937 from julian-molina/plugins-docs
Contribution: BBTP syntax fix to tradingCurrent
2021-05-17 14:08:59 +02:00
Julian Molina 60143ba4d0 BBTP syntax fix to tradingCurrent 2021-05-17 14:08:09 +02:00
Julian Molina c2077aedb3 Merge pull request #935 from elCoderCP4H/plugins-docs
Contribution: elcoder's Superalgos Review
2021-05-17 11:52:30 +02:00
Luis Fernando Molina 0ee65aa180 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-16 16:34:52 +02:00
Luis Fernando Molina abd4b605b5 API Fetcher Bot Implementation: All Time High Indicator and Plotter implemented and tested. 2021-05-16 15:26:49 +02:00
zil0 c487fe9939 Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-15 01:45:38 -05:00
Luis Fernando Molina 680d066fa4 Merge pull request #934 from Luis-Fernando-Molina/develop
Contribution: Merge fo Plugins Docs into Develop
2021-05-14 22:57:04 -04:00
Luis Fernando Molina c19b7d0190 Refactoring of User Variables for User Defined Variables 2021-05-15 04:55:40 +02:00
Luis Fernando Molina b25bf3fc9b Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-15 04:26:28 +02:00
Luis Fernando Molina 0a9374b831 Merge pull request #932 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher, now it can fetch fields from any part of the response
2021-05-14 16:23:02 -04:00
Luis Fernando Molina 40be21e6a8 Basic Documentation of the nodes related to the API Data Fetcher bot 2021-05-14 22:21:32 +02:00
Philip Love 0fd8b2a645 Modify: Pluvtech Data-Mine - Lighten Waddah Trend bars 2021-05-14 15:24:54 -04:00
Julian Molina ed1b3896c5 Merge pull request #933 from julian-molina/plugins-docs
Contribution: User defined icons
2021-05-14 20:09:31 +02:00
Julian Molina 61ca4b60ce User defined icons 2021-05-14 20:07:25 +02:00
Luis Fernando Molina 8d5fdf3ed4 API Data Fetcher, now it can fetch fields from any part of the response 2021-05-14 18:55:14 +02:00
Luis Fernando Molina 1f505a2c14 Merge pull request #931 from PLuv/develop
Modify: PLUVTECH-DM -> Pluvtech ; Modify: 'whileAtStage_whenToRun' -> 'whileAtStageWhenToRun'
2021-05-14 11:55:06 -04:00
Philip Love 96b52132f2 Remove: Unnecessary Condition in checkUserDefinedCode() 2021-05-14 11:51:47 -04:00
Philip Love 9cc2bbdee2 Modify: 'whileAtStage_whenToRun' -> 'whileAtStageWhenToRun' 2021-05-14 11:32:37 -04:00
Philip Love 0b566f59c4 Modify: PLUVTECH-DM -> Pluvtech 2021-05-14 11:20:40 -04:00
Luis Fernando Molina 27d0d41b42 Merge pull request #930 from Luis-Fernando-Molina/develop
Contribution: BIG FIX: Undefined indicators discovered at BB Top Bounce
2021-05-14 10:21:27 -04:00
Luis Fernando Molina fb0566afe3 BUG FIX: Suggestion of Deep Scan 2021-05-14 16:19:59 +02:00
Luis Fernando Molina 6c369a3192 BIG FIX: Undefined indicators discovered at BB Top Bounce 2021-05-14 16:12:32 +02:00
Julian Molina 34eaa8d06a Merge pull request #929 from julian-molina/plugins-docs
Contribution: README welcoming
2021-05-14 10:04:35 +02:00
Julian Molina 5e1ba8cb9e README welcoming 2021-05-14 10:04:21 +02:00
Julian Molina 27c213b6fd Merge pull request #928 from julian-molina/plugins-docs
Contribution: README link
2021-05-14 10:03:07 +02:00
Julian Molina a6ecba31a1 README link 2021-05-14 10:02:46 +02:00
Luis Fernando Molina 72dee4e8a3 Merge pull request #925 from PLuv/develop
Add: PLUVTECH-DM to Masters-Trading-Mine Dependencies - Add: User Defined Variables - Add: User Defined Code
2021-05-13 16:52:36 -04:00
Luis Fernando Molina 257fcc3da9 Merge pull request #926 from Luis-Fernando-Molina/develop
Contribution: API Fetcher Demo saving Messari Asset Metrics
2021-05-13 16:19:27 -04:00
Luis Fernando Molina b1970da932 Fix to Deep Scan bug 2021-05-13 22:18:00 +02:00
Luis Fernando Molina a891d6e209 Fix to Deep Scan bug 2021-05-13 22:13:50 +02:00
Luis Fernando Molina 3c12df4245 API Fetcher Demo saving Messari Asset Metrics 2021-05-13 22:11:17 +02:00
Philip Love 35b852ff2a Add: User-Defined-Code for Stages 2021-05-13 14:48:10 -04:00
Philip Love 3e8ca6a5ae Add: Episodes->User-Defined-Variables nodes 2021-05-13 14:43:41 -04:00
Philip Love 141f84d78e Add: PLUVTECH-DM to Masters-Trading-Mine Dependencies 2021-05-13 14:40:47 -04:00
Julian Molina 58aafeb73a Merge pull request #924 from julian-molina/plugins-docs
Contribution: README
2021-05-13 20:04:36 +02:00
Julian Molina 33dc3c994d README 2021-05-13 20:04:17 +02:00
Julian Molina b688f5ef0a Merge pull request #923 from julian-molina/plugins-docs
Contribution: README final fixes
2021-05-13 20:02:05 +02:00
Julian Molina 45755c18d2 README final fixes 2021-05-13 19:56:28 +02:00
Julian Molina ffb12ae9f2 Merge pull request #922 from julian-molina/plugins-docs
Contribution: README last fixes
2021-05-13 19:54:44 +02:00
Julian Molina 9afb4d3433 README last fixes 2021-05-13 19:54:22 +02:00
Julian Molina 6348891a93 Merge pull request #921 from julian-molina/plugins-docs
Contribution: README more fixes
2021-05-13 19:49:20 +02:00
Julian Molina 796f622d34 README more fixes 2021-05-13 19:49:00 +02:00
Julian Molina abdced0801 Merge pull request #920 from julian-molina/plugins-docs
Contribution: README fixes
2021-05-13 19:44:58 +02:00
Julian Molina 6c4ccc1e1a README fixes 2021-05-13 19:44:38 +02:00
Julian Molina 2096323d88 Merge pull request #919 from julian-molina/plugins-docs
Contribution: README
2021-05-13 19:18:43 +02:00
Julian Molina cf36649f03 README 2021-05-13 19:16:21 +02:00
Luis Fernando Molina 7a818d5a89 Merge pull request #918 from Luis-Fernando-Molina/develop
Contribution: Plugins Docs Merged into Develop
2021-05-13 12:18:19 -04:00
Luis Fernando Molina b52ed20caf Merge branch 'plugins-docs' into develop 2021-05-13 18:17:31 +02:00
Luis Fernando Molina 8e2b791bc2 Merge pull request #917 from Luis-Fernando-Molina/develop
Contribution: Bug Fix Exchange Bands was failing to run
2021-05-13 12:15:13 -04:00
Luis Fernando Molina 01bb8e7843 Bug Fix Exchange Bands was failing to rrun 2021-05-13 18:08:45 +02:00
Julian Molina 4d5e5f04dc Merge pull request #916 from julian-molina/plugins-docs
Contribution: FR flag
2021-05-13 17:51:19 +02:00
Julian Molina 6d2cdf4cbd FR flag 2021-05-13 17:50:24 +02:00
Luis Fernando Molina 3a32953c66 Merge pull request #915 from Luis-Fernando-Molina/develop
Contribution: Api Fetcher bot Task Installation Process Implemented and tested
2021-05-13 09:02:30 -04:00
Luis Fernando Molina 32a898d7c7 Api Fetcher bot Task Installation Process Implemented and tested 2021-05-13 15:02:05 +02:00
Brenden Harrell 6647bef3f5 Update Tutorial Step Doc 2021-05-12 19:53:41 -05:00
Brenden Harrell 5004324744 Update Charting Tutorial for Toggle Map Option 2021-05-12 19:30:39 -05:00
Brenden Harrell 4d7f9cf419 Merge branch 'plugins-docs' of https://github.com/harrellbm/Superalgos into plugins-docs 2021-05-12 19:28:40 -05:00
Brenden Harrell 4bcee11574 Add toggleMapView Function for Tutorial Steps 2021-05-12 19:28:34 -05:00
zil0 d4c52f95ec My Superalgos Review 2021-05-12 18:48:09 -05:00
Luis Fernando Molina 7190ff7806 Merge pull request #914 from Luis-Fernando-Molina/develop
Contribution: Docs updated
2021-05-12 16:00:12 -04:00
Luis Fernando Molina cd72460f46 Docs updated 2021-05-12 21:59:55 +02:00
Luis Fernando Molina 87e6f34428 Merge pull request #913 from Luis-Fernando-Molina/develop
Contribution: Troubleshooting Saving
2021-05-12 15:49:15 -04:00
Luis Fernando Molina 9de6d99d58 Troubleshooting Saving 2021-05-12 21:48:56 +02:00
Luis Fernando Molina 2cd52259ea Merge pull request #912 from Luis-Fernando-Molina/develop
Contribution: Fetcher Workspace Plugin Updated
2021-05-12 14:13:44 -04:00
Luis Fernando Molina 9c7373197b Fetcher Workspace Plugin Updated 2021-05-12 20:09:14 +02:00
Luis Fernando Molina cc75447b55 Merge pull request #911 from harrellbm/develop
Finished Windows Shortcut Scripts and Docs
2021-05-12 11:12:03 -04:00
Brenden Harrell 2fc5d2f810 Update Docs for Windows Scripts 2021-05-11 22:19:24 -05:00
Brenden Harrell 85a6f6edb4 Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-05-11 22:07:24 -05:00
Brenden Harrell d2dbddce49 Comment out Debug Lines 2021-05-11 22:07:18 -05:00
B Harrell 9d5d2d2671 Update Readme for Windows Shortcut Scripts 2021-05-11 22:03:34 -05:00
Brenden Harrell 3b2e2c0e3b Finished Windows Shortcut Scripts 2021-05-11 21:48:03 -05:00
Luis Fernando Molina f819213e29 Merge pull request #910 from ssplatt/add-slack-announce
initial commit of slack bot for announcements
2021-05-11 19:19:10 -04:00
Brett Taylor 3574ee7d59 initial commit of slack bot 2021-05-11 18:30:25 -04:00
Luis Fernando Molina 631a702499 Merge pull request #909 from Luis-Fernando-Molina/develop
Contribution: French Language Added
2021-05-11 13:26:45 -04:00
Luis Fernando Molina 594c553206 Bug Fixed when a formula at live trade referenced a .previous at market files 2021-05-11 18:57:02 +02:00
Luis Fernando Molina 8b4576c6f4 French Language Added 2021-05-11 16:00:00 +02:00
Luis Fernando Molina 31233588db Merge pull request #904 from ssplatt/discord-text
Add formatting option for Discord announcement messages
2021-05-11 09:38:47 -04:00
Luis Fernando Molina d552b229f8 Merge pull request #908 from Luis-Fernando-Molina/develop
Contribution: Master Data Mine without API Fetcher Example
2021-05-11 09:36:38 -04:00
Luis Fernando Molina ebcb783207 Master Data Mine without API Fetcher Example 2021-05-11 15:35:48 +02:00
Julian Molina b2cfed488e Merge pull request #905 from 9808us/plugins-docs
Contribution: This is my contribution to Superalgos
2021-05-11 10:00:12 +02:00
9808us f4607447b1 This is my contribution to Superalgos 2021-05-11 09:57:52 +02:00
Brett Taylor 5303f0672c pass in config 2021-05-11 00:01:16 -04:00
Brett Taylor c1da48bff8 add message format option 2021-05-10 23:57:41 -04:00
Brenden Harrell 70b26543fc Merge branch 'plugins-docs' of https://github.com/harrellbm/Superalgos into plugins-docs 2021-05-10 20:33:25 -05:00
Brenden Harrell a4cf1cbe3c Charting Space Tutorial Hierarchy Refinements 2021-05-10 20:17:08 -05:00
Julian Molina f6adc7aa9f Merge pull request #903 from julian-molina/plugins-docs
Contribution: Tutorial tips update
2021-05-10 13:32:29 +02:00
Julian Molina 45a768c9c5 Tutorial tips update 2021-05-10 13:31:06 +02:00
Julian Molina 52368451b9 Merge pull request #902 from superharoun/plugins-docs
Fix typos
2021-05-10 10:08:04 +02:00
Haroun 62f46efba8 This is my contribution to Superalgos 2021-05-09 22:28:51 +02:00
Luis Fernando Molina 8dc4f28be8 Merge pull request #899 from harrellbm/develop
Ubuntu create shortcut script
2021-05-09 10:16:59 -04:00
Brenden Harrell ba54382272 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-09 07:31:44 -05:00
Luis Fernando Molina ff6ecbd0ac Merge pull request #898 from Luis-Fernando-Molina/develop
Contribution: Mege of Plugin Docs
2021-05-09 08:05:46 -04:00
Luis Fernando Molina c68fbe2c97 Merge remote-tracking branch 'upstream/plugins-docs' into develop 2021-05-09 14:04:41 +02:00
Luis Fernando Molina c5b1006fde Merge pull request #896 from Smidy13/develop
Improvement: Discord, Dogecoin Icons and Configuration
2021-05-09 07:57:37 -04:00
Smidy13 0e8580d376 Bug Fix: Defining Each Telegram and Discord Bot Array 2021-05-09 22:59:53 +12:00
Smidy13 a647dd6d59 Discord Bot Icons 2021-05-09 15:39:24 +12:00
Smidy 4ab3295917 Merge branch 'Superalgos:develop' into develop 2021-05-09 15:16:37 +12:00
Smidy13 82b75aa4e5 Dogecoin Icons and Configuration 2021-05-09 15:16:01 +12:00
Brenden Harrell 0ba846534b Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-05-08 19:38:18 -05:00
Brenden Harrell 81f8feb69a Update Launch Script Docs 2021-05-08 19:38:09 -05:00
Brenden Harrell 070a74dc89 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-08 19:34:25 -05:00
B Harrell 477e29dcf8 Add gifs to readme 2021-05-08 16:31:16 -05:00
Brenden Harrell 30da48d5de Update Docs for Ubuntu Shortcuts 2021-05-08 16:14:37 -05:00
Brenden Harrell f1daaaa752 Clean Linux Launch Script 2021-05-08 15:36:47 -05:00
Brenden Harrell f63dd40d18 Add Create Shortcut Script for Ubuntu 2021-05-08 15:36:22 -05:00
Julian Molina c0a74025ff Merge pull request #893 from julian-molina/plugins-docs
Contribution: Fix on contributions instructions
2021-05-08 21:28:07 +02:00
Julian Molina a05970ae49 Fix on contributions instructions 2021-05-08 21:27:28 +02:00
Julian Molina 3cc58b3c7d Merge pull request #891 from julian-molina/develop
Contribution: DE flag
2021-05-08 20:29:09 +02:00
Julian Molina f393eed63b Merge pull request #892 from kizniche/plugins-docs
Contribution: Grammar, instruction, and improper linking fixes
2021-05-08 20:28:32 +02:00
Kyle Gabriel 8846932335 Grammar, instruction, and improper linking fixes 2021-05-08 13:08:40 -04:00
Julian Molina e94b29402b DE flag 2021-05-08 17:11:08 +02:00
Luis Fernando Molina 07eacf19af Merge pull request #890 from Luis-Fernando-Molina/develop
Contribution: German Language  added and version labels switched to Beta 10
2021-05-08 08:33:25 -04:00
Luis Fernando Molina ec65381c01 German Language added and version labels switched to Beta 10 2021-05-08 14:27:41 +02:00
Julian Molina 4497d10a46 Merge pull request #887 from harrellbm/plugins-docs
Smooth Tutorial Step Transitions
2021-05-08 09:09:34 +02:00
B Harrell 68638187d1 Merge branch 'Superalgos:plugins-docs' into plugins-docs 2021-05-07 13:18:09 -05:00
B Harrell 1e062d73ec Merge branch 'Superalgos:develop' into develop 2021-05-07 13:16:57 -05:00
Brenden Harrell be218752b5 Smooth Tutorial Step Transitions 2021-05-07 08:47:00 -05:00
Luis Fernando Molina 6f82264d06 Merge pull request #886 from ssplatt/discord-integration-1
get discord announcements working
2021-05-07 06:32:19 -04:00
Brenden Harrell 875f86a8eb Add vendor prefix for browser compatibility 2021-05-06 22:09:55 -05:00
Brett Taylor 5475d3b1d6 get discord announcements working 2021-05-06 22:45:31 -04:00
Brenden Harrell 0829ce734e Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-06 12:32:06 -06:00
Luis Fernando Molina 70a346ccc9 Merge pull request #879 from Smidy13/develop
Improvement: Interpreting Multiple Telegram Commands
2021-05-06 13:51:48 -04:00
Luis Fernando Molina a54c815533 Merge pull request #884 from frysee/add-delta-mine
added new mine containing Wilder-RSI and MFI indicators
2021-05-06 13:46:28 -04:00
Brenden Harrell 22a765649c Smooth Out Tutorial Step Transitions 2021-05-06 09:11:42 -05:00
Brenden Harrell 5b0d289106 Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-05-06 08:22:20 -05:00
frysee e199a24416 added new mine containing Wilder-RSI and MFI indicators 2021-05-06 12:25:52 +02:00
Julian Molina 68ef1b0891 Merge pull request #882 from harrellbm/plugins-docs
Charting Space Tutorial Fixes
2021-05-06 09:14:20 +02:00
Brenden Harrell 4f8b6da5e0 Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-05 21:16:40 -05:00
Brenden Harrell 173f715794 Update workspace 2021-05-05 21:11:18 -05:00
Brenden Harrell 81707deb28 Reindex Charting Space Tutorial 2021-05-05 21:09:20 -05:00
Brenden Harrell 3e52d518e4 Charting Space Tutorial fixes 2021-05-05 20:54:15 -05:00
Brenden Harrell fd7d5d1010 Fix: readd I See a Chart step 2021-05-05 15:27:22 -05:00
Brenden Harrell ca5fee2420 Merge branch 'plugins-docs' of https://github.com/harrellbm/Superalgos into plugins-docs 2021-05-05 06:58:02 -06:00
Brenden Harrell 4de1893713 Merge branch 'master' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-05 06:57:41 -06:00
Luis Fernando Molina 16c1443f49 Merge pull request #876 from harrellbm/develop
Launch Script Docs
2021-05-05 08:40:36 -04:00
Luis Fernando Molina 6e47c4e81f Merge pull request #874 from PLuv/develop
Fix: Plotters VWMA & WMA - Change: Minor Disk space optimization
2021-05-05 08:39:07 -04:00
Julian Molina f4d71fb7e9 Merge pull request #881 from julian-molina/plugins-docs
Contribution: Charting space tutorial typos
2021-05-05 12:11:01 +02:00
Julian Molina 6b10ea126d Charting space tutorial typos 2021-05-05 12:10:34 +02:00
Julian Molina 0f05db394d Merge pull request #880 from julian-molina/plugins-docs
Contribution: Tutorials
2021-05-05 09:16:07 +02:00
Julian Molina 3ba605d2fb Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-05 09:15:17 +02:00
Julian Molina cf5eb1f332 Tutorials 2021-05-05 09:15:00 +02:00
Smidy13 cf5d7415c7 Merge branch 'develop' of https://github.com/Smidy13/Superalgos into develop 2021-05-04 22:27:33 +12:00
Smidy13 f00b1b0cb1 Improvement: Interpreting Multiple Telegram Commands 2021-05-04 22:27:02 +12:00
Julian Molina bb82a4f179 Merge pull request #875 from harrellbm/plugins-docs
Charting Tutorial Revision 4
2021-05-03 18:42:54 +02:00
Brenden Harrell 861fa68b66 Lauch Scripts Docs 2021-05-03 09:53:43 -05:00
Brenden Harrell 26bc949218 Merge branch 'develop' of https://github.com/harrellbm/Superalgos into develop 2021-05-03 09:53:17 -05:00
Brenden Harrell 12866efd4f Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-03 09:53:05 -05:00
B Harrell 7d3fb6de2c Update for Launch Scripts 2021-05-03 09:17:02 -05:00
Brenden Harrell 7fed529503 Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-05-03 08:57:37 -05:00
Brenden Harrell 02f86cf454 Update Workspace 2021-05-03 08:54:12 -05:00
Brenden Harrell 364dea3357 Final Repagination Charting Tutorial Revison 4 2021-05-03 08:53:37 -05:00
Brenden Harrell 74c7ca2513 final changes Charting Tutorial Revision 4 2021-05-03 08:44:56 -05:00
Philip Love 56b8a24bfc Fix: Plotters VWMA & WMA - Change: Minor Disk space optimization 2021-05-02 23:02:15 -04:00
Brenden Harrell 542226bbca initial charting tutorial revision 4 2021-05-02 21:55:21 -05:00
Brenden Harrell 2975b0838d random small typo fix 2021-05-02 21:54:47 -05:00
Smidy 133fb4aecc Merge pull request #11 from Superalgos/develop
Merging Develop
2021-05-03 09:03:57 +12:00
Brenden Harrell 2ed90b1491 Merge branch 'master' of https://github.com/Superalgos/Superalgos into develop 2021-05-02 12:43:32 -05:00
Luis Fernando Molina d6692d45b3 Merge pull request #856 from Luis-Fernando-Molina/develop
Contribution: API Fetcher bot, basic implementation
2021-05-02 12:26:05 -04:00
Luis Fernando Molina 17624865c9 API Fetcher Bot - Workspace as Plugin 2021-05-02 18:22:18 +02:00
Luis Fernando Molina 81c20d148e Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-05-02 18:22:07 +02:00
Luis Fernando Molina 4ec579c781 Merge pull request #871 from Smidy13/develop
Bug Fixes for getOHLCVs from CCXT Library Update
2021-05-02 12:16:36 -04:00
Luis Fernando Molina a1dca88328 Merge pull request #872 from suttridge/develop
Contribution: Added data mine with indicator and plotter for the Turtle S1 system indicator.
2021-05-02 12:11:42 -04:00
Luis Fernando Molina 4ef6ede664 Merge pull request #873 from PLuv/develop
New Data Mine + New Color Options
2021-05-02 12:10:44 -04:00
Philip Love 1578d44b26 Add: PLUVTECH-DM 2021-05-02 11:29:42 -04:00
Steve Langridge 16801dfbb9 This is my contribution to Superalgos 2021-05-02 16:25:00 +02:00
Philip Love 226c9c2c24 Add: Additional pre-defined style colors and update style doc-page to display 2021-05-02 10:15:13 -04:00
Smidy13 09fa1cca5d Further changes to HistoricOHLCVs.js after extensive testing 2021-05-02 20:18:13 +12:00
Luis Fernando Molina 53317c3c27 API Fetcher Bot - Mapping Property Records with Api Received Data Fields finished and debugged. 2021-05-02 02:47:09 +02:00
Luis Fernando Molina a753985890 API Data Fetcher - Managing Error codes implemented 2021-05-01 20:06:59 +02:00
Luis Fernando Molina 7ff18ccdda API Data Fercher First Debugging Completed 2021-05-01 16:57:29 +02:00
Luis Fernando Molina 04bb90ca9f Merge branch 'master' into develop 2021-05-01 14:59:46 +02:00
Luis Fernando Molina 1b953c165d Merge pull request #869 from Superalgos/plugins-docs
Master update with Plugins Docs
2021-05-01 08:59:02 -04:00
Julian Molina 9dfe17154f Merge pull request #867 from maxspecktor/plugins-docs
Contribution: my review
2021-05-01 11:51:21 +02:00
max specktor 7b614b957c my review 2021-05-01 11:26:09 +02:00
Julian Molina ab393285ca Merge pull request #866 from julian-molina/plugins-docs
Contribution: Readme
2021-04-30 21:35:55 +02:00
Julian Molina 15f25cfa75 Readme 2021-04-30 21:33:42 +02:00
Julian Molina 3ed18a2b1c Merge pull request #865 from julian-molina/plugins-docs
Contribution: This is my contribution to Superalgos
2021-04-30 21:23:59 +02:00
Julian Molina 49fc0d39b2 This is my contribution to Superalgos 2021-04-30 21:23:08 +02:00
Julian Molina 84951c1eea Merge pull request #864 from julian-molina/plugins-docs
Contribution: Switching languages in Welcome tutorial
2021-04-30 19:52:04 +02:00
Julian Molina db4f31fa67 Switching languages in Welcome tutorial 2021-04-30 19:49:27 +02:00
Julian Molina 4e02030b76 Merge pull request #863 from julian-molina/plugins-docs
Contribution: Recovering from bad merge
2021-04-30 17:06:20 +02:00
Julian Molina 5bc7b86f99 Recovering from bad merge 2021-04-30 17:04:15 +02:00
Julian Molina 84e9948299 Merge pull request #862 from julian-molina/plugins-docs
Contribution: Footer update
2021-04-30 15:03:34 +02:00
Julian Molina 36d6001d50 Footer update 2021-04-30 15:03:13 +02:00
Julian Molina afca80cbf1 Revert "Merge pull request #861 from maxspecktor/plugins-docs"
This reverts commit 7c62e64da9, reversing
changes made to 102dd5aa14.
2021-04-30 13:55:57 +02:00
Luis Fernando Molina 63d0147f69 Merge pull request #858 from NITEMAN/docker
Improve docker info
2021-04-30 07:54:44 -04:00
Julian Molina 7c62e64da9 Merge pull request #861 from maxspecktor/plugins-docs
Contribution: My Superalgos Review
2021-04-30 13:50:54 +02:00
Julian Molina 300ae26781 Delete contribute-to-superalgos-014-tutorial-step-update-the-app.json 2021-04-30 13:48:57 +02:00
Julian Molina 1d8bd433fd Delete contribute-to-superalgos-013-tutorial-step-welcome-back.json 2021-04-30 13:48:16 +02:00
Julian Molina 2e45e74ebb Delete contribute-to-superalgos-012-tutorial-step-lets-switch-already.json 2021-04-30 13:47:48 +02:00
Julian Molina f101a7eb6c Delete contribute-to-superalgos-008-tutorial-step-switching-branches.json 2021-04-30 13:47:29 +02:00
Julian Molina f117296ba9 Delete contribute-to-superalgos-007-tutorial-step-what-about-free-riders.json 2021-04-30 13:46:39 +02:00
max specktor 99ae95cf5b Fixed typo and changed some develop branch references to plugins/docs 2021-04-30 12:20:29 +02:00
max specktor 2e735d2395 Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-04-30 12:00:10 +02:00
max specktor 1ddf921a59 My Superalgos Review 2021-04-30 11:51:46 +02:00
Julian Molina 102dd5aa14 Merge pull request #859 from julian-molina/plugins-docs
Contribution: Random Stuff
2021-04-30 10:48:11 +02:00
Julian Molina 216e2f38e1 Random Stuff 2021-04-30 10:46:48 +02:00
Pedro González Serrano 0792bed42c Improve docker info 2021-04-30 08:07:56 +02:00
Julian Molina 5dca2edf44 Merge pull request #853 from 0xperez/plugins-docs
Translated Contribute to Superalgos Tutorial
2021-04-29 19:47:18 +02:00
Luis Fernando Molina 9d2c818372 API Fetcher bot, multi page feature bug fixed 2021-04-29 19:43:43 +02:00
Luis Fernando Molina a59418a386 API Fetcher bot, multi page feature implemented 2021-04-29 19:15:08 +02:00
Luis Fernando Molina 3e70cda005 API Fetcher bot, primary keys management 2021-04-29 18:08:57 +02:00
Luis Fernando Molina 2049216ab7 API Fetcher bot, basic implementation 2021-04-29 17:39:35 +02:00
Luis Fernando Molina 1313529204 Merge pull request #854 from NITEMAN/docker-tagging
Docker tagging & cleanup
2021-04-29 09:20:14 -04:00
Luis Fernando Molina b459ef91a2 Merge pull request #855 from ssplatt/discord-integration
fixes some ui elements of the social bots
2021-04-29 09:16:55 -04:00
Brett Taylor c28542bdcc fixes some ui elements of the social bots 2021-04-29 08:52:35 -04:00
Pedro González Serrano 3e1829cb3e Update docker run instructions 2021-04-29 13:23:09 +02:00
Pedro González Serrano 866932658f Remove duplicated namespace 2021-04-29 13:06:03 +02:00
Pedro González Serrano 618c1b323e Add tagging for develop branch 2021-04-29 12:33:39 +02:00
Pedro González Serrano 362a561bf6 Fix docker tagging 2021-04-29 12:20:50 +02:00
0xperez c828d92d42 Translated Contribute to Superalgos Tutorial 2021-04-28 22:37:00 +02:00
Julian Molina 19afab17c4 Merge pull request #852 from 9808us/plugins-docs
Fix fourth Not fifth bot english + italian
2021-04-28 16:57:05 +02:00
9808us 704ffb48e9 Fix fourth Not fifth bot english + italian 2021-04-28 16:36:05 +02:00
Smidy13 be094ba536 Renaming Variables to More Accurate Names, Adding in Promises for Functions 2021-04-28 22:50:51 +12:00
Julian Molina 5166d936e5 Merge pull request #850 from 0xperez/plugins-docs
Plugins docs
2021-04-28 11:02:56 +02:00
0xperez 0d944dd532 Translating Basic Edu Tutorial - Page 006 to 055 2021-04-28 08:59:23 +02:00
Smidy13 d052098b66 Moving back if statement moved during testing, setting InvalidDate at right point 2021-04-28 17:45:02 +12:00
Smidy13 0b9af11663 Bug Fix: Unnecessary Halt in getOHLCVs, Handling for Invalid Start Date on getOHLCVs & Handling for Exchange maintenance over limit 2021-04-28 17:13:45 +12:00
Luis Fernando Molina f0ad6c51eb Merge pull request #847 from ssplatt/discord-webhook-announce
WIP: Discord webhook announce
2021-04-27 20:50:58 -04:00
0xperez 51f8d1be23 Translating Basic Edu Tutorial - Page 036 to 043 2021-04-27 22:22:34 +02:00
Brett Taylor 3831809f6c add more discord bot config and docs 2021-04-27 14:41:06 -04:00
Brett Taylor f59dbeec3b initial discord webook bot 2021-04-27 09:39:10 -04:00
Julian Molina 05cb622da1 Merge pull request #844 from 0xperez/plugins-docs
Translating Basic Edu Tutorial - Page 002 to 017
2021-04-27 09:42:16 +02:00
0xperez 1a7fe13fb6 Translating Basic Edu Tutorial - Page 023 to 035 2021-04-27 08:07:47 +02:00
Luis Fernando Molina 396feb5c6b Merge pull request #845 from Luis-Fernando-Molina/develop
Contribution: Important Bug Fixed at Lighting Path Function Impacting sequence of same type nodes.
2021-04-26 18:08:52 -04:00
Luis Fernando Molina 2fc11db5b2 Important Bug Fixed at Lighting Path Function Impacting sequence of same type nodes. 2021-04-27 00:07:53 +02:00
0xperez cab94f8cd1 Translating Basic Edu Tutorial - Page 018 to 022 2021-04-26 22:03:52 +02:00
0xperez eff024dbbf Translating Basic Edu Tutorial - Page 002 to 017 2021-04-26 20:30:13 +02:00
Luis Fernando Molina a380bd8b05 Merge pull request #836 from harrellbm/develop
Create Windows Shortcut Script
2021-04-26 10:01:32 -04:00
Luis Fernando Molina 0e94b41d97 Merge pull request #843 from Luis-Fernando-Molina/develop
Contribution: Reapplied Telegram Bot Test Message definition
2021-04-26 09:42:37 -04:00
Luis Fernando Molina 576c930476 Reapplied Telegram Bot Test Message definition 2021-04-26 15:41:51 +02:00
Luis Fernando Molina 0184cc64d5 Merge pull request #824 from Luis-Fernando-Molina/develop
Contribution: API Data Fetcher Bots Implementation
2021-04-26 09:40:23 -04:00
Luis Fernando Molina bcc2513ff1 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-04-26 15:39:47 +02:00
Luis Fernando Molina 295b082521 Merge pull request #838 from Smidy13/develop
Bug Fix: 'Closing' state of Close Stage, Trading Session getting stuck on Run Request Sent & Improvement: Telegram Bot Test Function
2021-04-26 09:36:43 -04:00
Julian Molina 0ada5377c9 Merge pull request #839 from scarolan/plugins-docs
My Superalgos Review
2021-04-26 13:59:50 +02:00
Julian Molina 7d26bd3309 Merge pull request #837 from Smidy13/plugins-docs
Docs-Nodes: Announcement Node
2021-04-26 13:55:40 +02:00
Smidy13 9419d0b849 Adding ProjectSchema changes for Telegram Test Function. Also Bug Fix: Tutorial Not Loading 2021-04-26 17:34:09 +12:00
Brenden Harrell 290715c2a9 Initial work on Revision 4 2021-04-25 21:00:02 -06:00
Smidy13 17d21c501d Improvement: Telegram Test Function 2021-04-26 00:40:30 +12:00
Sean Carolan d90aeda34e My Superalgos Review 2021-04-25 12:35:01 +00:00
Smidy13 d9f4fef9ae Bug Fix: Trading Session getting stuck on Run Request Sent 2021-04-25 21:23:23 +12:00
Smidy13 ac29a6f863 Bug Fix: Adding in Handling for 'Closing' state of Close Stage 2021-04-25 18:35:46 +12:00
Smidy13 dbfac533c7 Docs-Nodes: Announcement Node 2021-04-25 09:06:49 +12:00
Smidy d5f37611e9 Merge pull request #9 from Superalgos/develop
Merge Develop
2021-04-25 08:43:02 +12:00
Luis Fernando Molina ece6b383e5 Stuck at possible bug on Lignting Path Function 2021-04-24 21:30:25 +02:00
Brenden Harrell fc4aa929e5 Rename Folder Launch-Scripts 2021-04-24 12:42:25 -06:00
Brenden Harrell 204cf9e3b6 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-04-24 10:12:17 -06:00
Brenden Harrell 2e309856ad move linux lauch script to GUI-Launch folder 2021-04-24 10:12:03 -06:00
Brenden Harrell ea1ff46c20 Create windows shortcut script 2021-04-24 10:42:28 -05:00
Luis Fernando Molina ba4eca543a Merge pull request #834 from harrellbm/develop
Simple Launch Scripts
2021-04-24 08:55:41 -04:00
Luis Fernando Molina 25c3e2d9a7 Merge pull request #835 from Smidy13/develop
Bug Fix: Close Stage Event not triggering / Improvement: Bot Using Commands and Greater Assistance
2021-04-24 08:54:09 -04:00
Smidy13 ffa1b25510 Improvement: Bot Using Commands and Greater Assistance 2021-04-24 22:13:08 +12:00
Smidy13 ebd1148e1f Bug Fix: Close Stage Event not triggering 2021-04-24 20:44:41 +12:00
Smidy13 5e0d39cb98 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-04-24 16:38:22 +12:00
Brenden Harrell 6b3acaa720 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-04-23 21:29:04 -05:00
Brenden Harrell afa1b8e1af windows launch script 2021-04-23 21:21:32 -05:00
Brenden Harrell 109ea8ff02 Linux Launch Script 2021-04-23 20:53:29 -05:00
Luis Fernando Molina 5d1804853d Tutorial Bug new text to refresh the UI 2021-04-23 23:00:28 +02:00
Luis Fernando Molina cbfdf6c321 Merge pull request #833 from 9808us/develop
Fix Left click with Right click
2021-04-23 12:44:00 -04:00
9808us bb4ebf1864 Fix Left click with Right click 2021-04-23 15:28:10 +02:00
Julian Molina e8afe2be01 Merge pull request #831 from harrellbm/plugins-docs
Setting up a New Chart Tutorial Revision 3
2021-04-21 20:23:36 +02:00
Brenden Harrell 0b5dc2200b Merge branch 'plugins-docs' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-04-21 12:18:22 -05:00
Brenden Harrell e59377e1f0 Update Workspace 2021-04-21 12:17:20 -05:00
Brenden Harrell 005dbbbbf7 Setting up a new Chart Tutorial Revision 3 2021-04-21 12:14:01 -05:00
Luis Fernando Molina 593258668b Ready to code the fetching of data from the API 2021-04-21 18:55:46 +02:00
Luis Fernando Molina 62bf2d0e5f Reaching the API Data Fetcher Fetching Process while Debugging. 2021-04-20 22:37:31 +02:00
Luis Fernando Molina 6e2742a930 Bug Fixed preventing Tasks to start 2021-04-20 21:19:31 +02:00
Luis Fernando Molina dde871e57e API Data Fetcher UI code fully implemented 2021-04-20 18:26:01 +02:00
Luis Fernando Molina 91b9969f68 API Data Fetcher added to UI code 2021-04-20 17:34:57 +02:00
Luis Fernando Molina 89bd9393a7 App Schema File Splitted into Individual Schema Documents Files 2021-04-20 15:31:23 +02:00
Luis Fernando Molina ee7cb0c835 API Map Schema at 90% 2021-04-20 14:31:03 +02:00
Smidy13 7c75576731 Merge branch 'develop' of https://github.com/Superalgos/Superalgos into develop 2021-04-20 17:40:52 +12:00
Luis Fernando Molina 88a8b9d702 Get all News Messari Endpoint Fully Mapped 2021-04-19 21:02:25 +02:00
Luis Fernando Molina fca33e54ee Merge pull request #828 from Superalgos/plugins-docs
Token Task Force Docs
2021-04-19 14:06:49 -04:00
Luis Fernando Molina 88aa4f8838 Merge pull request #827 from Superalgos/plugins-docs
Token Task Force Docs
2021-04-19 14:06:09 -04:00
Julian Molina 178e93fbb2 Merge pull request #826 from julian-molina/plugins-docs
Contribution: Token task force
2021-04-19 19:38:23 +02:00
Julian Molina 922fbeecef Token task force 2021-04-19 19:37:02 +02:00
Julian Molina 021b9b0fde Merge pull request #825 from julian-molina/plugins-docs
Contribution: Superalgos chat groups
2021-04-19 17:50:22 +02:00
Julian Molina 1bab9e5dbc Superalgos chat groups topic 2021-04-19 17:34:54 +02:00
Luis Fernando Molina 1c7c3184e1 API Map Schema at 75% 2021-04-19 16:48:15 +02:00
Brenden Harrell 8a01d25b53 Remove "Quick Fix" page 2021-04-19 09:34:01 -05:00
Brenden Harrell 17b7479c3e Change titles to start with Tutorial Step 2021-04-19 09:33:17 -05:00
Luis Fernando Molina c5e0753bc3 API Map Schema at 50% 2021-04-19 16:17:25 +02:00
Brenden Harrell 890455bc7a Merge branch 'develop' of https://github.com/Superalgos/Superalgos into plugins-docs 2021-04-19 09:12:34 -05:00
Luis Fernando Molina 34e080360c API Data Fetcher Bots Implementation 2021-04-19 14:32:57 +02:00
Luis Fernando Molina 623418ee14 Merge branch 'master' into plugins-docs 2021-04-19 13:13:14 +02:00
Luis Fernando Molina 92f3a86f65 Merge pull request #823 from Superalgos/develop
Superalgos Beta 9 SP 2
2021-04-19 07:12:20 -04:00
Julian Molina 188339c860 Merge pull request #822 from HenningBertsch/origin/plugins-docs
Fixed a typo where 'of' was written instead of 'off'
2021-04-19 09:31:55 +02:00
Henning Bertsch 3d778eaf63 Merge remote-tracking branch 'upstream/plugins-docs' into origin/plugins-docs 2021-04-19 09:20:27 +02:00
Julian Molina 1057c87a2d Merge pull request #816 from 0xperez/develop
Translating the Welcome Tutorial - Final Review
2021-04-18 21:18:50 +02:00
Luis Fernando Molina d4d26671b7 Merge pull request #821 from Luis-Fernando-Molina/develop
Contribution: Bug Fix: Tutorial loading without Content and needing Refresh of the UI
2021-04-18 10:27:19 -04:00
Luis Fernando Molina 70de50d9d0 Bug Fix: Tutorial loading without Content and needing Refresh of the UI 2021-04-18 16:26:10 +02:00
Luis Fernando Molina 5a7a0ea99d Merge pull request #820 from Luis-Fernando-Molina/develop
Contribution: Detaching from Parent Node and from Reference Parent now only possible with Double Click
2021-04-18 09:54:42 -04:00
Luis Fernando Molina 7348983569 Detaching from Parent Node and from Reference Parent now only possible with Double Click 2021-04-18 15:53:41 +02:00
Luis Fernando Molina 182dad6662 Merge pull request #818 from Luis-Fernando-Molina/develop
Contribution: Indicators Parameters Defined at the Task Level
2021-04-18 09:04:32 -04:00
Luis Fernando Molina cbba6e5a2e Indicators Parameters Defined at the Task Level 2021-04-18 14:34:43 +02:00
0xperez 7bf7f7be83 Translating the Welcome Tutorial - Final Review 2021-04-17 12:05:11 +02:00
Henning Bertsch eaa71e5b23 Fixed a typo where the docs referred to the 'off state' but written was 'of' 2021-04-17 10:52:29 +02:00
Luis Fernando Molina 610c1db268 Merge branch 'master' into plugins-docs 2021-04-16 18:10:49 +02:00
Luis Fernando Molina d35648ef08 Merge branch 'develop' into plugins-docs 2021-04-06 21:17:25 +02:00
Luis Fernando Molina 802b422b40 Merge pull request #778 from Luis-Fernando-Molina/plugins-docs
Plugins docs
2021-04-06 15:15:28 -04:00
Brenden Harrell 8ad6838caf Merge remote-tracking branch 'upstream/master' 2021-04-03 09:05:50 -05:00
Brenden Harrell 32f0602043 My Superalgos Review 2021-03-14 20:54:07 -05:00
15274 changed files with 58701 additions and 3166728 deletions

No files matched your search

+5 -2
View File
@@ -12,7 +12,7 @@ jobs:
- id: repository
uses: ASzc/change-string-case-action@v1
with:
string: "${{ github.repository }}/${{ github.event.repository.name }}"
string: "${{ github.repository }}"
- uses: actions/checkout@v2
- name: Preparation
id: prep
@@ -20,9 +20,12 @@ jobs:
REGISTRY="ghcr.io"
IMAGE="${REGISTRY}/${{ steps.repository.outputs.lowercase }}"
TAGS="${IMAGE}:${{ github.sha }}"
if [[ $GITHUB_REF == ref/head/master ]]; then
if [[ $GITHUB_REF == refs/heads/master ]]; then
TAGS="${TAGS},${IMAGE}:latest"
fi
if [[ $GITHUB_REF == refs/heads/develop ]]; then
TAGS="${TAGS},${IMAGE}:develop"
fi
echo ::set-output name=tags::${TAGS}
- name: Login in to registry
uses: docker/login-action@v1
+4 -1
View File
@@ -6,5 +6,8 @@ debug.log
*.db
Projects/Superalgos/Icons/Thumbs.db
*.bat
!launch-windows.bat
!create-shortcut-windows.bat
!uninstall-shortcut-windows.bat
*.exe
node_modules
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

+6
View File
@@ -19,6 +19,7 @@ color: #324d50;
line-height: 150%;
margin: 20 30px;
margin: 20 25 20 30px;
caret-color: transparent;
}
.docs-node-html-footer-container {
@@ -29,6 +30,7 @@ line-height: 160%;
border-top: 5px solid #0295aa;
margin: 80px 0 0 0;
padding: 30 0 20 0px;
caret-color: transparent;
}
/* DELETE candidate (delete class assignment on DocsSapace.js too)
@@ -236,6 +238,7 @@ z-index:100;
padding: 0px 10px;
font-size: 95%;
line-height: 140%;
caret-color: #111;
}
/* Alerts */
@@ -810,6 +813,7 @@ display: table;
vertical-align: middle;
display: table-cell;
padding-right: 25px;
caret-color: transparent;
}
.docs-search-results-box {
@@ -826,6 +830,7 @@ width: 100%;
display: table;
padding-left: 180px;
margin-top: 20px;
caret-color: transparent;
}
.docs-search-results-header-tabs-container > input {
@@ -856,6 +861,7 @@ border-bottom: 3px solid #0295aa;
.docs-search-result-content {
border-top: 1px solid #0295aa;
margin-left: -180px;
caret-color: transparent;
}
.docs-search-result-content > div {
+6
View File
@@ -6,6 +6,9 @@ border: 2px solid;
border-color: #1b998b;
border-radius: 8px;
background-color: #fdfdfd;
-webkit-transition-duration: 1s;
transition-duration: 1s;
caret-color: transparent;
}
.tutorial-summary {
@@ -220,6 +223,9 @@ margin-left: auto;
margin-right: auto;
margin-bottom: 20px;
width: 100%;
-webkit-transition-duration: 1s;
transition-duration: 1s;
caret-color: transparent;
}
.tutorial-buttonsTable {
+1 -1
View File
@@ -127,7 +127,7 @@ try {
console.log('Http Interface .............................................. Listening at port ' + global.env.HTTP_INTERFACE_PORT)
console.log('')
console.log("You are running Superalgos Beta 9")
console.log("You are running Superalgos Beta 10")
console.log('')
console.log("What's new? The following was implemented here:")
console.log('')
+7 -21
View File
@@ -681,7 +681,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
const octokit = new Octokit({
auth: token,
userAgent: 'Superalgos Beta 9'
userAgent: 'Superalgos Beta 10'
})
const repo = 'Superalgos'
@@ -1112,7 +1112,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
let fs = require('fs')
try {
let filePath = global.env.PATH_TO_DEFAULT_WORKSPACE + '/Getting-Started.json'
let filePath = global.env.PATH_TO_DEFAULT_WORKSPACE + '/Getting-Started-Tutorials.json'
fs.readFile(filePath, onFileRead)
} catch (e) {
console.log('[ERROR] Error reading the Workspace.', e)
@@ -1496,27 +1496,13 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
function sendSchema(filePath, schemaType) {
let fs = require('fs')
if (schemaType === 'AppSchema') {
let fileName = 'AppSchema.json'
try {
filePath = filePath + fileName
fs.readFile(filePath, onFileRead)
} catch (e) {
console.log('[ERROR] Error reading the ' + fileName, e)
}
function onFileRead(err, schema) {
if (err) {
respondWithContent(undefined, httpResponse)
} else {
respondWithContent(schema, httpResponse)
}
}
} else {
try {
let folder = ''
switch (schemaType) {
case 'AppSchema': {
folder = 'App-Schema'
break
}
case 'DocsNodeSchema': {
folder = 'Docs-Nodes'
break
@@ -1560,7 +1546,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
}
respondWithContent("[]", httpResponse)
}
}
}
function sendStyleSheet(fileName) {
-1
View File
@@ -1 +0,0 @@
export const version = "abi/5.0.0-beta.153";
-91
View File
@@ -1,91 +0,0 @@
"use strict";
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
import { arrayify } from "@ethersproject/bytes";
import { defineReadOnly } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
import { Reader, Writer } from "./coders/abstract-coder";
import { AddressCoder } from "./coders/address";
import { ArrayCoder } from "./coders/array";
import { BooleanCoder } from "./coders/boolean";
import { BytesCoder } from "./coders/bytes";
import { FixedBytesCoder } from "./coders/fixed-bytes";
import { NullCoder } from "./coders/null";
import { NumberCoder } from "./coders/number";
import { StringCoder } from "./coders/string";
import { TupleCoder } from "./coders/tuple";
import { ParamType } from "./fragments";
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
export class AbiCoder {
constructor(coerceFunc) {
logger.checkNew(new.target, AbiCoder);
defineReadOnly(this, "coerceFunc", coerceFunc || null);
}
_getCoder(param) {
switch (param.baseType) {
case "address":
return new AddressCoder(param.name);
case "bool":
return new BooleanCoder(param.name);
case "string":
return new StringCoder(param.name);
case "bytes":
return new BytesCoder(param.name);
case "array":
return new ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name);
case "tuple":
return new TupleCoder((param.components || []).map((component) => {
return this._getCoder(component);
}), param.name);
case "":
return new NullCoder(param.name);
}
// u?int[0-9]*
let match = param.type.match(paramTypeNumber);
if (match) {
let size = parseInt(match[2] || "256");
if (size === 0 || size > 256 || (size % 8) !== 0) {
logger.throwArgumentError("invalid " + match[1] + " bit length", "param", param);
}
return new NumberCoder(size / 8, (match[1] === "int"), param.name);
}
// bytes[0-9]+
match = param.type.match(paramTypeBytes);
if (match) {
let size = parseInt(match[1]);
if (size === 0 || size > 32) {
logger.throwArgumentError("invalid bytes length", "param", param);
}
return new FixedBytesCoder(size, param.name);
}
return logger.throwArgumentError("invalid type", "type", param.type);
}
_getWordSize() { return 32; }
_getReader(data) {
return new Reader(data, this._getWordSize(), this.coerceFunc);
}
_getWriter() {
return new Writer(this._getWordSize());
}
encode(types, values) {
if (types.length !== values.length) {
logger.throwError("types/values length mismatch", Logger.errors.INVALID_ARGUMENT, {
count: { types: types.length, values: values.length },
value: { types: types, values: values }
});
}
const coders = types.map((type) => this._getCoder(ParamType.from(type)));
const coder = (new TupleCoder(coders, "_"));
const writer = this._getWriter();
coder.encode(writer, values);
return writer.data;
}
decode(types, data) {
const coders = types.map((type) => this._getCoder(ParamType.from(type)));
const coder = new TupleCoder(coders, "_");
return coder.decode(this._getReader(arrayify(data)));
}
}
export const defaultAbiCoder = new AbiCoder();
-131
View File
@@ -1,131 +0,0 @@
"use strict";
import { arrayify, concat, hexlify } from "@ethersproject/bytes";
import { BigNumber } from "@ethersproject/bignumber";
import { defineReadOnly } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "../_version";
const logger = new Logger(version);
export function checkResultErrors(result) {
// Find the first error (if any)
const errors = [];
const checkErrors = function (path, object) {
if (!Array.isArray(object)) {
return;
}
for (let key in object) {
const childPath = path.slice();
childPath.push(key);
try {
checkErrors(childPath, object[key]);
}
catch (error) {
errors.push({ path: childPath, error: error });
}
}
};
checkErrors([], result);
return errors;
}
export class Coder {
constructor(name, type, localName, dynamic) {
// @TODO: defineReadOnly these
this.name = name;
this.type = type;
this.localName = localName;
this.dynamic = dynamic;
}
_throwError(message, value) {
logger.throwArgumentError(message, this.localName, value);
}
}
export class Writer {
constructor(wordSize) {
defineReadOnly(this, "wordSize", wordSize || 32);
this._data = arrayify([]);
this._padding = new Uint8Array(wordSize);
}
get data() { return hexlify(this._data); }
get length() { return this._data.length; }
_writeData(data) {
this._data = concat([this._data, data]);
return data.length;
}
// Arrayish items; padded on the right to wordSize
writeBytes(value) {
let bytes = arrayify(value);
if (bytes.length % this.wordSize) {
bytes = concat([bytes, this._padding.slice(bytes.length % this.wordSize)]);
}
return this._writeData(bytes);
}
_getValue(value) {
let bytes = arrayify(BigNumber.from(value));
if (bytes.length > this.wordSize) {
logger.throwError("value out-of-bounds", Logger.errors.BUFFER_OVERRUN, {
length: this.wordSize,
offset: bytes.length
});
}
if (bytes.length % this.wordSize) {
bytes = concat([this._padding.slice(bytes.length % this.wordSize), bytes]);
}
return bytes;
}
// BigNumberish items; padded on the left to wordSize
writeValue(value) {
return this._writeData(this._getValue(value));
}
writeUpdatableValue() {
let offset = this.length;
this.writeValue(0);
return (value) => {
this._data.set(this._getValue(value), offset);
};
}
}
export class Reader {
constructor(data, wordSize, coerceFunc) {
defineReadOnly(this, "_data", arrayify(data));
defineReadOnly(this, "wordSize", wordSize || 32);
defineReadOnly(this, "_coerceFunc", coerceFunc);
this._offset = 0;
}
get data() { return hexlify(this._data); }
get consumed() { return this._offset; }
// The default Coerce function
static coerce(name, value) {
let match = name.match("^u?int([0-9]+)$");
if (match && parseInt(match[1]) <= 48) {
value = value.toNumber();
}
return value;
}
coerce(name, value) {
if (this._coerceFunc) {
return this._coerceFunc(name, value);
}
return Reader.coerce(name, value);
}
_peekBytes(offset, length) {
let alignedLength = Math.ceil(length / this.wordSize) * this.wordSize;
if (this._offset + alignedLength > this._data.length) {
logger.throwError("data out-of-bounds", Logger.errors.BUFFER_OVERRUN, {
length: this._data.length,
offset: this._offset + alignedLength
});
}
return this._data.slice(this._offset, this._offset + alignedLength);
}
subReader(offset) {
return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc);
}
readBytes(length) {
let bytes = this._peekBytes(0, length);
this._offset += bytes.length;
// @TODO: Make sure the length..end bytes are all 0?
return bytes.slice(0, length);
}
readValue() {
return BigNumber.from(this.readBytes(this.wordSize));
}
}
-21
View File
@@ -1,21 +0,0 @@
"use strict";
import { getAddress } from "@ethersproject/address";
import { hexZeroPad } from "@ethersproject/bytes";
import { Coder } from "./abstract-coder";
export class AddressCoder extends Coder {
constructor(localName) {
super("address", "address", localName, false);
}
encode(writer, value) {
try {
getAddress(value);
}
catch (error) {
this._throwError(error.message, value);
}
return writer.writeValue(value);
}
decode(reader) {
return getAddress(hexZeroPad(reader.readValue().toHexString(), 20));
}
}
-15
View File
@@ -1,15 +0,0 @@
"use strict";
import { Coder } from "./abstract-coder";
// Clones the functionality of an existing Coder, but without a localName
export class AnonymousCoder extends Coder {
constructor(coder) {
super(coder.name, coder.type, undefined, coder.dynamic);
this.coder = coder;
}
encode(writer, value) {
return this.coder.encode(writer, value);
}
decode(reader) {
return this.coder.decode(reader);
}
}
-165
View File
@@ -1,165 +0,0 @@
"use strict";
import { Logger } from "@ethersproject/logger";
import { version } from "../_version";
const logger = new Logger(version);
import { Coder, Writer } from "./abstract-coder";
import { AnonymousCoder } from "./anonymous";
export function pack(writer, coders, values) {
if (Array.isArray(values)) {
// do nothing
}
else if (values && typeof (values) === "object") {
let arrayValues = [];
coders.forEach(function (coder) {
arrayValues.push(values[coder.localName]);
});
values = arrayValues;
}
else {
logger.throwArgumentError("invalid tuple value", "tuple", values);
}
if (coders.length !== values.length) {
logger.throwArgumentError("types/value length mismatch", "tuple", values);
}
let staticWriter = new Writer(writer.wordSize);
let dynamicWriter = new Writer(writer.wordSize);
let updateFuncs = [];
coders.forEach((coder, index) => {
let value = values[index];
if (coder.dynamic) {
// Get current dynamic offset (for the future pointer)
let dynamicOffset = dynamicWriter.length;
// Encode the dynamic value into the dynamicWriter
coder.encode(dynamicWriter, value);
// Prepare to populate the correct offset once we are done
let updateFunc = staticWriter.writeUpdatableValue();
updateFuncs.push((baseOffset) => {
updateFunc(baseOffset + dynamicOffset);
});
}
else {
coder.encode(staticWriter, value);
}
});
// Backfill all the dynamic offsets, now that we know the static length
updateFuncs.forEach((func) => { func(staticWriter.length); });
let length = writer.writeBytes(staticWriter.data);
length += writer.writeBytes(dynamicWriter.data);
return length;
}
export function unpack(reader, coders) {
let values = [];
// A reader anchored to this base
let baseReader = reader.subReader(0);
// The amount of dynamic data read; to consume later to synchronize
let dynamicLength = 0;
coders.forEach((coder) => {
let value = null;
if (coder.dynamic) {
let offset = reader.readValue();
let offsetReader = baseReader.subReader(offset.toNumber());
try {
value = coder.decode(offsetReader);
}
catch (error) {
// Cannot recover from this
if (error.code === Logger.errors.BUFFER_OVERRUN) {
throw error;
}
value = error;
value.baseType = coder.name;
value.name = coder.localName;
value.type = coder.type;
}
dynamicLength += offsetReader.consumed;
}
else {
try {
value = coder.decode(reader);
}
catch (error) {
// Cannot recover from this
if (error.code === Logger.errors.BUFFER_OVERRUN) {
throw error;
}
value = error;
value.baseType = coder.name;
value.name = coder.localName;
value.type = coder.type;
}
}
if (value != undefined) {
values.push(value);
}
});
// @TODO: get rid of this an see if it still works?
// Consume the dynamic components in the main reader
reader.readBytes(dynamicLength);
// Add any named parameters (i.e. tuples)
coders.forEach((coder, index) => {
let name = coder.localName;
if (!name) {
return;
}
if (name === "length") {
name = "_length";
}
if (values[name] != null) {
return;
}
const value = values[index];
if (value instanceof Error) {
Object.defineProperty(values, name, {
get: () => { throw value; }
});
}
else {
values[name] = value;
}
});
for (let i = 0; i < values.length; i++) {
const value = values[i];
if (value instanceof Error) {
Object.defineProperty(values, i, {
get: () => { throw value; }
});
}
}
return Object.freeze(values);
}
export class ArrayCoder extends Coder {
constructor(coder, length, localName) {
const type = (coder.type + "[" + (length >= 0 ? length : "") + "]");
const dynamic = (length === -1 || coder.dynamic);
super("array", type, localName, dynamic);
this.coder = coder;
this.length = length;
}
encode(writer, value) {
if (!Array.isArray(value)) {
this._throwError("expected array value", value);
}
let count = this.length;
if (count === -1) {
count = value.length;
writer.writeValue(value.length);
}
logger.checkArgumentCount(count, value.length, "coder array" + (this.localName ? (" " + this.localName) : ""));
let coders = [];
for (let i = 0; i < value.length; i++) {
coders.push(this.coder);
}
return pack(writer, coders, value);
}
decode(reader) {
let count = this.length;
if (count === -1) {
count = reader.readValue().toNumber();
}
let coders = [];
for (let i = 0; i < count; i++) {
coders.push(new AnonymousCoder(this.coder));
}
return reader.coerce(this.name, unpack(reader, coders));
}
}
-13
View File
@@ -1,13 +0,0 @@
"use strict";
import { Coder } from "./abstract-coder";
export class BooleanCoder extends Coder {
constructor(localName) {
super("bool", "bool", localName, false);
}
encode(writer, value) {
return writer.writeValue(value ? 1 : 0);
}
decode(reader) {
return reader.coerce(this.type, !reader.readValue().isZero());
}
}
-25
View File
@@ -1,25 +0,0 @@
"use strict";
import { arrayify, hexlify } from "@ethersproject/bytes";
import { Coder } from "./abstract-coder";
export class DynamicBytesCoder extends Coder {
constructor(type, localName) {
super(type, type, localName, true);
}
encode(writer, value) {
value = arrayify(value);
let length = writer.writeValue(value.length);
length += writer.writeBytes(value);
return length;
}
decode(reader) {
return reader.readBytes(reader.readValue().toNumber());
}
}
export class BytesCoder extends DynamicBytesCoder {
constructor(localName) {
super("bytes", localName);
}
decode(reader) {
return reader.coerce(this.name, hexlify(super.decode(reader)));
}
}
-21
View File
@@ -1,21 +0,0 @@
"use strict";
import { arrayify, hexlify } from "@ethersproject/bytes";
import { Coder } from "./abstract-coder";
// @TODO: Merge this with bytes
export class FixedBytesCoder extends Coder {
constructor(size, localName) {
let name = "bytes" + String(size);
super(name, name, localName, false);
this.size = size;
}
encode(writer, value) {
let data = arrayify(value);
if (data.length !== this.size) {
this._throwError("incorrect data length", value);
}
return writer.writeBytes(data);
}
decode(reader) {
return reader.coerce(this.name, hexlify(reader.readBytes(this.size)));
}
}
-17
View File
@@ -1,17 +0,0 @@
"use strict";
import { Coder } from "./abstract-coder";
export class NullCoder extends Coder {
constructor(localName) {
super("null", "", localName, false);
}
encode(writer, value) {
if (value != null) {
this._throwError("not null", value);
}
return writer.writeBytes([]);
}
decode(reader) {
reader.readBytes(0);
return reader.coerce(this.name, null);
}
}
-38
View File
@@ -1,38 +0,0 @@
"use strict";
import { BigNumber } from "@ethersproject/bignumber";
import { MaxUint256, NegativeOne, One, Zero } from "@ethersproject/constants";
import { Coder } from "./abstract-coder";
export class NumberCoder extends Coder {
constructor(size, signed, localName) {
const name = ((signed ? "int" : "uint") + (size * 8));
super(name, name, localName, false);
this.size = size;
this.signed = signed;
}
encode(writer, value) {
let v = BigNumber.from(value);
// Check bounds are safe for encoding
let maxUintValue = MaxUint256.mask(writer.wordSize * 8);
if (this.signed) {
let bounds = maxUintValue.mask(this.size * 8 - 1);
if (v.gt(bounds) || v.lt(bounds.add(One).mul(NegativeOne))) {
this._throwError("value out-of-bounds", value);
}
}
else if (v.lt(Zero) || v.gt(maxUintValue.mask(this.size * 8))) {
this._throwError("value out-of-bounds", value);
}
v = v.toTwos(this.size * 8).mask(this.size * 8);
if (this.signed) {
v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize);
}
return writer.writeValue(v);
}
decode(reader) {
let value = reader.readValue().mask(this.size * 8);
if (this.signed) {
value = value.fromTwos(this.size * 8);
}
return reader.coerce(this.name, value);
}
}
-14
View File
@@ -1,14 +0,0 @@
"use strict";
import { toUtf8Bytes, toUtf8String } from "@ethersproject/strings";
import { DynamicBytesCoder } from "./bytes";
export class StringCoder extends DynamicBytesCoder {
constructor(localName) {
super("string", localName);
}
encode(writer, value) {
return super.encode(writer, toUtf8Bytes(value));
}
decode(reader) {
return toUtf8String(super.decode(reader));
}
}
-24
View File
@@ -1,24 +0,0 @@
"use strict";
import { Coder } from "./abstract-coder";
import { pack, unpack } from "./array";
export class TupleCoder extends Coder {
constructor(coders, localName) {
let dynamic = false;
const types = [];
coders.forEach((coder) => {
if (coder.dynamic) {
dynamic = true;
}
types.push(coder.type);
});
const type = ("tuple(" + types.join(",") + ")");
super("tuple", type, localName, dynamic);
this.coders = coders;
}
encode(writer, value) {
return pack(writer, this.coders, value);
}
decode(reader) {
return reader.coerce(this.name, unpack(reader, this.coders));
}
}
-780
View File
@@ -1,780 +0,0 @@
"use strict";
import { BigNumber } from "@ethersproject/bignumber";
import { defineReadOnly } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
;
const _constructorGuard = {};
let ModifiersBytes = { calldata: true, memory: true, storage: true };
let ModifiersNest = { calldata: true, memory: true };
function checkModifier(type, name) {
if (type === "bytes" || type === "string") {
if (ModifiersBytes[name]) {
return true;
}
}
else if (type === "address") {
if (name === "payable") {
return true;
}
}
else if (type.indexOf("[") >= 0 || type === "tuple") {
if (ModifiersNest[name]) {
return true;
}
}
if (ModifiersBytes[name] || name === "payable") {
logger.throwArgumentError("invalid modifier", "name", name);
}
return false;
}
// @TODO: Make sure that children of an indexed tuple are marked with a null indexed
function parseParamType(param, allowIndexed) {
let originalParam = param;
function throwError(i) {
logger.throwArgumentError(`unexpected character at position ${i}`, "param", param);
}
param = param.replace(/\s/g, " ");
function newNode(parent) {
let node = { type: "", name: "", parent: parent, state: { allowType: true } };
if (allowIndexed) {
node.indexed = false;
}
return node;
}
let parent = { type: "", name: "", state: { allowType: true } };
let node = parent;
for (let i = 0; i < param.length; i++) {
let c = param[i];
switch (c) {
case "(":
if (node.state.allowType && node.type === "") {
node.type = "tuple";
}
else if (!node.state.allowParams) {
throwError(i);
}
node.state.allowType = false;
node.type = verifyType(node.type);
node.components = [newNode(node)];
node = node.components[0];
break;
case ")":
delete node.state;
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(i);
}
node.indexed = true;
node.name = "";
}
if (checkModifier(node.type, node.name)) {
node.name = "";
}
node.type = verifyType(node.type);
let child = node;
node = node.parent;
if (!node) {
throwError(i);
}
delete child.parent;
node.state.allowParams = false;
node.state.allowName = true;
node.state.allowArray = true;
break;
case ",":
delete node.state;
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(i);
}
node.indexed = true;
node.name = "";
}
if (checkModifier(node.type, node.name)) {
node.name = "";
}
node.type = verifyType(node.type);
let sibling = newNode(node.parent);
//{ type: "", name: "", parent: node.parent, state: { allowType: true } };
node.parent.components.push(sibling);
delete node.parent;
node = sibling;
break;
// Hit a space...
case " ":
// If reading type, the type is done and may read a param or name
if (node.state.allowType) {
if (node.type !== "") {
node.type = verifyType(node.type);
delete node.state.allowType;
node.state.allowName = true;
node.state.allowParams = true;
}
}
// If reading name, the name is done
if (node.state.allowName) {
if (node.name !== "") {
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(i);
}
if (node.indexed) {
throwError(i);
}
node.indexed = true;
node.name = "";
}
else if (checkModifier(node.type, node.name)) {
node.name = "";
}
else {
node.state.allowName = false;
}
}
}
break;
case "[":
if (!node.state.allowArray) {
throwError(i);
}
node.type += c;
node.state.allowArray = false;
node.state.allowName = false;
node.state.readArray = true;
break;
case "]":
if (!node.state.readArray) {
throwError(i);
}
node.type += c;
node.state.readArray = false;
node.state.allowArray = true;
node.state.allowName = true;
break;
default:
if (node.state.allowType) {
node.type += c;
node.state.allowParams = true;
node.state.allowArray = true;
}
else if (node.state.allowName) {
node.name += c;
delete node.state.allowArray;
}
else if (node.state.readArray) {
node.type += c;
}
else {
throwError(i);
}
}
}
if (node.parent) {
logger.throwArgumentError("unexpected eof", "param", param);
}
delete parent.state;
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(originalParam.length - 7);
}
if (node.indexed) {
throwError(originalParam.length - 7);
}
node.indexed = true;
node.name = "";
}
else if (checkModifier(node.type, node.name)) {
node.name = "";
}
parent.type = verifyType(parent.type);
return parent;
}
function populate(object, params) {
for (let key in params) {
defineReadOnly(object, key, params[key]);
}
}
export const FormatTypes = Object.freeze({
// Bare formatting, as is needed for computing a sighash of an event or function
sighash: "sighash",
// Human-Readable with Minimal spacing and without names (compact human-readable)
minimal: "minimal",
// Human-Readble with nice spacing, including all names
full: "full",
// JSON-format a la Solidity
json: "json"
});
const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/);
export class ParamType {
constructor(constructorGuard, params) {
if (constructorGuard !== _constructorGuard) {
logger.throwError("use fromString", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new ParamType()"
});
}
populate(this, params);
let match = this.type.match(paramTypeArray);
if (match) {
populate(this, {
arrayLength: parseInt(match[2] || "-1"),
arrayChildren: ParamType.fromObject({
type: match[1],
components: this.components
}),
baseType: "array"
});
}
else {
populate(this, {
arrayLength: null,
arrayChildren: null,
baseType: ((this.components != null) ? "tuple" : this.type)
});
}
this._isParamType = true;
Object.freeze(this);
}
// Format the parameter fragment
// - sighash: "(uint256,address)"
// - minimal: "tuple(uint256,address) indexed"
// - full: "tuple(uint256 foo, addres bar) indexed baz"
format(format) {
if (!format) {
format = FormatTypes.sighash;
}
if (!FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === FormatTypes.json) {
let result = {
type: ((this.baseType === "tuple") ? "tuple" : this.type),
name: (this.name || undefined)
};
if (typeof (this.indexed) === "boolean") {
result.indexed = this.indexed;
}
if (this.components) {
result.components = this.components.map((comp) => JSON.parse(comp.format(format)));
}
return JSON.stringify(result);
}
let result = "";
// Array
if (this.baseType === "array") {
result += this.arrayChildren.format(format);
result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]";
}
else {
if (this.baseType === "tuple") {
if (format !== FormatTypes.sighash) {
result += this.type;
}
result += "(" + this.components.map((comp) => comp.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ")";
}
else {
result += this.type;
}
}
if (format !== FormatTypes.sighash) {
if (this.indexed === true) {
result += " indexed";
}
if (format === FormatTypes.full && this.name) {
result += " " + this.name;
}
}
return result;
}
static from(value, allowIndexed) {
if (typeof (value) === "string") {
return ParamType.fromString(value, allowIndexed);
}
return ParamType.fromObject(value);
}
static fromObject(value) {
if (ParamType.isParamType(value)) {
return value;
}
return new ParamType(_constructorGuard, {
name: (value.name || null),
type: verifyType(value.type),
indexed: ((value.indexed == null) ? null : !!value.indexed),
components: (value.components ? value.components.map(ParamType.fromObject) : null)
});
}
static fromString(value, allowIndexed) {
function ParamTypify(node) {
return ParamType.fromObject({
name: node.name,
type: node.type,
indexed: node.indexed,
components: node.components
});
}
return ParamTypify(parseParamType(value, !!allowIndexed));
}
static isParamType(value) {
return !!(value != null && value._isParamType);
}
}
;
function parseParams(value, allowIndex) {
return splitNesting(value).map((param) => ParamType.fromString(param, allowIndex));
}
export class Fragment {
constructor(constructorGuard, params) {
if (constructorGuard !== _constructorGuard) {
logger.throwError("use a static from method", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new Fragment()"
});
}
populate(this, params);
this._isFragment = true;
Object.freeze(this);
}
static from(value) {
if (Fragment.isFragment(value)) {
return value;
}
if (typeof (value) === "string") {
return Fragment.fromString(value);
}
return Fragment.fromObject(value);
}
static fromObject(value) {
if (Fragment.isFragment(value)) {
return value;
}
switch (value.type) {
case "function":
return FunctionFragment.fromObject(value);
case "event":
return EventFragment.fromObject(value);
case "constructor":
return ConstructorFragment.fromObject(value);
case "fallback":
case "receive":
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
return null;
}
return logger.throwArgumentError("invalid fragment object", "value", value);
}
static fromString(value) {
// Make sure the "returns" is surrounded by a space and all whitespace is exactly one space
value = value.replace(/\s/g, " ");
value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " ");
value = value.trim();
if (value.split(" ")[0] === "event") {
return EventFragment.fromString(value.substring(5).trim());
}
else if (value.split(" ")[0] === "function") {
return FunctionFragment.fromString(value.substring(8).trim());
}
else if (value.split("(")[0].trim() === "constructor") {
return ConstructorFragment.fromString(value.trim());
}
return logger.throwArgumentError("unsupported fragment", "value", value);
}
static isFragment(value) {
return !!(value && value._isFragment);
}
}
export class EventFragment extends Fragment {
format(format) {
if (!format) {
format = FormatTypes.sighash;
}
if (!FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === FormatTypes.json) {
return JSON.stringify({
type: "event",
anonymous: this.anonymous,
name: this.name,
inputs: this.inputs.map((input) => JSON.parse(input.format(format)))
});
}
let result = "";
if (format !== FormatTypes.sighash) {
result += "event ";
}
result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") ";
if (format !== FormatTypes.sighash) {
if (this.anonymous) {
result += "anonymous ";
}
}
return result.trim();
}
static from(value) {
if (typeof (value) === "string") {
return EventFragment.fromString(value);
}
return EventFragment.fromObject(value);
}
static fromObject(value) {
if (EventFragment.isEventFragment(value)) {
return value;
}
if (value.type !== "event") {
logger.throwArgumentError("invalid event object", "value", value);
}
const params = {
name: verifyIdentifier(value.name),
anonymous: value.anonymous,
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
type: "event"
};
return new EventFragment(_constructorGuard, params);
}
static fromString(value) {
let match = value.match(regexParen);
if (!match) {
logger.throwArgumentError("invalid event string", "value", value);
}
let anonymous = false;
match[3].split(" ").forEach((modifier) => {
switch (modifier.trim()) {
case "anonymous":
anonymous = true;
break;
case "":
break;
default:
logger.warn("unknown modifier: " + modifier);
}
});
return EventFragment.fromObject({
name: match[1].trim(),
anonymous: anonymous,
inputs: parseParams(match[2], true),
type: "event"
});
}
static isEventFragment(value) {
return (value && value._isFragment && value.type === "event");
}
}
function parseGas(value, params) {
params.gas = null;
let comps = value.split("@");
if (comps.length !== 1) {
if (comps.length > 2) {
logger.throwArgumentError("invalid human-readable ABI signature", "value", value);
}
if (!comps[1].match(/^[0-9]+$/)) {
logger.throwArgumentError("invalid human-readable ABI signature gas", "value", value);
}
params.gas = BigNumber.from(comps[1]);
return comps[0];
}
return value;
}
function parseModifiers(value, params) {
params.constant = false;
params.payable = false;
params.stateMutability = "nonpayable";
value.split(" ").forEach((modifier) => {
switch (modifier.trim()) {
case "constant":
params.constant = true;
break;
case "payable":
params.payable = true;
params.stateMutability = "payable";
break;
case "pure":
params.constant = true;
params.stateMutability = "pure";
break;
case "view":
params.constant = true;
params.stateMutability = "view";
break;
case "external":
case "public":
case "":
break;
default:
console.log("unknown modifier: " + modifier);
}
});
}
function verifyState(value) {
let result = {
constant: false,
payable: true,
stateMutability: "payable"
};
if (value.stateMutability != null) {
result.stateMutability = value.stateMutability;
// Set (and check things are consistent) the constant property
result.constant = (result.stateMutability === "view" || result.stateMutability === "pure");
if (value.constant != null) {
if ((!!value.constant) !== result.constant) {
logger.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value);
}
}
// Set (and check things are consistent) the payable property
result.payable = (result.stateMutability === "payable");
if (value.payable != null) {
if ((!!value.payable) !== result.payable) {
logger.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value);
}
}
}
else if (value.payable != null) {
result.payable = !!value.payable;
// If payable we can assume non-constant; otherwise we can't assume
if (value.constant == null && !result.payable && value.type !== "constructor") {
logger.throwArgumentError("unable to determine stateMutability", "value", value);
}
result.constant = !!value.constant;
if (result.constant) {
result.stateMutability = "view";
}
else {
result.stateMutability = (result.payable ? "payable" : "nonpayable");
}
if (result.payable && result.constant) {
logger.throwArgumentError("cannot have constant payable function", "value", value);
}
}
else if (value.constant != null) {
result.constant = !!value.constant;
result.payable = !result.constant;
result.stateMutability = (result.constant ? "view" : "payable");
}
else if (value.type !== "constructor") {
logger.throwArgumentError("unable to determine stateMutability", "value", value);
}
return result;
}
export class ConstructorFragment extends Fragment {
format(format) {
if (!format) {
format = FormatTypes.sighash;
}
if (!FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === FormatTypes.json) {
return JSON.stringify({
type: "constructor",
stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined),
payble: this.payable,
gas: (this.gas ? this.gas.toNumber() : undefined),
inputs: this.inputs.map((input) => JSON.parse(input.format(format)))
});
}
if (format === FormatTypes.sighash) {
logger.throwError("cannot format a constructor for sighash", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "format(sighash)"
});
}
let result = "constructor(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") ";
if (this.stateMutability && this.stateMutability !== "nonpayable") {
result += this.stateMutability + " ";
}
return result.trim();
}
static from(value) {
if (typeof (value) === "string") {
return ConstructorFragment.fromString(value);
}
return ConstructorFragment.fromObject(value);
}
static fromObject(value) {
if (ConstructorFragment.isConstructorFragment(value)) {
return value;
}
if (value.type !== "constructor") {
logger.throwArgumentError("invalid constructor object", "value", value);
}
let state = verifyState(value);
if (state.constant) {
logger.throwArgumentError("constructor cannot be constant", "value", value);
}
const params = {
name: null,
type: value.type,
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
payable: state.payable,
stateMutability: state.stateMutability,
gas: (value.gas ? BigNumber.from(value.gas) : null)
};
return new ConstructorFragment(_constructorGuard, params);
}
static fromString(value) {
let params = { type: "constructor" };
value = parseGas(value, params);
let parens = value.match(regexParen);
if (!parens || parens[1].trim() !== "constructor") {
logger.throwArgumentError("invalid constructor string", "value", value);
}
params.inputs = parseParams(parens[2].trim(), false);
parseModifiers(parens[3].trim(), params);
return ConstructorFragment.fromObject(params);
}
static isConstructorFragment(value) {
return (value && value._isFragment && value.type === "constructor");
}
}
export class FunctionFragment extends ConstructorFragment {
format(format) {
if (!format) {
format = FormatTypes.sighash;
}
if (!FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === FormatTypes.json) {
return JSON.stringify({
type: "function",
name: this.name,
constant: this.constant,
stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined),
payble: this.payable,
gas: (this.gas ? this.gas.toNumber() : undefined),
inputs: this.inputs.map((input) => JSON.parse(input.format(format))),
ouputs: this.outputs.map((output) => JSON.parse(output.format(format))),
});
}
let result = "";
if (format !== FormatTypes.sighash) {
result += "function ";
}
result += this.name + "(" + this.inputs.map((input) => input.format(format)).join((format === FormatTypes.full) ? ", " : ",") + ") ";
if (format !== FormatTypes.sighash) {
if (this.stateMutability) {
if (this.stateMutability !== "nonpayable") {
result += (this.stateMutability + " ");
}
}
else if (this.constant) {
result += "view ";
}
if (this.outputs && this.outputs.length) {
result += "returns (" + this.outputs.map((output) => output.format(format)).join(", ") + ") ";
}
if (this.gas != null) {
result += "@" + this.gas.toString() + " ";
}
}
return result.trim();
}
static from(value) {
if (typeof (value) === "string") {
return FunctionFragment.fromString(value);
}
return FunctionFragment.fromObject(value);
}
static fromObject(value) {
if (FunctionFragment.isFunctionFragment(value)) {
return value;
}
if (value.type !== "function") {
logger.throwArgumentError("invalid function object", "value", value);
}
let state = verifyState(value);
const params = {
type: value.type,
name: verifyIdentifier(value.name),
constant: state.constant,
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
outputs: (value.outputs ? value.outputs.map(ParamType.fromObject) : []),
payable: state.payable,
stateMutability: state.stateMutability,
gas: (value.gas ? BigNumber.from(value.gas) : null)
};
return new FunctionFragment(_constructorGuard, params);
}
static fromString(value) {
let params = { type: "function" };
value = parseGas(value, params);
let comps = value.split(" returns ");
if (comps.length > 2) {
logger.throwArgumentError("invalid function string", "value", value);
}
let parens = comps[0].match(regexParen);
if (!parens) {
logger.throwArgumentError("invalid function signature", "value", value);
}
params.name = parens[1].trim();
if (params.name) {
verifyIdentifier(params.name);
}
params.inputs = parseParams(parens[2], false);
parseModifiers(parens[3].trim(), params);
// We have outputs
if (comps.length > 1) {
let returns = comps[1].match(regexParen);
if (returns[1].trim() != "" || returns[3].trim() != "") {
logger.throwArgumentError("unexpected tokens", "value", value);
}
params.outputs = parseParams(returns[2], false);
}
else {
params.outputs = [];
}
return FunctionFragment.fromObject(params);
}
static isFunctionFragment(value) {
return (value && value._isFragment && value.type === "function");
}
}
//export class ErrorFragment extends Fragment {
//}
//export class StructFragment extends Fragment {
//}
function verifyType(type) {
// These need to be transformed to their full description
if (type.match(/^uint($|[^1-9])/)) {
type = "uint256" + type.substring(4);
}
else if (type.match(/^int($|[^1-9])/)) {
type = "int256" + type.substring(3);
}
// @TODO: more verification
return type;
}
const regexIdentifier = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");
function verifyIdentifier(value) {
if (!value || !value.match(regexIdentifier)) {
logger.throwArgumentError(`invalid identifier "${value}"`, "value", value);
}
return value;
}
const regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");
function splitNesting(value) {
value = value.trim();
let result = [];
let accum = "";
let depth = 0;
for (let offset = 0; offset < value.length; offset++) {
let c = value[offset];
if (c === "," && depth === 0) {
result.push(accum);
accum = "";
}
else {
accum += c;
if (c === "(") {
depth++;
}
else if (c === ")") {
depth--;
if (depth === -1) {
logger.throwArgumentError("unbalanced parenthesis", "value", value);
}
}
}
}
if (accum) {
result.push(accum);
}
return result;
}
-5
View File
@@ -1,5 +0,0 @@
"use strict";
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
import { AbiCoder, defaultAbiCoder } from "./abi-coder";
import { checkResultErrors, Indexed, Interface, LogDescription, TransactionDescription } from "./interface";
export { ConstructorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription };
-492
View File
@@ -1,492 +0,0 @@
"use strict";
import { getAddress } from "@ethersproject/address";
import { BigNumber } from "@ethersproject/bignumber";
import { arrayify, concat, hexDataSlice, hexlify, hexZeroPad, isHexString } from "@ethersproject/bytes";
import { id } from "@ethersproject/hash";
import { keccak256 } from "@ethersproject/keccak256";
import { defineReadOnly, Description, getStatic } from "@ethersproject/properties";
import { defaultAbiCoder } from "./abi-coder";
import { checkResultErrors } from "./coders/abstract-coder";
import { ConstructorFragment, EventFragment, FormatTypes, Fragment, FunctionFragment, ParamType } from "./fragments";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
export { checkResultErrors };
export class LogDescription extends Description {
}
export class TransactionDescription extends Description {
}
export class Indexed extends Description {
static isIndexed(value) {
return !!(value && value._isIndexed);
}
}
function wrapAccessError(property, error) {
const wrap = new Error(`deferred error during ABI decoding triggered accessing ${property}`);
wrap.error = error;
return wrap;
}
function checkNames(fragment, type, params) {
params.reduce((accum, param) => {
if (param.name) {
if (accum[param.name]) {
logger.throwArgumentError(`duplicate ${type} parameter ${JSON.stringify(param.name)} in ${fragment.format("full")}`, "fragment", fragment);
}
accum[param.name] = true;
}
return accum;
}, {});
}
export class Interface {
constructor(fragments) {
logger.checkNew(new.target, Interface);
let abi = [];
if (typeof (fragments) === "string") {
abi = JSON.parse(fragments);
}
else {
abi = fragments;
}
defineReadOnly(this, "fragments", abi.map((fragment) => {
return Fragment.from(fragment);
}).filter((fragment) => (fragment != null)));
defineReadOnly(this, "_abiCoder", getStatic((new.target), "getAbiCoder")());
defineReadOnly(this, "functions", {});
defineReadOnly(this, "errors", {});
defineReadOnly(this, "events", {});
defineReadOnly(this, "structs", {});
// Add all fragments by their signature
this.fragments.forEach((fragment) => {
let bucket = null;
switch (fragment.type) {
case "constructor":
if (this.deploy) {
logger.warn("duplicate definition - constructor");
return;
}
checkNames(fragment, "input", fragment.inputs);
defineReadOnly(this, "deploy", fragment);
return;
case "function":
checkNames(fragment, "input", fragment.inputs);
checkNames(fragment, "output", fragment.outputs);
bucket = this.functions;
break;
case "event":
checkNames(fragment, "input", fragment.inputs);
bucket = this.events;
break;
default:
return;
}
let signature = fragment.format();
if (bucket[signature]) {
logger.warn("duplicate definition - " + signature);
return;
}
bucket[signature] = fragment;
});
// If we do not have a constructor add a default
if (!this.deploy) {
defineReadOnly(this, "deploy", ConstructorFragment.from({
payable: false,
type: "constructor"
}));
}
defineReadOnly(this, "_isInterface", true);
}
format(format) {
if (!format) {
format = FormatTypes.full;
}
if (format === FormatTypes.sighash) {
logger.throwArgumentError("interface does not support formatting sighash", "format", format);
}
const abi = this.fragments.map((fragment) => fragment.format(format));
// We need to re-bundle the JSON fragments a bit
if (format === FormatTypes.json) {
return JSON.stringify(abi.map((j) => JSON.parse(j)));
}
return abi;
}
// Sub-classes can override these to handle other blockchains
static getAbiCoder() {
return defaultAbiCoder;
}
static getAddress(address) {
return getAddress(address);
}
static getSighash(functionFragment) {
return hexDataSlice(id(functionFragment.format()), 0, 4);
}
static getEventTopic(eventFragment) {
return id(eventFragment.format());
}
// Find a function definition by any means necessary (unless it is ambiguous)
getFunction(nameOrSignatureOrSighash) {
if (isHexString(nameOrSignatureOrSighash)) {
for (const name in this.functions) {
if (nameOrSignatureOrSighash === this.getSighash(name)) {
return this.functions[name];
}
}
logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
}
// It is a bare name, look up the function (will return null if ambiguous)
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
const name = nameOrSignatureOrSighash.trim();
const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name));
if (matching.length === 0) {
logger.throwArgumentError("no matching function", "name", name);
}
else if (matching.length > 1) {
logger.throwArgumentError("multiple matching functions", "name", name);
}
return this.functions[matching[0]];
}
// Normlize the signature and lookup the function
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
if (!result) {
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
}
return result;
}
// Find an event definition by any means necessary (unless it is ambiguous)
getEvent(nameOrSignatureOrTopic) {
if (isHexString(nameOrSignatureOrTopic)) {
const topichash = nameOrSignatureOrTopic.toLowerCase();
for (const name in this.events) {
if (topichash === this.getEventTopic(name)) {
return this.events[name];
}
}
logger.throwArgumentError("no matching event", "topichash", topichash);
}
// It is a bare name, look up the function (will return null if ambiguous)
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
const name = nameOrSignatureOrTopic.trim();
const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name));
if (matching.length === 0) {
logger.throwArgumentError("no matching event", "name", name);
}
else if (matching.length > 1) {
logger.throwArgumentError("multiple matching events", "name", name);
}
return this.events[matching[0]];
}
// Normlize the signature and lookup the function
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
if (!result) {
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
}
return result;
}
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
getSighash(functionFragment) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
return getStatic(this.constructor, "getSighash")(functionFragment);
}
// Get the topic (the bytes32 hash) used by Solidity to identify an event
getEventTopic(eventFragment) {
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
return getStatic(this.constructor, "getEventTopic")(eventFragment);
}
_decodeParams(params, data) {
return this._abiCoder.decode(params, data);
}
_encodeParams(params, values) {
return this._abiCoder.encode(params, values);
}
encodeDeploy(values) {
return this._encodeParams(this.deploy.inputs, values || []);
}
// Decode the data for a function call (e.g. tx.data)
decodeFunctionData(functionFragment, data) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
const bytes = arrayify(data);
if (hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
logger.throwArgumentError(`data signature does not match function ${functionFragment.name}.`, "data", hexlify(bytes));
}
return this._decodeParams(functionFragment.inputs, bytes.slice(4));
}
// Encode the data for a function call (e.g. tx.data)
encodeFunctionData(functionFragment, values) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
return hexlify(concat([
this.getSighash(functionFragment),
this._encodeParams(functionFragment.inputs, values || [])
]));
}
// Decode the result from a function call (e.g. from eth_call)
decodeFunctionResult(functionFragment, data) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
let bytes = arrayify(data);
let reason = null;
let errorSignature = null;
switch (bytes.length % this._abiCoder._getWordSize()) {
case 0:
try {
return this._abiCoder.decode(functionFragment.outputs, bytes);
}
catch (error) { }
break;
case 4:
if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
errorSignature = "Error(string)";
reason = this._abiCoder.decode(["string"], bytes.slice(4))[0];
}
break;
}
return logger.throwError("call revert exception", Logger.errors.CALL_EXCEPTION, {
method: functionFragment.format(),
errorSignature: errorSignature,
errorArgs: [reason],
reason: reason
});
}
// Encode the result for a function call (e.g. for eth_call)
encodeFunctionResult(functionFragment, values) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
return hexlify(this._abiCoder.encode(functionFragment.outputs, values || []));
}
// Create the filter for the event with search criteria (e.g. for eth_filterLog)
encodeFilterTopics(eventFragment, values) {
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
if (values.length > eventFragment.inputs.length) {
logger.throwError("too many arguments for " + eventFragment.format(), Logger.errors.UNEXPECTED_ARGUMENT, {
argument: "values",
value: values
});
}
let topics = [];
if (!eventFragment.anonymous) {
topics.push(this.getEventTopic(eventFragment));
}
const encodeTopic = (param, value) => {
if (param.type === "string") {
return id(value);
}
else if (param.type === "bytes") {
return keccak256(hexlify(value));
}
// Check addresses are valid
if (param.type === "address") {
this._abiCoder.encode(["address"], [value]);
}
return hexZeroPad(hexlify(value), 32);
};
values.forEach((value, index) => {
let param = eventFragment.inputs[index];
if (!param.indexed) {
if (value != null) {
logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
}
return;
}
if (value == null) {
topics.push(null);
}
else if (param.baseType === "array" || param.baseType === "tuple") {
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
}
else if (Array.isArray(value)) {
topics.push(value.map((value) => encodeTopic(param, value)));
}
else {
topics.push(encodeTopic(param, value));
}
});
// Trim off trailing nulls
while (topics.length && topics[topics.length - 1] === null) {
topics.pop();
}
return topics;
}
encodeEventLog(eventFragment, values) {
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
const topics = [];
const dataTypes = [];
const dataValues = [];
if (!eventFragment.anonymous) {
topics.push(this.getEventTopic(eventFragment));
}
if (values.length !== eventFragment.inputs.length) {
logger.throwArgumentError("event arguments/values mismatch", "values", values);
}
eventFragment.inputs.forEach((param, index) => {
const value = values[index];
if (param.indexed) {
if (param.type === "string") {
topics.push(id(value));
}
else if (param.type === "bytes") {
topics.push(keccak256(value));
}
else if (param.baseType === "tuple" || param.baseType === "array") {
// @TOOD
throw new Error("not implemented");
}
else {
topics.push(this._abiCoder.encode([param.type], [value]));
}
}
else {
dataTypes.push(param);
dataValues.push(value);
}
});
return {
data: this._abiCoder.encode(dataTypes, dataValues),
topics: topics
};
}
// Decode a filter for the event and the search criteria
decodeEventLog(eventFragment, data, topics) {
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
if (topics != null && !eventFragment.anonymous) {
let topicHash = this.getEventTopic(eventFragment);
if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
logger.throwError("fragment/topic mismatch", Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
}
topics = topics.slice(1);
}
let indexed = [];
let nonIndexed = [];
let dynamic = [];
eventFragment.inputs.forEach((param, index) => {
if (param.indexed) {
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
indexed.push(ParamType.fromObject({ type: "bytes32", name: param.name }));
dynamic.push(true);
}
else {
indexed.push(param);
dynamic.push(false);
}
}
else {
nonIndexed.push(param);
dynamic.push(false);
}
});
let resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, concat(topics)) : null;
let resultNonIndexed = this._abiCoder.decode(nonIndexed, data);
let result = [];
let nonIndexedIndex = 0, indexedIndex = 0;
eventFragment.inputs.forEach((param, index) => {
if (param.indexed) {
if (resultIndexed == null) {
result[index] = new Indexed({ _isIndexed: true, hash: null });
}
else if (dynamic[index]) {
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
}
else {
try {
result[index] = resultIndexed[indexedIndex++];
}
catch (error) {
result[index] = error;
}
}
}
else {
try {
result[index] = resultNonIndexed[nonIndexedIndex++];
}
catch (error) {
result[index] = error;
}
}
// Add the keyword argument if named and safe
if (param.name && result[param.name] == null) {
const value = result[index];
// Make error named values throw on access
if (value instanceof Error) {
Object.defineProperty(result, param.name, {
get: () => { throw wrapAccessError(`property ${JSON.stringify(param.name)}`, value); }
});
}
else {
result[param.name] = value;
}
}
});
// Make all error indexed values throw on access
for (let i = 0; i < result.length; i++) {
const value = result[i];
if (value instanceof Error) {
Object.defineProperty(result, i, {
get: () => { throw wrapAccessError(`index ${i}`, value); }
});
}
}
return Object.freeze(result);
}
// Given a transaction, find the matching function fragment (if any) and
// determine all its properties and call parameters
parseTransaction(tx) {
let fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase());
if (!fragment) {
return null;
}
return new TransactionDescription({
args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)),
functionFragment: fragment,
name: fragment.name,
signature: fragment.format(),
sighash: this.getSighash(fragment),
value: BigNumber.from(tx.value || "0"),
});
}
// Given an event log, find the matching event fragment (if any) and
// determine all its properties and values
parseLog(log) {
let fragment = this.getEvent(log.topics[0]);
if (!fragment || fragment.anonymous) {
return null;
}
// @TODO: If anonymous, and the only method, and the input count matches, should we parse?
// Probably not, because just because it is the only event in the ABI does
// not mean we have the full ABI; maybe jsut a fragment?
return new LogDescription({
eventFragment: fragment,
name: fragment.name,
signature: fragment.format(),
topic: this.getEventTopic(fragment),
args: this.decodeEventLog(fragment, log.data, log.topics)
});
}
/*
static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {
if (Interface.isInterface(value)) {
return value;
}
if (typeof(value) === "string") {
return new Interface(JSON.parse(value));
}
return new Interface(value);
}
*/
static isInterface(value) {
return !!(value && value._isInterface);
}
}
-3
View File
@@ -1,3 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abi/5.0.0-beta.153";
-98
View File
@@ -1,98 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
var bytes_1 = require("@ethersproject/bytes");
var properties_1 = require("@ethersproject/properties");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var abstract_coder_1 = require("./coders/abstract-coder");
var address_1 = require("./coders/address");
var array_1 = require("./coders/array");
var boolean_1 = require("./coders/boolean");
var bytes_2 = require("./coders/bytes");
var fixed_bytes_1 = require("./coders/fixed-bytes");
var null_1 = require("./coders/null");
var number_1 = require("./coders/number");
var string_1 = require("./coders/string");
var tuple_1 = require("./coders/tuple");
var fragments_1 = require("./fragments");
var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
var AbiCoder = /** @class */ (function () {
function AbiCoder(coerceFunc) {
var _newTarget = this.constructor;
logger.checkNew(_newTarget, AbiCoder);
properties_1.defineReadOnly(this, "coerceFunc", coerceFunc || null);
}
AbiCoder.prototype._getCoder = function (param) {
var _this = this;
switch (param.baseType) {
case "address":
return new address_1.AddressCoder(param.name);
case "bool":
return new boolean_1.BooleanCoder(param.name);
case "string":
return new string_1.StringCoder(param.name);
case "bytes":
return new bytes_2.BytesCoder(param.name);
case "array":
return new array_1.ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name);
case "tuple":
return new tuple_1.TupleCoder((param.components || []).map(function (component) {
return _this._getCoder(component);
}), param.name);
case "":
return new null_1.NullCoder(param.name);
}
// u?int[0-9]*
var match = param.type.match(paramTypeNumber);
if (match) {
var size = parseInt(match[2] || "256");
if (size === 0 || size > 256 || (size % 8) !== 0) {
logger.throwArgumentError("invalid " + match[1] + " bit length", "param", param);
}
return new number_1.NumberCoder(size / 8, (match[1] === "int"), param.name);
}
// bytes[0-9]+
match = param.type.match(paramTypeBytes);
if (match) {
var size = parseInt(match[1]);
if (size === 0 || size > 32) {
logger.throwArgumentError("invalid bytes length", "param", param);
}
return new fixed_bytes_1.FixedBytesCoder(size, param.name);
}
return logger.throwArgumentError("invalid type", "type", param.type);
};
AbiCoder.prototype._getWordSize = function () { return 32; };
AbiCoder.prototype._getReader = function (data) {
return new abstract_coder_1.Reader(data, this._getWordSize(), this.coerceFunc);
};
AbiCoder.prototype._getWriter = function () {
return new abstract_coder_1.Writer(this._getWordSize());
};
AbiCoder.prototype.encode = function (types, values) {
var _this = this;
if (types.length !== values.length) {
logger.throwError("types/values length mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, {
count: { types: types.length, values: values.length },
value: { types: types, values: values }
});
}
var coders = types.map(function (type) { return _this._getCoder(fragments_1.ParamType.from(type)); });
var coder = (new tuple_1.TupleCoder(coders, "_"));
var writer = this._getWriter();
coder.encode(writer, values);
return writer.data;
};
AbiCoder.prototype.decode = function (types, data) {
var _this = this;
var coders = types.map(function (type) { return _this._getCoder(fragments_1.ParamType.from(type)); });
var coder = new tuple_1.TupleCoder(coders, "_");
return coder.decode(this._getReader(bytes_1.arrayify(data)));
};
return AbiCoder;
}());
exports.AbiCoder = AbiCoder;
exports.defaultAbiCoder = new AbiCoder();
-156
View File
@@ -1,156 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var bignumber_1 = require("@ethersproject/bignumber");
var properties_1 = require("@ethersproject/properties");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("../_version");
var logger = new logger_1.Logger(_version_1.version);
function checkResultErrors(result) {
// Find the first error (if any)
var errors = [];
var checkErrors = function (path, object) {
if (!Array.isArray(object)) {
return;
}
for (var key in object) {
var childPath = path.slice();
childPath.push(key);
try {
checkErrors(childPath, object[key]);
}
catch (error) {
errors.push({ path: childPath, error: error });
}
}
};
checkErrors([], result);
return errors;
}
exports.checkResultErrors = checkResultErrors;
var Coder = /** @class */ (function () {
function Coder(name, type, localName, dynamic) {
// @TODO: defineReadOnly these
this.name = name;
this.type = type;
this.localName = localName;
this.dynamic = dynamic;
}
Coder.prototype._throwError = function (message, value) {
logger.throwArgumentError(message, this.localName, value);
};
return Coder;
}());
exports.Coder = Coder;
var Writer = /** @class */ (function () {
function Writer(wordSize) {
properties_1.defineReadOnly(this, "wordSize", wordSize || 32);
this._data = bytes_1.arrayify([]);
this._padding = new Uint8Array(wordSize);
}
Object.defineProperty(Writer.prototype, "data", {
get: function () { return bytes_1.hexlify(this._data); },
enumerable: true,
configurable: true
});
Object.defineProperty(Writer.prototype, "length", {
get: function () { return this._data.length; },
enumerable: true,
configurable: true
});
Writer.prototype._writeData = function (data) {
this._data = bytes_1.concat([this._data, data]);
return data.length;
};
// Arrayish items; padded on the right to wordSize
Writer.prototype.writeBytes = function (value) {
var bytes = bytes_1.arrayify(value);
if (bytes.length % this.wordSize) {
bytes = bytes_1.concat([bytes, this._padding.slice(bytes.length % this.wordSize)]);
}
return this._writeData(bytes);
};
Writer.prototype._getValue = function (value) {
var bytes = bytes_1.arrayify(bignumber_1.BigNumber.from(value));
if (bytes.length > this.wordSize) {
logger.throwError("value out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, {
length: this.wordSize,
offset: bytes.length
});
}
if (bytes.length % this.wordSize) {
bytes = bytes_1.concat([this._padding.slice(bytes.length % this.wordSize), bytes]);
}
return bytes;
};
// BigNumberish items; padded on the left to wordSize
Writer.prototype.writeValue = function (value) {
return this._writeData(this._getValue(value));
};
Writer.prototype.writeUpdatableValue = function () {
var _this = this;
var offset = this.length;
this.writeValue(0);
return function (value) {
_this._data.set(_this._getValue(value), offset);
};
};
return Writer;
}());
exports.Writer = Writer;
var Reader = /** @class */ (function () {
function Reader(data, wordSize, coerceFunc) {
properties_1.defineReadOnly(this, "_data", bytes_1.arrayify(data));
properties_1.defineReadOnly(this, "wordSize", wordSize || 32);
properties_1.defineReadOnly(this, "_coerceFunc", coerceFunc);
this._offset = 0;
}
Object.defineProperty(Reader.prototype, "data", {
get: function () { return bytes_1.hexlify(this._data); },
enumerable: true,
configurable: true
});
Object.defineProperty(Reader.prototype, "consumed", {
get: function () { return this._offset; },
enumerable: true,
configurable: true
});
// The default Coerce function
Reader.coerce = function (name, value) {
var match = name.match("^u?int([0-9]+)$");
if (match && parseInt(match[1]) <= 48) {
value = value.toNumber();
}
return value;
};
Reader.prototype.coerce = function (name, value) {
if (this._coerceFunc) {
return this._coerceFunc(name, value);
}
return Reader.coerce(name, value);
};
Reader.prototype._peekBytes = function (offset, length) {
var alignedLength = Math.ceil(length / this.wordSize) * this.wordSize;
if (this._offset + alignedLength > this._data.length) {
logger.throwError("data out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, {
length: this._data.length,
offset: this._offset + alignedLength
});
}
return this._data.slice(this._offset, this._offset + alignedLength);
};
Reader.prototype.subReader = function (offset) {
return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc);
};
Reader.prototype.readBytes = function (length) {
var bytes = this._peekBytes(0, length);
this._offset += bytes.length;
// @TODO: Make sure the length..end bytes are all 0?
return bytes.slice(0, length);
};
Reader.prototype.readValue = function () {
return bignumber_1.BigNumber.from(this.readBytes(this.wordSize));
};
return Reader;
}());
exports.Reader = Reader;
-38
View File
@@ -1,38 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var address_1 = require("@ethersproject/address");
var bytes_1 = require("@ethersproject/bytes");
var abstract_coder_1 = require("./abstract-coder");
var AddressCoder = /** @class */ (function (_super) {
__extends(AddressCoder, _super);
function AddressCoder(localName) {
return _super.call(this, "address", "address", localName, false) || this;
}
AddressCoder.prototype.encode = function (writer, value) {
try {
address_1.getAddress(value);
}
catch (error) {
this._throwError(error.message, value);
}
return writer.writeValue(value);
};
AddressCoder.prototype.decode = function (reader) {
return address_1.getAddress(bytes_1.hexZeroPad(reader.readValue().toHexString(), 20));
};
return AddressCoder;
}(abstract_coder_1.Coder));
exports.AddressCoder = AddressCoder;
-33
View File
@@ -1,33 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var abstract_coder_1 = require("./abstract-coder");
// Clones the functionality of an existing Coder, but without a localName
var AnonymousCoder = /** @class */ (function (_super) {
__extends(AnonymousCoder, _super);
function AnonymousCoder(coder) {
var _this = _super.call(this, coder.name, coder.type, undefined, coder.dynamic) || this;
_this.coder = coder;
return _this;
}
AnonymousCoder.prototype.encode = function (writer, value) {
return this.coder.encode(writer, value);
};
AnonymousCoder.prototype.decode = function (reader) {
return this.coder.decode(reader);
};
return AnonymousCoder;
}(abstract_coder_1.Coder));
exports.AnonymousCoder = AnonymousCoder;
-189
View File
@@ -1,189 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("../_version");
var logger = new logger_1.Logger(_version_1.version);
var abstract_coder_1 = require("./abstract-coder");
var anonymous_1 = require("./anonymous");
function pack(writer, coders, values) {
if (Array.isArray(values)) {
// do nothing
}
else if (values && typeof (values) === "object") {
var arrayValues_1 = [];
coders.forEach(function (coder) {
arrayValues_1.push(values[coder.localName]);
});
values = arrayValues_1;
}
else {
logger.throwArgumentError("invalid tuple value", "tuple", values);
}
if (coders.length !== values.length) {
logger.throwArgumentError("types/value length mismatch", "tuple", values);
}
var staticWriter = new abstract_coder_1.Writer(writer.wordSize);
var dynamicWriter = new abstract_coder_1.Writer(writer.wordSize);
var updateFuncs = [];
coders.forEach(function (coder, index) {
var value = values[index];
if (coder.dynamic) {
// Get current dynamic offset (for the future pointer)
var dynamicOffset_1 = dynamicWriter.length;
// Encode the dynamic value into the dynamicWriter
coder.encode(dynamicWriter, value);
// Prepare to populate the correct offset once we are done
var updateFunc_1 = staticWriter.writeUpdatableValue();
updateFuncs.push(function (baseOffset) {
updateFunc_1(baseOffset + dynamicOffset_1);
});
}
else {
coder.encode(staticWriter, value);
}
});
// Backfill all the dynamic offsets, now that we know the static length
updateFuncs.forEach(function (func) { func(staticWriter.length); });
var length = writer.writeBytes(staticWriter.data);
length += writer.writeBytes(dynamicWriter.data);
return length;
}
exports.pack = pack;
function unpack(reader, coders) {
var values = [];
// A reader anchored to this base
var baseReader = reader.subReader(0);
// The amount of dynamic data read; to consume later to synchronize
var dynamicLength = 0;
coders.forEach(function (coder) {
var value = null;
if (coder.dynamic) {
var offset = reader.readValue();
var offsetReader = baseReader.subReader(offset.toNumber());
try {
value = coder.decode(offsetReader);
}
catch (error) {
// Cannot recover from this
if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) {
throw error;
}
value = error;
value.baseType = coder.name;
value.name = coder.localName;
value.type = coder.type;
}
dynamicLength += offsetReader.consumed;
}
else {
try {
value = coder.decode(reader);
}
catch (error) {
// Cannot recover from this
if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) {
throw error;
}
value = error;
value.baseType = coder.name;
value.name = coder.localName;
value.type = coder.type;
}
}
if (value != undefined) {
values.push(value);
}
});
// @TODO: get rid of this an see if it still works?
// Consume the dynamic components in the main reader
reader.readBytes(dynamicLength);
// Add any named parameters (i.e. tuples)
coders.forEach(function (coder, index) {
var name = coder.localName;
if (!name) {
return;
}
if (name === "length") {
name = "_length";
}
if (values[name] != null) {
return;
}
var value = values[index];
if (value instanceof Error) {
Object.defineProperty(values, name, {
get: function () { throw value; }
});
}
else {
values[name] = value;
}
});
var _loop_1 = function (i) {
var value = values[i];
if (value instanceof Error) {
Object.defineProperty(values, i, {
get: function () { throw value; }
});
}
};
for (var i = 0; i < values.length; i++) {
_loop_1(i);
}
return Object.freeze(values);
}
exports.unpack = unpack;
var ArrayCoder = /** @class */ (function (_super) {
__extends(ArrayCoder, _super);
function ArrayCoder(coder, length, localName) {
var _this = this;
var type = (coder.type + "[" + (length >= 0 ? length : "") + "]");
var dynamic = (length === -1 || coder.dynamic);
_this = _super.call(this, "array", type, localName, dynamic) || this;
_this.coder = coder;
_this.length = length;
return _this;
}
ArrayCoder.prototype.encode = function (writer, value) {
if (!Array.isArray(value)) {
this._throwError("expected array value", value);
}
var count = this.length;
if (count === -1) {
count = value.length;
writer.writeValue(value.length);
}
logger.checkArgumentCount(count, value.length, "coder array" + (this.localName ? (" " + this.localName) : ""));
var coders = [];
for (var i = 0; i < value.length; i++) {
coders.push(this.coder);
}
return pack(writer, coders, value);
};
ArrayCoder.prototype.decode = function (reader) {
var count = this.length;
if (count === -1) {
count = reader.readValue().toNumber();
}
var coders = [];
for (var i = 0; i < count; i++) {
coders.push(new anonymous_1.AnonymousCoder(this.coder));
}
return reader.coerce(this.name, unpack(reader, coders));
};
return ArrayCoder;
}(abstract_coder_1.Coder));
exports.ArrayCoder = ArrayCoder;
-30
View File
@@ -1,30 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var abstract_coder_1 = require("./abstract-coder");
var BooleanCoder = /** @class */ (function (_super) {
__extends(BooleanCoder, _super);
function BooleanCoder(localName) {
return _super.call(this, "bool", "bool", localName, false) || this;
}
BooleanCoder.prototype.encode = function (writer, value) {
return writer.writeValue(value ? 1 : 0);
};
BooleanCoder.prototype.decode = function (reader) {
return reader.coerce(this.type, !reader.readValue().isZero());
};
return BooleanCoder;
}(abstract_coder_1.Coder));
exports.BooleanCoder = BooleanCoder;
-45
View File
@@ -1,45 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var abstract_coder_1 = require("./abstract-coder");
var DynamicBytesCoder = /** @class */ (function (_super) {
__extends(DynamicBytesCoder, _super);
function DynamicBytesCoder(type, localName) {
return _super.call(this, type, type, localName, true) || this;
}
DynamicBytesCoder.prototype.encode = function (writer, value) {
value = bytes_1.arrayify(value);
var length = writer.writeValue(value.length);
length += writer.writeBytes(value);
return length;
};
DynamicBytesCoder.prototype.decode = function (reader) {
return reader.readBytes(reader.readValue().toNumber());
};
return DynamicBytesCoder;
}(abstract_coder_1.Coder));
exports.DynamicBytesCoder = DynamicBytesCoder;
var BytesCoder = /** @class */ (function (_super) {
__extends(BytesCoder, _super);
function BytesCoder(localName) {
return _super.call(this, "bytes", localName) || this;
}
BytesCoder.prototype.decode = function (reader) {
return reader.coerce(this.name, bytes_1.hexlify(_super.prototype.decode.call(this, reader)));
};
return BytesCoder;
}(DynamicBytesCoder));
exports.BytesCoder = BytesCoder;
-40
View File
@@ -1,40 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var abstract_coder_1 = require("./abstract-coder");
// @TODO: Merge this with bytes
var FixedBytesCoder = /** @class */ (function (_super) {
__extends(FixedBytesCoder, _super);
function FixedBytesCoder(size, localName) {
var _this = this;
var name = "bytes" + String(size);
_this = _super.call(this, name, name, localName, false) || this;
_this.size = size;
return _this;
}
FixedBytesCoder.prototype.encode = function (writer, value) {
var data = bytes_1.arrayify(value);
if (data.length !== this.size) {
this._throwError("incorrect data length", value);
}
return writer.writeBytes(data);
};
FixedBytesCoder.prototype.decode = function (reader) {
return reader.coerce(this.name, bytes_1.hexlify(reader.readBytes(this.size)));
};
return FixedBytesCoder;
}(abstract_coder_1.Coder));
exports.FixedBytesCoder = FixedBytesCoder;
-34
View File
@@ -1,34 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var abstract_coder_1 = require("./abstract-coder");
var NullCoder = /** @class */ (function (_super) {
__extends(NullCoder, _super);
function NullCoder(localName) {
return _super.call(this, "null", "", localName, false) || this;
}
NullCoder.prototype.encode = function (writer, value) {
if (value != null) {
this._throwError("not null", value);
}
return writer.writeBytes([]);
};
NullCoder.prototype.decode = function (reader) {
reader.readBytes(0);
return reader.coerce(this.name, null);
};
return NullCoder;
}(abstract_coder_1.Coder));
exports.NullCoder = NullCoder;
-57
View File
@@ -1,57 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("@ethersproject/bignumber");
var constants_1 = require("@ethersproject/constants");
var abstract_coder_1 = require("./abstract-coder");
var NumberCoder = /** @class */ (function (_super) {
__extends(NumberCoder, _super);
function NumberCoder(size, signed, localName) {
var _this = this;
var name = ((signed ? "int" : "uint") + (size * 8));
_this = _super.call(this, name, name, localName, false) || this;
_this.size = size;
_this.signed = signed;
return _this;
}
NumberCoder.prototype.encode = function (writer, value) {
var v = bignumber_1.BigNumber.from(value);
// Check bounds are safe for encoding
var maxUintValue = constants_1.MaxUint256.mask(writer.wordSize * 8);
if (this.signed) {
var bounds = maxUintValue.mask(this.size * 8 - 1);
if (v.gt(bounds) || v.lt(bounds.add(constants_1.One).mul(constants_1.NegativeOne))) {
this._throwError("value out-of-bounds", value);
}
}
else if (v.lt(constants_1.Zero) || v.gt(maxUintValue.mask(this.size * 8))) {
this._throwError("value out-of-bounds", value);
}
v = v.toTwos(this.size * 8).mask(this.size * 8);
if (this.signed) {
v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize);
}
return writer.writeValue(v);
};
NumberCoder.prototype.decode = function (reader) {
var value = reader.readValue().mask(this.size * 8);
if (this.signed) {
value = value.fromTwos(this.size * 8);
}
return reader.coerce(this.name, value);
};
return NumberCoder;
}(abstract_coder_1.Coder));
exports.NumberCoder = NumberCoder;
-31
View File
@@ -1,31 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var strings_1 = require("@ethersproject/strings");
var bytes_1 = require("./bytes");
var StringCoder = /** @class */ (function (_super) {
__extends(StringCoder, _super);
function StringCoder(localName) {
return _super.call(this, "string", localName) || this;
}
StringCoder.prototype.encode = function (writer, value) {
return _super.prototype.encode.call(this, writer, strings_1.toUtf8Bytes(value));
};
StringCoder.prototype.decode = function (reader) {
return strings_1.toUtf8String(_super.prototype.decode.call(this, reader));
};
return StringCoder;
}(bytes_1.DynamicBytesCoder));
exports.StringCoder = StringCoder;
-43
View File
@@ -1,43 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var abstract_coder_1 = require("./abstract-coder");
var array_1 = require("./array");
var TupleCoder = /** @class */ (function (_super) {
__extends(TupleCoder, _super);
function TupleCoder(coders, localName) {
var _this = this;
var dynamic = false;
var types = [];
coders.forEach(function (coder) {
if (coder.dynamic) {
dynamic = true;
}
types.push(coder.type);
});
var type = ("tuple(" + types.join(",") + ")");
_this = _super.call(this, "tuple", type, localName, dynamic) || this;
_this.coders = coders;
return _this;
}
TupleCoder.prototype.encode = function (writer, value) {
return array_1.pack(writer, this.coders, value);
};
TupleCoder.prototype.decode = function (reader) {
return reader.coerce(this.name, array_1.unpack(reader, this.coders));
};
return TupleCoder;
}(abstract_coder_1.Coder));
exports.TupleCoder = TupleCoder;
-816
View File
@@ -1,816 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("@ethersproject/bignumber");
var properties_1 = require("@ethersproject/properties");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
;
var _constructorGuard = {};
var ModifiersBytes = { calldata: true, memory: true, storage: true };
var ModifiersNest = { calldata: true, memory: true };
function checkModifier(type, name) {
if (type === "bytes" || type === "string") {
if (ModifiersBytes[name]) {
return true;
}
}
else if (type === "address") {
if (name === "payable") {
return true;
}
}
else if (type.indexOf("[") >= 0 || type === "tuple") {
if (ModifiersNest[name]) {
return true;
}
}
if (ModifiersBytes[name] || name === "payable") {
logger.throwArgumentError("invalid modifier", "name", name);
}
return false;
}
// @TODO: Make sure that children of an indexed tuple are marked with a null indexed
function parseParamType(param, allowIndexed) {
var originalParam = param;
function throwError(i) {
logger.throwArgumentError("unexpected character at position " + i, "param", param);
}
param = param.replace(/\s/g, " ");
function newNode(parent) {
var node = { type: "", name: "", parent: parent, state: { allowType: true } };
if (allowIndexed) {
node.indexed = false;
}
return node;
}
var parent = { type: "", name: "", state: { allowType: true } };
var node = parent;
for (var i = 0; i < param.length; i++) {
var c = param[i];
switch (c) {
case "(":
if (node.state.allowType && node.type === "") {
node.type = "tuple";
}
else if (!node.state.allowParams) {
throwError(i);
}
node.state.allowType = false;
node.type = verifyType(node.type);
node.components = [newNode(node)];
node = node.components[0];
break;
case ")":
delete node.state;
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(i);
}
node.indexed = true;
node.name = "";
}
if (checkModifier(node.type, node.name)) {
node.name = "";
}
node.type = verifyType(node.type);
var child = node;
node = node.parent;
if (!node) {
throwError(i);
}
delete child.parent;
node.state.allowParams = false;
node.state.allowName = true;
node.state.allowArray = true;
break;
case ",":
delete node.state;
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(i);
}
node.indexed = true;
node.name = "";
}
if (checkModifier(node.type, node.name)) {
node.name = "";
}
node.type = verifyType(node.type);
var sibling = newNode(node.parent);
//{ type: "", name: "", parent: node.parent, state: { allowType: true } };
node.parent.components.push(sibling);
delete node.parent;
node = sibling;
break;
// Hit a space...
case " ":
// If reading type, the type is done and may read a param or name
if (node.state.allowType) {
if (node.type !== "") {
node.type = verifyType(node.type);
delete node.state.allowType;
node.state.allowName = true;
node.state.allowParams = true;
}
}
// If reading name, the name is done
if (node.state.allowName) {
if (node.name !== "") {
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(i);
}
if (node.indexed) {
throwError(i);
}
node.indexed = true;
node.name = "";
}
else if (checkModifier(node.type, node.name)) {
node.name = "";
}
else {
node.state.allowName = false;
}
}
}
break;
case "[":
if (!node.state.allowArray) {
throwError(i);
}
node.type += c;
node.state.allowArray = false;
node.state.allowName = false;
node.state.readArray = true;
break;
case "]":
if (!node.state.readArray) {
throwError(i);
}
node.type += c;
node.state.readArray = false;
node.state.allowArray = true;
node.state.allowName = true;
break;
default:
if (node.state.allowType) {
node.type += c;
node.state.allowParams = true;
node.state.allowArray = true;
}
else if (node.state.allowName) {
node.name += c;
delete node.state.allowArray;
}
else if (node.state.readArray) {
node.type += c;
}
else {
throwError(i);
}
}
}
if (node.parent) {
logger.throwArgumentError("unexpected eof", "param", param);
}
delete parent.state;
if (node.name === "indexed") {
if (!allowIndexed) {
throwError(originalParam.length - 7);
}
if (node.indexed) {
throwError(originalParam.length - 7);
}
node.indexed = true;
node.name = "";
}
else if (checkModifier(node.type, node.name)) {
node.name = "";
}
parent.type = verifyType(parent.type);
return parent;
}
function populate(object, params) {
for (var key in params) {
properties_1.defineReadOnly(object, key, params[key]);
}
}
exports.FormatTypes = Object.freeze({
// Bare formatting, as is needed for computing a sighash of an event or function
sighash: "sighash",
// Human-Readable with Minimal spacing and without names (compact human-readable)
minimal: "minimal",
// Human-Readble with nice spacing, including all names
full: "full",
// JSON-format a la Solidity
json: "json"
});
var paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/);
var ParamType = /** @class */ (function () {
function ParamType(constructorGuard, params) {
if (constructorGuard !== _constructorGuard) {
logger.throwError("use fromString", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new ParamType()"
});
}
populate(this, params);
var match = this.type.match(paramTypeArray);
if (match) {
populate(this, {
arrayLength: parseInt(match[2] || "-1"),
arrayChildren: ParamType.fromObject({
type: match[1],
components: this.components
}),
baseType: "array"
});
}
else {
populate(this, {
arrayLength: null,
arrayChildren: null,
baseType: ((this.components != null) ? "tuple" : this.type)
});
}
this._isParamType = true;
Object.freeze(this);
}
// Format the parameter fragment
// - sighash: "(uint256,address)"
// - minimal: "tuple(uint256,address) indexed"
// - full: "tuple(uint256 foo, addres bar) indexed baz"
ParamType.prototype.format = function (format) {
if (!format) {
format = exports.FormatTypes.sighash;
}
if (!exports.FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === exports.FormatTypes.json) {
var result_1 = {
type: ((this.baseType === "tuple") ? "tuple" : this.type),
name: (this.name || undefined)
};
if (typeof (this.indexed) === "boolean") {
result_1.indexed = this.indexed;
}
if (this.components) {
result_1.components = this.components.map(function (comp) { return JSON.parse(comp.format(format)); });
}
return JSON.stringify(result_1);
}
var result = "";
// Array
if (this.baseType === "array") {
result += this.arrayChildren.format(format);
result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]";
}
else {
if (this.baseType === "tuple") {
if (format !== exports.FormatTypes.sighash) {
result += this.type;
}
result += "(" + this.components.map(function (comp) { return comp.format(format); }).join((format === exports.FormatTypes.full) ? ", " : ",") + ")";
}
else {
result += this.type;
}
}
if (format !== exports.FormatTypes.sighash) {
if (this.indexed === true) {
result += " indexed";
}
if (format === exports.FormatTypes.full && this.name) {
result += " " + this.name;
}
}
return result;
};
ParamType.from = function (value, allowIndexed) {
if (typeof (value) === "string") {
return ParamType.fromString(value, allowIndexed);
}
return ParamType.fromObject(value);
};
ParamType.fromObject = function (value) {
if (ParamType.isParamType(value)) {
return value;
}
return new ParamType(_constructorGuard, {
name: (value.name || null),
type: verifyType(value.type),
indexed: ((value.indexed == null) ? null : !!value.indexed),
components: (value.components ? value.components.map(ParamType.fromObject) : null)
});
};
ParamType.fromString = function (value, allowIndexed) {
function ParamTypify(node) {
return ParamType.fromObject({
name: node.name,
type: node.type,
indexed: node.indexed,
components: node.components
});
}
return ParamTypify(parseParamType(value, !!allowIndexed));
};
ParamType.isParamType = function (value) {
return !!(value != null && value._isParamType);
};
return ParamType;
}());
exports.ParamType = ParamType;
;
function parseParams(value, allowIndex) {
return splitNesting(value).map(function (param) { return ParamType.fromString(param, allowIndex); });
}
var Fragment = /** @class */ (function () {
function Fragment(constructorGuard, params) {
if (constructorGuard !== _constructorGuard) {
logger.throwError("use a static from method", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new Fragment()"
});
}
populate(this, params);
this._isFragment = true;
Object.freeze(this);
}
Fragment.from = function (value) {
if (Fragment.isFragment(value)) {
return value;
}
if (typeof (value) === "string") {
return Fragment.fromString(value);
}
return Fragment.fromObject(value);
};
Fragment.fromObject = function (value) {
if (Fragment.isFragment(value)) {
return value;
}
switch (value.type) {
case "function":
return FunctionFragment.fromObject(value);
case "event":
return EventFragment.fromObject(value);
case "constructor":
return ConstructorFragment.fromObject(value);
case "fallback":
case "receive":
// @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment?
return null;
}
return logger.throwArgumentError("invalid fragment object", "value", value);
};
Fragment.fromString = function (value) {
// Make sure the "returns" is surrounded by a space and all whitespace is exactly one space
value = value.replace(/\s/g, " ");
value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " ");
value = value.trim();
if (value.split(" ")[0] === "event") {
return EventFragment.fromString(value.substring(5).trim());
}
else if (value.split(" ")[0] === "function") {
return FunctionFragment.fromString(value.substring(8).trim());
}
else if (value.split("(")[0].trim() === "constructor") {
return ConstructorFragment.fromString(value.trim());
}
return logger.throwArgumentError("unsupported fragment", "value", value);
};
Fragment.isFragment = function (value) {
return !!(value && value._isFragment);
};
return Fragment;
}());
exports.Fragment = Fragment;
var EventFragment = /** @class */ (function (_super) {
__extends(EventFragment, _super);
function EventFragment() {
return _super !== null && _super.apply(this, arguments) || this;
}
EventFragment.prototype.format = function (format) {
if (!format) {
format = exports.FormatTypes.sighash;
}
if (!exports.FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === exports.FormatTypes.json) {
return JSON.stringify({
type: "event",
anonymous: this.anonymous,
name: this.name,
inputs: this.inputs.map(function (input) { return JSON.parse(input.format(format)); })
});
}
var result = "";
if (format !== exports.FormatTypes.sighash) {
result += "event ";
}
result += this.name + "(" + this.inputs.map(function (input) { return input.format(format); }).join((format === exports.FormatTypes.full) ? ", " : ",") + ") ";
if (format !== exports.FormatTypes.sighash) {
if (this.anonymous) {
result += "anonymous ";
}
}
return result.trim();
};
EventFragment.from = function (value) {
if (typeof (value) === "string") {
return EventFragment.fromString(value);
}
return EventFragment.fromObject(value);
};
EventFragment.fromObject = function (value) {
if (EventFragment.isEventFragment(value)) {
return value;
}
if (value.type !== "event") {
logger.throwArgumentError("invalid event object", "value", value);
}
var params = {
name: verifyIdentifier(value.name),
anonymous: value.anonymous,
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
type: "event"
};
return new EventFragment(_constructorGuard, params);
};
EventFragment.fromString = function (value) {
var match = value.match(regexParen);
if (!match) {
logger.throwArgumentError("invalid event string", "value", value);
}
var anonymous = false;
match[3].split(" ").forEach(function (modifier) {
switch (modifier.trim()) {
case "anonymous":
anonymous = true;
break;
case "":
break;
default:
logger.warn("unknown modifier: " + modifier);
}
});
return EventFragment.fromObject({
name: match[1].trim(),
anonymous: anonymous,
inputs: parseParams(match[2], true),
type: "event"
});
};
EventFragment.isEventFragment = function (value) {
return (value && value._isFragment && value.type === "event");
};
return EventFragment;
}(Fragment));
exports.EventFragment = EventFragment;
function parseGas(value, params) {
params.gas = null;
var comps = value.split("@");
if (comps.length !== 1) {
if (comps.length > 2) {
logger.throwArgumentError("invalid human-readable ABI signature", "value", value);
}
if (!comps[1].match(/^[0-9]+$/)) {
logger.throwArgumentError("invalid human-readable ABI signature gas", "value", value);
}
params.gas = bignumber_1.BigNumber.from(comps[1]);
return comps[0];
}
return value;
}
function parseModifiers(value, params) {
params.constant = false;
params.payable = false;
params.stateMutability = "nonpayable";
value.split(" ").forEach(function (modifier) {
switch (modifier.trim()) {
case "constant":
params.constant = true;
break;
case "payable":
params.payable = true;
params.stateMutability = "payable";
break;
case "pure":
params.constant = true;
params.stateMutability = "pure";
break;
case "view":
params.constant = true;
params.stateMutability = "view";
break;
case "external":
case "public":
case "":
break;
default:
console.log("unknown modifier: " + modifier);
}
});
}
function verifyState(value) {
var result = {
constant: false,
payable: true,
stateMutability: "payable"
};
if (value.stateMutability != null) {
result.stateMutability = value.stateMutability;
// Set (and check things are consistent) the constant property
result.constant = (result.stateMutability === "view" || result.stateMutability === "pure");
if (value.constant != null) {
if ((!!value.constant) !== result.constant) {
logger.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value);
}
}
// Set (and check things are consistent) the payable property
result.payable = (result.stateMutability === "payable");
if (value.payable != null) {
if ((!!value.payable) !== result.payable) {
logger.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value);
}
}
}
else if (value.payable != null) {
result.payable = !!value.payable;
// If payable we can assume non-constant; otherwise we can't assume
if (value.constant == null && !result.payable && value.type !== "constructor") {
logger.throwArgumentError("unable to determine stateMutability", "value", value);
}
result.constant = !!value.constant;
if (result.constant) {
result.stateMutability = "view";
}
else {
result.stateMutability = (result.payable ? "payable" : "nonpayable");
}
if (result.payable && result.constant) {
logger.throwArgumentError("cannot have constant payable function", "value", value);
}
}
else if (value.constant != null) {
result.constant = !!value.constant;
result.payable = !result.constant;
result.stateMutability = (result.constant ? "view" : "payable");
}
else if (value.type !== "constructor") {
logger.throwArgumentError("unable to determine stateMutability", "value", value);
}
return result;
}
var ConstructorFragment = /** @class */ (function (_super) {
__extends(ConstructorFragment, _super);
function ConstructorFragment() {
return _super !== null && _super.apply(this, arguments) || this;
}
ConstructorFragment.prototype.format = function (format) {
if (!format) {
format = exports.FormatTypes.sighash;
}
if (!exports.FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === exports.FormatTypes.json) {
return JSON.stringify({
type: "constructor",
stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined),
payble: this.payable,
gas: (this.gas ? this.gas.toNumber() : undefined),
inputs: this.inputs.map(function (input) { return JSON.parse(input.format(format)); })
});
}
if (format === exports.FormatTypes.sighash) {
logger.throwError("cannot format a constructor for sighash", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "format(sighash)"
});
}
var result = "constructor(" + this.inputs.map(function (input) { return input.format(format); }).join((format === exports.FormatTypes.full) ? ", " : ",") + ") ";
if (this.stateMutability && this.stateMutability !== "nonpayable") {
result += this.stateMutability + " ";
}
return result.trim();
};
ConstructorFragment.from = function (value) {
if (typeof (value) === "string") {
return ConstructorFragment.fromString(value);
}
return ConstructorFragment.fromObject(value);
};
ConstructorFragment.fromObject = function (value) {
if (ConstructorFragment.isConstructorFragment(value)) {
return value;
}
if (value.type !== "constructor") {
logger.throwArgumentError("invalid constructor object", "value", value);
}
var state = verifyState(value);
if (state.constant) {
logger.throwArgumentError("constructor cannot be constant", "value", value);
}
var params = {
name: null,
type: value.type,
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
payable: state.payable,
stateMutability: state.stateMutability,
gas: (value.gas ? bignumber_1.BigNumber.from(value.gas) : null)
};
return new ConstructorFragment(_constructorGuard, params);
};
ConstructorFragment.fromString = function (value) {
var params = { type: "constructor" };
value = parseGas(value, params);
var parens = value.match(regexParen);
if (!parens || parens[1].trim() !== "constructor") {
logger.throwArgumentError("invalid constructor string", "value", value);
}
params.inputs = parseParams(parens[2].trim(), false);
parseModifiers(parens[3].trim(), params);
return ConstructorFragment.fromObject(params);
};
ConstructorFragment.isConstructorFragment = function (value) {
return (value && value._isFragment && value.type === "constructor");
};
return ConstructorFragment;
}(Fragment));
exports.ConstructorFragment = ConstructorFragment;
var FunctionFragment = /** @class */ (function (_super) {
__extends(FunctionFragment, _super);
function FunctionFragment() {
return _super !== null && _super.apply(this, arguments) || this;
}
FunctionFragment.prototype.format = function (format) {
if (!format) {
format = exports.FormatTypes.sighash;
}
if (!exports.FormatTypes[format]) {
logger.throwArgumentError("invalid format type", "format", format);
}
if (format === exports.FormatTypes.json) {
return JSON.stringify({
type: "function",
name: this.name,
constant: this.constant,
stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined),
payble: this.payable,
gas: (this.gas ? this.gas.toNumber() : undefined),
inputs: this.inputs.map(function (input) { return JSON.parse(input.format(format)); }),
ouputs: this.outputs.map(function (output) { return JSON.parse(output.format(format)); }),
});
}
var result = "";
if (format !== exports.FormatTypes.sighash) {
result += "function ";
}
result += this.name + "(" + this.inputs.map(function (input) { return input.format(format); }).join((format === exports.FormatTypes.full) ? ", " : ",") + ") ";
if (format !== exports.FormatTypes.sighash) {
if (this.stateMutability) {
if (this.stateMutability !== "nonpayable") {
result += (this.stateMutability + " ");
}
}
else if (this.constant) {
result += "view ";
}
if (this.outputs && this.outputs.length) {
result += "returns (" + this.outputs.map(function (output) { return output.format(format); }).join(", ") + ") ";
}
if (this.gas != null) {
result += "@" + this.gas.toString() + " ";
}
}
return result.trim();
};
FunctionFragment.from = function (value) {
if (typeof (value) === "string") {
return FunctionFragment.fromString(value);
}
return FunctionFragment.fromObject(value);
};
FunctionFragment.fromObject = function (value) {
if (FunctionFragment.isFunctionFragment(value)) {
return value;
}
if (value.type !== "function") {
logger.throwArgumentError("invalid function object", "value", value);
}
var state = verifyState(value);
var params = {
type: value.type,
name: verifyIdentifier(value.name),
constant: state.constant,
inputs: (value.inputs ? value.inputs.map(ParamType.fromObject) : []),
outputs: (value.outputs ? value.outputs.map(ParamType.fromObject) : []),
payable: state.payable,
stateMutability: state.stateMutability,
gas: (value.gas ? bignumber_1.BigNumber.from(value.gas) : null)
};
return new FunctionFragment(_constructorGuard, params);
};
FunctionFragment.fromString = function (value) {
var params = { type: "function" };
value = parseGas(value, params);
var comps = value.split(" returns ");
if (comps.length > 2) {
logger.throwArgumentError("invalid function string", "value", value);
}
var parens = comps[0].match(regexParen);
if (!parens) {
logger.throwArgumentError("invalid function signature", "value", value);
}
params.name = parens[1].trim();
if (params.name) {
verifyIdentifier(params.name);
}
params.inputs = parseParams(parens[2], false);
parseModifiers(parens[3].trim(), params);
// We have outputs
if (comps.length > 1) {
var returns = comps[1].match(regexParen);
if (returns[1].trim() != "" || returns[3].trim() != "") {
logger.throwArgumentError("unexpected tokens", "value", value);
}
params.outputs = parseParams(returns[2], false);
}
else {
params.outputs = [];
}
return FunctionFragment.fromObject(params);
};
FunctionFragment.isFunctionFragment = function (value) {
return (value && value._isFragment && value.type === "function");
};
return FunctionFragment;
}(ConstructorFragment));
exports.FunctionFragment = FunctionFragment;
//export class ErrorFragment extends Fragment {
//}
//export class StructFragment extends Fragment {
//}
function verifyType(type) {
// These need to be transformed to their full description
if (type.match(/^uint($|[^1-9])/)) {
type = "uint256" + type.substring(4);
}
else if (type.match(/^int($|[^1-9])/)) {
type = "int256" + type.substring(3);
}
// @TODO: more verification
return type;
}
var regexIdentifier = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");
function verifyIdentifier(value) {
if (!value || !value.match(regexIdentifier)) {
logger.throwArgumentError("invalid identifier \"" + value + "\"", "value", value);
}
return value;
}
var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");
function splitNesting(value) {
value = value.trim();
var result = [];
var accum = "";
var depth = 0;
for (var offset = 0; offset < value.length; offset++) {
var c = value[offset];
if (c === "," && depth === 0) {
result.push(accum);
accum = "";
}
else {
accum += c;
if (c === "(") {
depth++;
}
else if (c === ")") {
depth--;
if (depth === -1) {
logger.throwArgumentError("unbalanced parenthesis", "value", value);
}
}
}
}
if (accum) {
result.push(accum);
}
return result;
}
-18
View File
@@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fragments_1 = require("./fragments");
exports.ConstructorFragment = fragments_1.ConstructorFragment;
exports.EventFragment = fragments_1.EventFragment;
exports.FormatTypes = fragments_1.FormatTypes;
exports.Fragment = fragments_1.Fragment;
exports.FunctionFragment = fragments_1.FunctionFragment;
exports.ParamType = fragments_1.ParamType;
var abi_coder_1 = require("./abi-coder");
exports.AbiCoder = abi_coder_1.AbiCoder;
exports.defaultAbiCoder = abi_coder_1.defaultAbiCoder;
var interface_1 = require("./interface");
exports.checkResultErrors = interface_1.checkResultErrors;
exports.Indexed = interface_1.Indexed;
exports.Interface = interface_1.Interface;
exports.LogDescription = interface_1.LogDescription;
exports.TransactionDescription = interface_1.TransactionDescription;
-533
View File
@@ -1,533 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var address_1 = require("@ethersproject/address");
var bignumber_1 = require("@ethersproject/bignumber");
var bytes_1 = require("@ethersproject/bytes");
var hash_1 = require("@ethersproject/hash");
var keccak256_1 = require("@ethersproject/keccak256");
var properties_1 = require("@ethersproject/properties");
var abi_coder_1 = require("./abi-coder");
var abstract_coder_1 = require("./coders/abstract-coder");
exports.checkResultErrors = abstract_coder_1.checkResultErrors;
var fragments_1 = require("./fragments");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var LogDescription = /** @class */ (function (_super) {
__extends(LogDescription, _super);
function LogDescription() {
return _super !== null && _super.apply(this, arguments) || this;
}
return LogDescription;
}(properties_1.Description));
exports.LogDescription = LogDescription;
var TransactionDescription = /** @class */ (function (_super) {
__extends(TransactionDescription, _super);
function TransactionDescription() {
return _super !== null && _super.apply(this, arguments) || this;
}
return TransactionDescription;
}(properties_1.Description));
exports.TransactionDescription = TransactionDescription;
var Indexed = /** @class */ (function (_super) {
__extends(Indexed, _super);
function Indexed() {
return _super !== null && _super.apply(this, arguments) || this;
}
Indexed.isIndexed = function (value) {
return !!(value && value._isIndexed);
};
return Indexed;
}(properties_1.Description));
exports.Indexed = Indexed;
function wrapAccessError(property, error) {
var wrap = new Error("deferred error during ABI decoding triggered accessing " + property);
wrap.error = error;
return wrap;
}
function checkNames(fragment, type, params) {
params.reduce(function (accum, param) {
if (param.name) {
if (accum[param.name]) {
logger.throwArgumentError("duplicate " + type + " parameter " + JSON.stringify(param.name) + " in " + fragment.format("full"), "fragment", fragment);
}
accum[param.name] = true;
}
return accum;
}, {});
}
var Interface = /** @class */ (function () {
function Interface(fragments) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, Interface);
var abi = [];
if (typeof (fragments) === "string") {
abi = JSON.parse(fragments);
}
else {
abi = fragments;
}
properties_1.defineReadOnly(this, "fragments", abi.map(function (fragment) {
return fragments_1.Fragment.from(fragment);
}).filter(function (fragment) { return (fragment != null); }));
properties_1.defineReadOnly(this, "_abiCoder", properties_1.getStatic((_newTarget), "getAbiCoder")());
properties_1.defineReadOnly(this, "functions", {});
properties_1.defineReadOnly(this, "errors", {});
properties_1.defineReadOnly(this, "events", {});
properties_1.defineReadOnly(this, "structs", {});
// Add all fragments by their signature
this.fragments.forEach(function (fragment) {
var bucket = null;
switch (fragment.type) {
case "constructor":
if (_this.deploy) {
logger.warn("duplicate definition - constructor");
return;
}
checkNames(fragment, "input", fragment.inputs);
properties_1.defineReadOnly(_this, "deploy", fragment);
return;
case "function":
checkNames(fragment, "input", fragment.inputs);
checkNames(fragment, "output", fragment.outputs);
bucket = _this.functions;
break;
case "event":
checkNames(fragment, "input", fragment.inputs);
bucket = _this.events;
break;
default:
return;
}
var signature = fragment.format();
if (bucket[signature]) {
logger.warn("duplicate definition - " + signature);
return;
}
bucket[signature] = fragment;
});
// If we do not have a constructor add a default
if (!this.deploy) {
properties_1.defineReadOnly(this, "deploy", fragments_1.ConstructorFragment.from({
payable: false,
type: "constructor"
}));
}
properties_1.defineReadOnly(this, "_isInterface", true);
}
Interface.prototype.format = function (format) {
if (!format) {
format = fragments_1.FormatTypes.full;
}
if (format === fragments_1.FormatTypes.sighash) {
logger.throwArgumentError("interface does not support formatting sighash", "format", format);
}
var abi = this.fragments.map(function (fragment) { return fragment.format(format); });
// We need to re-bundle the JSON fragments a bit
if (format === fragments_1.FormatTypes.json) {
return JSON.stringify(abi.map(function (j) { return JSON.parse(j); }));
}
return abi;
};
// Sub-classes can override these to handle other blockchains
Interface.getAbiCoder = function () {
return abi_coder_1.defaultAbiCoder;
};
Interface.getAddress = function (address) {
return address_1.getAddress(address);
};
Interface.getSighash = function (functionFragment) {
return bytes_1.hexDataSlice(hash_1.id(functionFragment.format()), 0, 4);
};
Interface.getEventTopic = function (eventFragment) {
return hash_1.id(eventFragment.format());
};
// Find a function definition by any means necessary (unless it is ambiguous)
Interface.prototype.getFunction = function (nameOrSignatureOrSighash) {
if (bytes_1.isHexString(nameOrSignatureOrSighash)) {
for (var name_1 in this.functions) {
if (nameOrSignatureOrSighash === this.getSighash(name_1)) {
return this.functions[name_1];
}
}
logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
}
// It is a bare name, look up the function (will return null if ambiguous)
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
var name_2 = nameOrSignatureOrSighash.trim();
var matching = Object.keys(this.functions).filter(function (f) { return (f.split("(" /* fix:) */)[0] === name_2); });
if (matching.length === 0) {
logger.throwArgumentError("no matching function", "name", name_2);
}
else if (matching.length > 1) {
logger.throwArgumentError("multiple matching functions", "name", name_2);
}
return this.functions[matching[0]];
}
// Normlize the signature and lookup the function
var result = this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
if (!result) {
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
}
return result;
};
// Find an event definition by any means necessary (unless it is ambiguous)
Interface.prototype.getEvent = function (nameOrSignatureOrTopic) {
if (bytes_1.isHexString(nameOrSignatureOrTopic)) {
var topichash = nameOrSignatureOrTopic.toLowerCase();
for (var name_3 in this.events) {
if (topichash === this.getEventTopic(name_3)) {
return this.events[name_3];
}
}
logger.throwArgumentError("no matching event", "topichash", topichash);
}
// It is a bare name, look up the function (will return null if ambiguous)
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
var name_4 = nameOrSignatureOrTopic.trim();
var matching = Object.keys(this.events).filter(function (f) { return (f.split("(" /* fix:) */)[0] === name_4); });
if (matching.length === 0) {
logger.throwArgumentError("no matching event", "name", name_4);
}
else if (matching.length > 1) {
logger.throwArgumentError("multiple matching events", "name", name_4);
}
return this.events[matching[0]];
}
// Normlize the signature and lookup the function
var result = this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()];
if (!result) {
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
}
return result;
};
// Get the sighash (the bytes4 selector) used by Solidity to identify a function
Interface.prototype.getSighash = function (functionFragment) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
return properties_1.getStatic(this.constructor, "getSighash")(functionFragment);
};
// Get the topic (the bytes32 hash) used by Solidity to identify an event
Interface.prototype.getEventTopic = function (eventFragment) {
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
return properties_1.getStatic(this.constructor, "getEventTopic")(eventFragment);
};
Interface.prototype._decodeParams = function (params, data) {
return this._abiCoder.decode(params, data);
};
Interface.prototype._encodeParams = function (params, values) {
return this._abiCoder.encode(params, values);
};
Interface.prototype.encodeDeploy = function (values) {
return this._encodeParams(this.deploy.inputs, values || []);
};
// Decode the data for a function call (e.g. tx.data)
Interface.prototype.decodeFunctionData = function (functionFragment, data) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
var bytes = bytes_1.arrayify(data);
if (bytes_1.hexlify(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) {
logger.throwArgumentError("data signature does not match function " + functionFragment.name + ".", "data", bytes_1.hexlify(bytes));
}
return this._decodeParams(functionFragment.inputs, bytes.slice(4));
};
// Encode the data for a function call (e.g. tx.data)
Interface.prototype.encodeFunctionData = function (functionFragment, values) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
return bytes_1.hexlify(bytes_1.concat([
this.getSighash(functionFragment),
this._encodeParams(functionFragment.inputs, values || [])
]));
};
// Decode the result from a function call (e.g. from eth_call)
Interface.prototype.decodeFunctionResult = function (functionFragment, data) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
var bytes = bytes_1.arrayify(data);
var reason = null;
var errorSignature = null;
switch (bytes.length % this._abiCoder._getWordSize()) {
case 0:
try {
return this._abiCoder.decode(functionFragment.outputs, bytes);
}
catch (error) { }
break;
case 4:
if (bytes_1.hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
errorSignature = "Error(string)";
reason = this._abiCoder.decode(["string"], bytes.slice(4))[0];
}
break;
}
return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, {
method: functionFragment.format(),
errorSignature: errorSignature,
errorArgs: [reason],
reason: reason
});
};
// Encode the result for a function call (e.g. for eth_call)
Interface.prototype.encodeFunctionResult = function (functionFragment, values) {
if (typeof (functionFragment) === "string") {
functionFragment = this.getFunction(functionFragment);
}
return bytes_1.hexlify(this._abiCoder.encode(functionFragment.outputs, values || []));
};
// Create the filter for the event with search criteria (e.g. for eth_filterLog)
Interface.prototype.encodeFilterTopics = function (eventFragment, values) {
var _this = this;
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
if (values.length > eventFragment.inputs.length) {
logger.throwError("too many arguments for " + eventFragment.format(), logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {
argument: "values",
value: values
});
}
var topics = [];
if (!eventFragment.anonymous) {
topics.push(this.getEventTopic(eventFragment));
}
var encodeTopic = function (param, value) {
if (param.type === "string") {
return hash_1.id(value);
}
else if (param.type === "bytes") {
return keccak256_1.keccak256(bytes_1.hexlify(value));
}
// Check addresses are valid
if (param.type === "address") {
_this._abiCoder.encode(["address"], [value]);
}
return bytes_1.hexZeroPad(bytes_1.hexlify(value), 32);
};
values.forEach(function (value, index) {
var param = eventFragment.inputs[index];
if (!param.indexed) {
if (value != null) {
logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
}
return;
}
if (value == null) {
topics.push(null);
}
else if (param.baseType === "array" || param.baseType === "tuple") {
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
}
else if (Array.isArray(value)) {
topics.push(value.map(function (value) { return encodeTopic(param, value); }));
}
else {
topics.push(encodeTopic(param, value));
}
});
// Trim off trailing nulls
while (topics.length && topics[topics.length - 1] === null) {
topics.pop();
}
return topics;
};
Interface.prototype.encodeEventLog = function (eventFragment, values) {
var _this = this;
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
var topics = [];
var dataTypes = [];
var dataValues = [];
if (!eventFragment.anonymous) {
topics.push(this.getEventTopic(eventFragment));
}
if (values.length !== eventFragment.inputs.length) {
logger.throwArgumentError("event arguments/values mismatch", "values", values);
}
eventFragment.inputs.forEach(function (param, index) {
var value = values[index];
if (param.indexed) {
if (param.type === "string") {
topics.push(hash_1.id(value));
}
else if (param.type === "bytes") {
topics.push(keccak256_1.keccak256(value));
}
else if (param.baseType === "tuple" || param.baseType === "array") {
// @TOOD
throw new Error("not implemented");
}
else {
topics.push(_this._abiCoder.encode([param.type], [value]));
}
}
else {
dataTypes.push(param);
dataValues.push(value);
}
});
return {
data: this._abiCoder.encode(dataTypes, dataValues),
topics: topics
};
};
// Decode a filter for the event and the search criteria
Interface.prototype.decodeEventLog = function (eventFragment, data, topics) {
if (typeof (eventFragment) === "string") {
eventFragment = this.getEvent(eventFragment);
}
if (topics != null && !eventFragment.anonymous) {
var topicHash = this.getEventTopic(eventFragment);
if (!bytes_1.isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
logger.throwError("fragment/topic mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
}
topics = topics.slice(1);
}
var indexed = [];
var nonIndexed = [];
var dynamic = [];
eventFragment.inputs.forEach(function (param, index) {
if (param.indexed) {
if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") {
indexed.push(fragments_1.ParamType.fromObject({ type: "bytes32", name: param.name }));
dynamic.push(true);
}
else {
indexed.push(param);
dynamic.push(false);
}
}
else {
nonIndexed.push(param);
dynamic.push(false);
}
});
var resultIndexed = (topics != null) ? this._abiCoder.decode(indexed, bytes_1.concat(topics)) : null;
var resultNonIndexed = this._abiCoder.decode(nonIndexed, data);
var result = [];
var nonIndexedIndex = 0, indexedIndex = 0;
eventFragment.inputs.forEach(function (param, index) {
if (param.indexed) {
if (resultIndexed == null) {
result[index] = new Indexed({ _isIndexed: true, hash: null });
}
else if (dynamic[index]) {
result[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] });
}
else {
try {
result[index] = resultIndexed[indexedIndex++];
}
catch (error) {
result[index] = error;
}
}
}
else {
try {
result[index] = resultNonIndexed[nonIndexedIndex++];
}
catch (error) {
result[index] = error;
}
}
// Add the keyword argument if named and safe
if (param.name && result[param.name] == null) {
var value_1 = result[index];
// Make error named values throw on access
if (value_1 instanceof Error) {
Object.defineProperty(result, param.name, {
get: function () { throw wrapAccessError("property " + JSON.stringify(param.name), value_1); }
});
}
else {
result[param.name] = value_1;
}
}
});
var _loop_1 = function (i) {
var value = result[i];
if (value instanceof Error) {
Object.defineProperty(result, i, {
get: function () { throw wrapAccessError("index " + i, value); }
});
}
};
// Make all error indexed values throw on access
for (var i = 0; i < result.length; i++) {
_loop_1(i);
}
return Object.freeze(result);
};
// Given a transaction, find the matching function fragment (if any) and
// determine all its properties and call parameters
Interface.prototype.parseTransaction = function (tx) {
var fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase());
if (!fragment) {
return null;
}
return new TransactionDescription({
args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)),
functionFragment: fragment,
name: fragment.name,
signature: fragment.format(),
sighash: this.getSighash(fragment),
value: bignumber_1.BigNumber.from(tx.value || "0"),
});
};
// Given an event log, find the matching event fragment (if any) and
// determine all its properties and values
Interface.prototype.parseLog = function (log) {
var fragment = this.getEvent(log.topics[0]);
if (!fragment || fragment.anonymous) {
return null;
}
// @TODO: If anonymous, and the only method, and the input count matches, should we parse?
// Probably not, because just because it is the only event in the ABI does
// not mean we have the full ABI; maybe jsut a fragment?
return new LogDescription({
eventFragment: fragment,
name: fragment.name,
signature: fragment.format(),
topic: this.getEventTopic(fragment),
args: this.decodeEventLog(fragment, log.data, log.topics)
});
};
/*
static from(value: Array<Fragment | string | JsonAbi> | string | Interface) {
if (Interface.isInterface(value)) {
return value;
}
if (typeof(value) === "string") {
return new Interface(JSON.parse(value));
}
return new Interface(value);
}
*/
Interface.isInterface = function (value) {
return !!(value && value._isInterface);
};
return Interface;
}());
exports.Interface = Interface;
-41
View File
@@ -1,41 +0,0 @@
{
"author": "Richard Moore <me@ricmoo.com>",
"dependencies": {
"@ethersproject/address": ">=5.0.0-beta.128",
"@ethersproject/bignumber": ">=5.0.0-beta.130",
"@ethersproject/bytes": ">=5.0.0-beta.129",
"@ethersproject/constants": ">=5.0.0-beta.128",
"@ethersproject/hash": ">=5.0.0-beta.128",
"@ethersproject/keccak256": ">=5.0.0-beta.127",
"@ethersproject/logger": ">=5.0.0-beta.129",
"@ethersproject/properties": ">=5.0.0-beta.131",
"@ethersproject/strings": ">=5.0.0-beta.130"
},
"description": "Utilities and Classes for parsing, formatting and managing Ethereum ABIs.",
"ethereum": "donations.ethers.eth",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/abi",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x7f866470aabd8bbe47af1ff527fedbd86445cbfcd3bbf340d34c96b38b8e8606",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.153"
,"_resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.0.0-beta.153.tgz"
,"_integrity": "sha512-aXweZ1Z7vMNzJdLpR1CZUAIgnwjrZeUSvN9syCwlBaEBUFJmFY+HHnfuTI5vIhVs/mRkfJVrbEyl51JZQqyjAg=="
,"_from": "@ethersproject/abi@5.0.0-beta.153"
}
@@ -1,2 +0,0 @@
export const version = "abstract-provider/5.0.5";
//# sourceMappingURL=_version.js.map
-79
View File
@@ -1,79 +0,0 @@
"use strict";
import { isHexString } from "@ethersproject/bytes";
import { Description, defineReadOnly } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
;
;
//export type CallTransactionable = {
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
//};
export class ForkEvent extends Description {
static isForkEvent(value) {
return !!(value && value._isForkEvent);
}
}
export class BlockForkEvent extends ForkEvent {
constructor(blockHash, expiry) {
if (!isHexString(blockHash, 32)) {
logger.throwArgumentError("invalid blockHash", "blockHash", blockHash);
}
super({
_isForkEvent: true,
_isBlockForkEvent: true,
expiry: (expiry || 0),
blockHash: blockHash
});
}
}
export class TransactionForkEvent extends ForkEvent {
constructor(hash, expiry) {
if (!isHexString(hash, 32)) {
logger.throwArgumentError("invalid transaction hash", "hash", hash);
}
super({
_isForkEvent: true,
_isTransactionForkEvent: true,
expiry: (expiry || 0),
hash: hash
});
}
}
export class TransactionOrderForkEvent extends ForkEvent {
constructor(beforeHash, afterHash, expiry) {
if (!isHexString(beforeHash, 32)) {
logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash);
}
if (!isHexString(afterHash, 32)) {
logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
}
super({
_isForkEvent: true,
_isTransactionOrderForkEvent: true,
expiry: (expiry || 0),
beforeHash: beforeHash,
afterHash: afterHash
});
}
}
///////////////////////////////
// Exported Abstracts
export class Provider {
constructor() {
logger.checkAbstract(new.target, Provider);
defineReadOnly(this, "_isProvider", true);
}
// Alias for "on"
addListener(eventName, listener) {
return this.on(eventName, listener);
}
// Alias for "off"
removeListener(eventName, listener) {
return this.off(eventName, listener);
}
static isProvider(value) {
return !!(value && value._isProvider);
}
}
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abstract-provider/5.0.5";
//# sourceMappingURL=_version.js.map
-117
View File
@@ -1,117 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var properties_1 = require("@ethersproject/properties");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
;
;
//export type CallTransactionable = {
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
//};
var ForkEvent = /** @class */ (function (_super) {
__extends(ForkEvent, _super);
function ForkEvent() {
return _super !== null && _super.apply(this, arguments) || this;
}
ForkEvent.isForkEvent = function (value) {
return !!(value && value._isForkEvent);
};
return ForkEvent;
}(properties_1.Description));
exports.ForkEvent = ForkEvent;
var BlockForkEvent = /** @class */ (function (_super) {
__extends(BlockForkEvent, _super);
function BlockForkEvent(blockHash, expiry) {
var _this = this;
if (!bytes_1.isHexString(blockHash, 32)) {
logger.throwArgumentError("invalid blockHash", "blockHash", blockHash);
}
_this = _super.call(this, {
_isForkEvent: true,
_isBlockForkEvent: true,
expiry: (expiry || 0),
blockHash: blockHash
}) || this;
return _this;
}
return BlockForkEvent;
}(ForkEvent));
exports.BlockForkEvent = BlockForkEvent;
var TransactionForkEvent = /** @class */ (function (_super) {
__extends(TransactionForkEvent, _super);
function TransactionForkEvent(hash, expiry) {
var _this = this;
if (!bytes_1.isHexString(hash, 32)) {
logger.throwArgumentError("invalid transaction hash", "hash", hash);
}
_this = _super.call(this, {
_isForkEvent: true,
_isTransactionForkEvent: true,
expiry: (expiry || 0),
hash: hash
}) || this;
return _this;
}
return TransactionForkEvent;
}(ForkEvent));
exports.TransactionForkEvent = TransactionForkEvent;
var TransactionOrderForkEvent = /** @class */ (function (_super) {
__extends(TransactionOrderForkEvent, _super);
function TransactionOrderForkEvent(beforeHash, afterHash, expiry) {
var _this = this;
if (!bytes_1.isHexString(beforeHash, 32)) {
logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash);
}
if (!bytes_1.isHexString(afterHash, 32)) {
logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
}
_this = _super.call(this, {
_isForkEvent: true,
_isTransactionOrderForkEvent: true,
expiry: (expiry || 0),
beforeHash: beforeHash,
afterHash: afterHash
}) || this;
return _this;
}
return TransactionOrderForkEvent;
}(ForkEvent));
exports.TransactionOrderForkEvent = TransactionOrderForkEvent;
///////////////////////////////
// Exported Abstracts
var Provider = /** @class */ (function () {
function Provider() {
var _newTarget = this.constructor;
logger.checkAbstract(_newTarget, Provider);
properties_1.defineReadOnly(this, "_isProvider", true);
}
// Alias for "on"
Provider.prototype.addListener = function (eventName, listener) {
return this.on(eventName, listener);
};
// Alias for "off"
Provider.prototype.removeListener = function (eventName, listener) {
return this.off(eventName, listener);
};
Provider.isProvider = function (value) {
return !!(value && value._isProvider);
};
return Provider;
}());
exports.Provider = Provider;
//# sourceMappingURL=index.js.map
-40
View File
@@ -1,40 +0,0 @@
{
"author": "Richard Moore <me@ricmoo.com>",
"dependencies": {
"@ethersproject/bignumber": "^5.0.7",
"@ethersproject/bytes": "^5.0.4",
"@ethersproject/logger": "^5.0.5",
"@ethersproject/networks": "^5.0.3",
"@ethersproject/properties": "^5.0.3",
"@ethersproject/transactions": "^5.0.5",
"@ethersproject/web": "^5.0.6"
},
"description": "An Abstract Class for describing an Ethereum Provider for ethers.",
"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/abstract-provider",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x87fdc7d7ee69d8c228c0e6946be702acd027a832b5a3deaa5b60e3c9f7110e58",
"types": "./lib/index.d.ts",
"version": "5.0.5"
,"_resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.0.5.tgz"
,"_integrity": "sha512-i/CjElAkzV7vQBAeoz+IpjGfcFYEP9eD7j3fzZ0fzTq03DO7PPnR+xkEZ1IoDXGwDS+55aLM1xvLDwB/Lx6IOQ=="
,"_from": "@ethersproject/abstract-provider@^5.0.4"
}
@@ -1,2 +0,0 @@
export const version = "abstract-signer/5.0.7";
//# sourceMappingURL=_version.js.map
-208
View File
@@ -1,208 +0,0 @@
"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 { defineReadOnly, resolveProperties, shallowCopy } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
const allowedTransactionKeys = [
"chainId", "data", "from", "gasLimit", "gasPrice", "nonce", "to", "value"
];
const forwardErrors = [
Logger.errors.INSUFFICIENT_FUNDS,
Logger.errors.NONCE_EXPIRED,
Logger.errors.REPLACEMENT_UNDERPRICED,
];
;
;
export class Signer {
///////////////////
// Sub-classes MUST call super
constructor() {
logger.checkAbstract(new.target, Signer);
defineReadOnly(this, "_isSigner", true);
}
///////////////////
// Sub-classes MAY override these
getBalance(blockTag) {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getBalance");
return yield this.provider.getBalance(this.getAddress(), blockTag);
});
}
getTransactionCount(blockTag) {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getTransactionCount");
return yield this.provider.getTransactionCount(this.getAddress(), blockTag);
});
}
// Populates "from" if unspecified, and estimates the gas for the transation
estimateGas(transaction) {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("estimateGas");
const tx = yield resolveProperties(this.checkTransaction(transaction));
return yield this.provider.estimateGas(tx);
});
}
// Populates "from" if unspecified, and calls with the transation
call(transaction, blockTag) {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("call");
const tx = yield resolveProperties(this.checkTransaction(transaction));
return yield this.provider.call(tx, blockTag);
});
}
// Populates all fields in a transaction, signs it and sends it to the network
sendTransaction(transaction) {
this._checkProvider("sendTransaction");
return this.populateTransaction(transaction).then((tx) => {
return this.signTransaction(tx).then((signedTx) => {
return this.provider.sendTransaction(signedTx);
});
});
}
getChainId() {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getChainId");
const network = yield this.provider.getNetwork();
return network.chainId;
});
}
getGasPrice() {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getGasPrice");
return yield this.provider.getGasPrice();
});
}
resolveName(name) {
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("resolveName");
return yield this.provider.resolveName(name);
});
}
// Checks a transaction does not contain invalid keys and if
// no "from" is provided, populates it.
// - does NOT require a provider
// - adds "from" is not present
// - returns a COPY (safe to mutate the result)
// By default called from: (overriding these prevents it)
// - call
// - estimateGas
// - populateTransaction (and therefor sendTransaction)
checkTransaction(transaction) {
for (const key in transaction) {
if (allowedTransactionKeys.indexOf(key) === -1) {
logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
}
}
const tx = shallowCopy(transaction);
if (tx.from == null) {
tx.from = this.getAddress();
}
else {
// Make sure any provided address matches this signer
tx.from = Promise.all([
Promise.resolve(tx.from),
this.getAddress()
]).then((result) => {
if (result[0] !== result[1]) {
logger.throwArgumentError("from address mismatch", "transaction", transaction);
}
return result[0];
});
}
return tx;
}
// Populates ALL keys for a transaction and checks that "from" matches
// this Signer. Should be used by sendTransaction but NOT by signTransaction.
// By default called from: (overriding these prevents it)
// - sendTransaction
populateTransaction(transaction) {
return __awaiter(this, void 0, void 0, function* () {
const tx = yield resolveProperties(this.checkTransaction(transaction));
if (tx.to != null) {
tx.to = Promise.resolve(tx.to).then((to) => this.resolveName(to));
}
if (tx.gasPrice == null) {
tx.gasPrice = this.getGasPrice();
}
if (tx.nonce == null) {
tx.nonce = this.getTransactionCount("pending");
}
if (tx.gasLimit == null) {
tx.gasLimit = this.estimateGas(tx).catch((error) => {
if (forwardErrors.indexOf(error.code) >= 0) {
throw error;
}
return logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
error: error,
tx: tx
});
});
}
if (tx.chainId == null) {
tx.chainId = this.getChainId();
}
else {
tx.chainId = Promise.all([
Promise.resolve(tx.chainId),
this.getChainId()
]).then((results) => {
if (results[1] !== 0 && results[0] !== results[1]) {
logger.throwArgumentError("chainId address mismatch", "transaction", transaction);
}
return results[0];
});
}
return yield resolveProperties(tx);
});
}
///////////////////
// Sub-classes SHOULD leave these alone
_checkProvider(operation) {
if (!this.provider) {
logger.throwError("missing provider", Logger.errors.UNSUPPORTED_OPERATION, {
operation: (operation || "_checkProvider")
});
}
}
static isSigner(value) {
return !!(value && value._isSigner);
}
}
export class VoidSigner extends Signer {
constructor(address, provider) {
logger.checkNew(new.target, VoidSigner);
super();
defineReadOnly(this, "address", address);
defineReadOnly(this, "provider", provider || null);
}
getAddress() {
return Promise.resolve(this.address);
}
_fail(message, operation) {
return Promise.resolve().then(() => {
logger.throwError(message, Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });
});
}
signMessage(message) {
return this._fail("VoidSigner cannot sign messages", "signMessage");
}
signTransaction(transaction) {
return this._fail("VoidSigner cannot sign transactions", "signTransaction");
}
_signTypedData(domain, types, value) {
return this._fail("VoidSigner cannot sign typed data", "signTypedData");
}
connect(provider) {
return new VoidSigner(this.address, provider);
}
}
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "abstract-signer/5.0.7";
//# sourceMappingURL=_version.js.map
-318
View File
@@ -1,318 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
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 });
var properties_1 = require("@ethersproject/properties");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var allowedTransactionKeys = [
"chainId", "data", "from", "gasLimit", "gasPrice", "nonce", "to", "value"
];
var forwardErrors = [
logger_1.Logger.errors.INSUFFICIENT_FUNDS,
logger_1.Logger.errors.NONCE_EXPIRED,
logger_1.Logger.errors.REPLACEMENT_UNDERPRICED,
];
;
;
var Signer = /** @class */ (function () {
///////////////////
// Sub-classes MUST call super
function Signer() {
var _newTarget = this.constructor;
logger.checkAbstract(_newTarget, Signer);
properties_1.defineReadOnly(this, "_isSigner", true);
}
///////////////////
// Sub-classes MAY override these
Signer.prototype.getBalance = function (blockTag) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getBalance");
return [4 /*yield*/, this.provider.getBalance(this.getAddress(), blockTag)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
Signer.prototype.getTransactionCount = function (blockTag) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getTransactionCount");
return [4 /*yield*/, this.provider.getTransactionCount(this.getAddress(), blockTag)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
// Populates "from" if unspecified, and estimates the gas for the transation
Signer.prototype.estimateGas = function (transaction) {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("estimateGas");
return [4 /*yield*/, properties_1.resolveProperties(this.checkTransaction(transaction))];
case 1:
tx = _a.sent();
return [4 /*yield*/, this.provider.estimateGas(tx)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
// Populates "from" if unspecified, and calls with the transation
Signer.prototype.call = function (transaction, blockTag) {
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("call");
return [4 /*yield*/, properties_1.resolveProperties(this.checkTransaction(transaction))];
case 1:
tx = _a.sent();
return [4 /*yield*/, this.provider.call(tx, blockTag)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
// Populates all fields in a transaction, signs it and sends it to the network
Signer.prototype.sendTransaction = function (transaction) {
var _this = this;
this._checkProvider("sendTransaction");
return this.populateTransaction(transaction).then(function (tx) {
return _this.signTransaction(tx).then(function (signedTx) {
return _this.provider.sendTransaction(signedTx);
});
});
};
Signer.prototype.getChainId = function () {
return __awaiter(this, void 0, void 0, function () {
var network;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getChainId");
return [4 /*yield*/, this.provider.getNetwork()];
case 1:
network = _a.sent();
return [2 /*return*/, network.chainId];
}
});
});
};
Signer.prototype.getGasPrice = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getGasPrice");
return [4 /*yield*/, this.provider.getGasPrice()];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
Signer.prototype.resolveName = function (name) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("resolveName");
return [4 /*yield*/, this.provider.resolveName(name)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
// Checks a transaction does not contain invalid keys and if
// no "from" is provided, populates it.
// - does NOT require a provider
// - adds "from" is not present
// - returns a COPY (safe to mutate the result)
// By default called from: (overriding these prevents it)
// - call
// - estimateGas
// - populateTransaction (and therefor sendTransaction)
Signer.prototype.checkTransaction = function (transaction) {
for (var key in transaction) {
if (allowedTransactionKeys.indexOf(key) === -1) {
logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
}
}
var tx = properties_1.shallowCopy(transaction);
if (tx.from == null) {
tx.from = this.getAddress();
}
else {
// Make sure any provided address matches this signer
tx.from = Promise.all([
Promise.resolve(tx.from),
this.getAddress()
]).then(function (result) {
if (result[0] !== result[1]) {
logger.throwArgumentError("from address mismatch", "transaction", transaction);
}
return result[0];
});
}
return tx;
};
// Populates ALL keys for a transaction and checks that "from" matches
// this Signer. Should be used by sendTransaction but NOT by signTransaction.
// By default called from: (overriding these prevents it)
// - sendTransaction
Signer.prototype.populateTransaction = function (transaction) {
return __awaiter(this, void 0, void 0, function () {
var tx;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, properties_1.resolveProperties(this.checkTransaction(transaction))];
case 1:
tx = _a.sent();
if (tx.to != null) {
tx.to = Promise.resolve(tx.to).then(function (to) { return _this.resolveName(to); });
}
if (tx.gasPrice == null) {
tx.gasPrice = this.getGasPrice();
}
if (tx.nonce == null) {
tx.nonce = this.getTransactionCount("pending");
}
if (tx.gasLimit == null) {
tx.gasLimit = this.estimateGas(tx).catch(function (error) {
if (forwardErrors.indexOf(error.code) >= 0) {
throw error;
}
return logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
error: error,
tx: tx
});
});
}
if (tx.chainId == null) {
tx.chainId = this.getChainId();
}
else {
tx.chainId = Promise.all([
Promise.resolve(tx.chainId),
this.getChainId()
]).then(function (results) {
if (results[1] !== 0 && results[0] !== results[1]) {
logger.throwArgumentError("chainId address mismatch", "transaction", transaction);
}
return results[0];
});
}
return [4 /*yield*/, properties_1.resolveProperties(tx)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
///////////////////
// Sub-classes SHOULD leave these alone
Signer.prototype._checkProvider = function (operation) {
if (!this.provider) {
logger.throwError("missing provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: (operation || "_checkProvider")
});
}
};
Signer.isSigner = function (value) {
return !!(value && value._isSigner);
};
return Signer;
}());
exports.Signer = Signer;
var VoidSigner = /** @class */ (function (_super) {
__extends(VoidSigner, _super);
function VoidSigner(address, provider) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, VoidSigner);
_this = _super.call(this) || this;
properties_1.defineReadOnly(_this, "address", address);
properties_1.defineReadOnly(_this, "provider", provider || null);
return _this;
}
VoidSigner.prototype.getAddress = function () {
return Promise.resolve(this.address);
};
VoidSigner.prototype._fail = function (message, operation) {
return Promise.resolve().then(function () {
logger.throwError(message, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });
});
};
VoidSigner.prototype.signMessage = function (message) {
return this._fail("VoidSigner cannot sign messages", "signMessage");
};
VoidSigner.prototype.signTransaction = function (transaction) {
return this._fail("VoidSigner cannot sign transactions", "signTransaction");
};
VoidSigner.prototype._signTypedData = function (domain, types, value) {
return this._fail("VoidSigner cannot sign typed data", "signTypedData");
};
VoidSigner.prototype.connect = function (provider) {
return new VoidSigner(this.address, provider);
};
return VoidSigner;
}(Signer));
exports.VoidSigner = VoidSigner;
//# sourceMappingURL=index.js.map
-38
View File
@@ -1,38 +0,0 @@
{
"author": "Richard Moore <me@ricmoo.com>",
"dependencies": {
"@ethersproject/abstract-provider": "^5.0.4",
"@ethersproject/bignumber": "^5.0.7",
"@ethersproject/bytes": "^5.0.4",
"@ethersproject/logger": "^5.0.5",
"@ethersproject/properties": "^5.0.3"
},
"description": "An Abstract Class for desribing an Ethereum Signer for ethers.",
"ethereum": "donations.ethers.eth",
"gitHead": "86146650d83865d83b10867e9592923eada5d7cc",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/abstract-signer",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x722fb4b5e18bb70cda3c2fbd250d96bacdbe7d358c4c426a73d262fc1f751845",
"types": "./lib/index.d.ts",
"version": "5.0.7"
,"_resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.0.7.tgz"
,"_integrity": "sha512-8W8gy/QutEL60EoMEpvxZ8MFAEWs/JvH5nmZ6xeLXoZvmBCasGmxqHdYjo2cxg0nevkPkq9SeenSsBBZSCx+SQ=="
,"_from": "@ethersproject/abstract-signer@^5.0.6"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "address/5.0.5";
//# sourceMappingURL=_version.js.map
-136
View File
@@ -1,136 +0,0 @@
"use strict";
// We use this for base 36 maths
import { BN } from "bn.js";
import { arrayify, concat, hexDataLength, hexDataSlice, isHexString, stripZeros } from "@ethersproject/bytes";
import { BigNumber } from "@ethersproject/bignumber";
import { keccak256 } from "@ethersproject/keccak256";
import { encode } from "@ethersproject/rlp";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
function getChecksumAddress(address) {
if (!isHexString(address, 20)) {
logger.throwArgumentError("invalid address", "address", address);
}
address = address.toLowerCase();
const chars = address.substring(2).split("");
const expanded = new Uint8Array(40);
for (let i = 0; i < 40; i++) {
expanded[i] = chars[i].charCodeAt(0);
}
const hashed = arrayify(keccak256(expanded));
for (let i = 0; i < 40; i += 2) {
if ((hashed[i >> 1] >> 4) >= 8) {
chars[i] = chars[i].toUpperCase();
}
if ((hashed[i >> 1] & 0x0f) >= 8) {
chars[i + 1] = chars[i + 1].toUpperCase();
}
}
return "0x" + chars.join("");
}
// Shims for environments that are missing some required constants and functions
const MAX_SAFE_INTEGER = 0x1fffffffffffff;
function log10(x) {
if (Math.log10) {
return Math.log10(x);
}
return Math.log(x) / Math.LN10;
}
// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number
// Create lookup table
const ibanLookup = {};
for (let i = 0; i < 10; i++) {
ibanLookup[String(i)] = String(i);
}
for (let i = 0; i < 26; i++) {
ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
}
// How many decimal digits can we process? (for 64-bit float, this is 15)
const safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));
function ibanChecksum(address) {
address = address.toUpperCase();
address = address.substring(4) + address.substring(0, 2) + "00";
let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join("");
// Javascript can handle integers safely up to 15 (decimal) digits
while (expanded.length >= safeDigits) {
let block = expanded.substring(0, safeDigits);
expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
}
let checksum = String(98 - (parseInt(expanded, 10) % 97));
while (checksum.length < 2) {
checksum = "0" + checksum;
}
return checksum;
}
;
export function getAddress(address) {
let result = null;
if (typeof (address) !== "string") {
logger.throwArgumentError("invalid address", "address", address);
}
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
// Missing the 0x prefix
if (address.substring(0, 2) !== "0x") {
address = "0x" + address;
}
result = getChecksumAddress(address);
// It is a checksummed address with a bad checksum
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
logger.throwArgumentError("bad address checksum", "address", address);
}
// Maybe ICAP? (we only support direct mode)
}
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
// It is an ICAP address with a bad checksum
if (address.substring(2, 4) !== ibanChecksum(address)) {
logger.throwArgumentError("bad icap checksum", "address", address);
}
result = (new BN(address.substring(4), 36)).toString(16);
while (result.length < 40) {
result = "0" + result;
}
result = getChecksumAddress("0x" + result);
}
else {
logger.throwArgumentError("invalid address", "address", address);
}
return result;
}
export function isAddress(address) {
try {
getAddress(address);
return true;
}
catch (error) { }
return false;
}
export function getIcapAddress(address) {
let base36 = (new BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();
while (base36.length < 30) {
base36 = "0" + base36;
}
return "XE" + ibanChecksum("XE00" + base36) + base36;
}
// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
export function getContractAddress(transaction) {
let from = null;
try {
from = getAddress(transaction.from);
}
catch (error) {
logger.throwArgumentError("missing from address", "transaction", transaction);
}
const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));
return getAddress(hexDataSlice(keccak256(encode([from, nonce])), 12));
}
export function getCreate2Address(from, salt, initCodeHash) {
if (hexDataLength(salt) !== 32) {
logger.throwArgumentError("salt must be 32 bytes", "salt", salt);
}
if (hexDataLength(initCodeHash) !== 32) {
logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash);
}
return getAddress(hexDataSlice(keccak256(concat(["0xff", getAddress(from), salt, initCodeHash])), 12));
}
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "address/5.0.5";
//# sourceMappingURL=_version.js.map
-142
View File
@@ -1,142 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// We use this for base 36 maths
var bn_js_1 = require("bn.js");
var bytes_1 = require("@ethersproject/bytes");
var bignumber_1 = require("@ethersproject/bignumber");
var keccak256_1 = require("@ethersproject/keccak256");
var rlp_1 = require("@ethersproject/rlp");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
function getChecksumAddress(address) {
if (!bytes_1.isHexString(address, 20)) {
logger.throwArgumentError("invalid address", "address", address);
}
address = address.toLowerCase();
var chars = address.substring(2).split("");
var expanded = new Uint8Array(40);
for (var i = 0; i < 40; i++) {
expanded[i] = chars[i].charCodeAt(0);
}
var hashed = bytes_1.arrayify(keccak256_1.keccak256(expanded));
for (var i = 0; i < 40; i += 2) {
if ((hashed[i >> 1] >> 4) >= 8) {
chars[i] = chars[i].toUpperCase();
}
if ((hashed[i >> 1] & 0x0f) >= 8) {
chars[i + 1] = chars[i + 1].toUpperCase();
}
}
return "0x" + chars.join("");
}
// Shims for environments that are missing some required constants and functions
var MAX_SAFE_INTEGER = 0x1fffffffffffff;
function log10(x) {
if (Math.log10) {
return Math.log10(x);
}
return Math.log(x) / Math.LN10;
}
// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number
// Create lookup table
var ibanLookup = {};
for (var i = 0; i < 10; i++) {
ibanLookup[String(i)] = String(i);
}
for (var i = 0; i < 26; i++) {
ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
}
// How many decimal digits can we process? (for 64-bit float, this is 15)
var safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));
function ibanChecksum(address) {
address = address.toUpperCase();
address = address.substring(4) + address.substring(0, 2) + "00";
var expanded = address.split("").map(function (c) { return ibanLookup[c]; }).join("");
// Javascript can handle integers safely up to 15 (decimal) digits
while (expanded.length >= safeDigits) {
var block = expanded.substring(0, safeDigits);
expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
}
var checksum = String(98 - (parseInt(expanded, 10) % 97));
while (checksum.length < 2) {
checksum = "0" + checksum;
}
return checksum;
}
;
function getAddress(address) {
var result = null;
if (typeof (address) !== "string") {
logger.throwArgumentError("invalid address", "address", address);
}
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
// Missing the 0x prefix
if (address.substring(0, 2) !== "0x") {
address = "0x" + address;
}
result = getChecksumAddress(address);
// It is a checksummed address with a bad checksum
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
logger.throwArgumentError("bad address checksum", "address", address);
}
// Maybe ICAP? (we only support direct mode)
}
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
// It is an ICAP address with a bad checksum
if (address.substring(2, 4) !== ibanChecksum(address)) {
logger.throwArgumentError("bad icap checksum", "address", address);
}
result = (new bn_js_1.BN(address.substring(4), 36)).toString(16);
while (result.length < 40) {
result = "0" + result;
}
result = getChecksumAddress("0x" + result);
}
else {
logger.throwArgumentError("invalid address", "address", address);
}
return result;
}
exports.getAddress = getAddress;
function isAddress(address) {
try {
getAddress(address);
return true;
}
catch (error) { }
return false;
}
exports.isAddress = isAddress;
function getIcapAddress(address) {
var base36 = (new bn_js_1.BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();
while (base36.length < 30) {
base36 = "0" + base36;
}
return "XE" + ibanChecksum("XE00" + base36) + base36;
}
exports.getIcapAddress = getIcapAddress;
// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
function getContractAddress(transaction) {
var from = null;
try {
from = getAddress(transaction.from);
}
catch (error) {
logger.throwArgumentError("missing from address", "transaction", transaction);
}
var nonce = bytes_1.stripZeros(bytes_1.arrayify(bignumber_1.BigNumber.from(transaction.nonce).toHexString()));
return getAddress(bytes_1.hexDataSlice(keccak256_1.keccak256(rlp_1.encode([from, nonce])), 12));
}
exports.getContractAddress = getContractAddress;
function getCreate2Address(from, salt, initCodeHash) {
if (bytes_1.hexDataLength(salt) !== 32) {
logger.throwArgumentError("salt must be 32 bytes", "salt", salt);
}
if (bytes_1.hexDataLength(initCodeHash) !== 32) {
logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash);
}
return getAddress(bytes_1.hexDataSlice(keccak256_1.keccak256(bytes_1.concat(["0xff", getAddress(from), salt, initCodeHash])), 12));
}
exports.getCreate2Address = getCreate2Address;
//# sourceMappingURL=index.js.map
-70
View File
@@ -1,70 +0,0 @@
{
"_from": "@ethersproject/address@^5.0.4",
"_id": "@ethersproject/address@5.0.5",
"_inBundle": false,
"_integrity": "sha512-DpkQ6rwk9jTefrRsJzEm6nhRiJd9pvhn1xN0rw5N/jswXG5r7BLk/GVA0mMAVWAsYfvi2xSc5L41FMox43RYEA==",
"_location": "/@ethersproject/address",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@ethersproject/address@^5.0.4",
"name": "@ethersproject/address",
"escapedName": "@ethersproject%2faddress",
"scope": "@ethersproject",
"rawSpec": "^5.0.4",
"saveSpec": null,
"fetchSpec": "^5.0.4"
},
"_requiredBy": [
"/@ethersproject/abi",
"/@ethersproject/hash",
"/@ethersproject/transactions"
],
"_resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.0.5.tgz",
"_shasum": "2caa65f6b7125015395b1b54c985ee0b27059cc7",
"_spec": "@ethersproject/address@^5.0.4",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\@ethersproject\\transactions",
"author": {
"name": "Richard Moore",
"email": "me@ricmoo.com"
},
"bugs": {
"url": "https://github.com/ethers-io/ethers.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@ethersproject/bignumber": "^5.0.7",
"@ethersproject/bytes": "^5.0.4",
"@ethersproject/keccak256": "^5.0.3",
"@ethersproject/logger": "^5.0.5",
"@ethersproject/rlp": "^5.0.3",
"bn.js": "^4.4.0"
},
"deprecated": false,
"description": "Utilities for handling Ethereum Addresses for ethers.",
"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"homepage": "https://github.com/ethers-io/ethers.js#readme",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/address",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xd6263c8653bc6784fed703b8a30075630c544e3861f43ed5b49ab56ffb5d4808",
"types": "./lib/index.d.ts",
"version": "5.0.5"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "base64/5.0.4";
//# sourceMappingURL=_version.js.map
-19
View File
@@ -1,19 +0,0 @@
"use strict";
import { arrayify } from "@ethersproject/bytes";
export function decode(textData) {
textData = atob(textData);
const data = [];
for (let i = 0; i < textData.length; i++) {
data.push(textData.charCodeAt(i));
}
return arrayify(data);
}
export function encode(data) {
data = arrayify(data);
let textData = "";
for (let i = 0; i < data.length; i++) {
textData += String.fromCharCode(data[i]);
}
return btoa(textData);
}
//# sourceMappingURL=browser.js.map
-10
View File
@@ -1,10 +0,0 @@
"use strict";
import { arrayify } from "@ethersproject/bytes";
export function decode(textData) {
return arrayify(new Uint8Array(Buffer.from(textData, "base64")));
}
;
export function encode(data) {
return Buffer.from(arrayify(data)).toString("base64");
}
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "base64/5.0.4";
//# sourceMappingURL=_version.js.map
-22
View File
@@ -1,22 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
function decode(textData) {
textData = atob(textData);
var data = [];
for (var i = 0; i < textData.length; i++) {
data.push(textData.charCodeAt(i));
}
return bytes_1.arrayify(data);
}
exports.decode = decode;
function encode(data) {
data = bytes_1.arrayify(data);
var textData = "";
for (var i = 0; i < data.length; i++) {
textData += String.fromCharCode(data[i]);
}
return btoa(textData);
}
exports.encode = encode;
//# sourceMappingURL=browser.js.map
-13
View File
@@ -1,13 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
function decode(textData) {
return bytes_1.arrayify(new Uint8Array(Buffer.from(textData, "base64")));
}
exports.decode = decode;
;
function encode(data) {
return Buffer.from(bytes_1.arrayify(data)).toString("base64");
}
exports.encode = encode;
//# sourceMappingURL=index.js.map
-66
View File
@@ -1,66 +0,0 @@
{
"_from": "@ethersproject/base64@^5.0.3",
"_id": "@ethersproject/base64@5.0.4",
"_inBundle": false,
"_integrity": "sha512-4KRykQ7BQMeOXfvio1YITwHjxwBzh92UoXIdzxDE1p53CK28bbHPdsPNYo0wl0El7lJAMpT2SOdL0hhbWRnyIA==",
"_location": "/@ethersproject/base64",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@ethersproject/base64@^5.0.3",
"name": "@ethersproject/base64",
"escapedName": "@ethersproject%2fbase64",
"scope": "@ethersproject",
"rawSpec": "^5.0.3",
"saveSpec": null,
"fetchSpec": "^5.0.3"
},
"_requiredBy": [
"/@ethersproject/web"
],
"_resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.0.4.tgz",
"_shasum": "b0d8fdbf3dda977cf546dcd35725a7b1d5256caa",
"_spec": "@ethersproject/base64@^5.0.3",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\@ethersproject\\web",
"author": {
"name": "Richard Moore",
"email": "me@ricmoo.com"
},
"browser": "./lib/browser.js",
"browser.esm": "./lib.esm/browser.js",
"browser.umd": "./lib/browser.js",
"bugs": {
"url": "https://github.com/ethers-io/ethers.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@ethersproject/bytes": "^5.0.4"
},
"deprecated": false,
"description": "Base64 coder.",
"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"homepage": "https://github.com/ethers-io/ethers.js#readme",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/base64",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xf9edd66aa5131bf0bca2ea188265e0e333d781e4b0ef5e92090a7cef8556cb30",
"types": "./lib/index.d.ts",
"version": "5.0.4"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "bignumber/5.0.8";
//# sourceMappingURL=_version.js.map
-275
View File
@@ -1,275 +0,0 @@
"use strict";
/**
* BigNumber
*
* A wrapper around the BN.js object. We use the BN.js library
* because it is used by elliptic, so it is required regardles.
*
*/
import { BN } from "bn.js";
import { hexlify, isBytes, isHexString } from "@ethersproject/bytes";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
const _constructorGuard = {};
const MAX_SAFE = 0x1fffffffffffff;
export function isBigNumberish(value) {
return (value != null) && (BigNumber.isBigNumber(value) ||
(typeof (value) === "number" && (value % 1) === 0) ||
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
isHexString(value) ||
(typeof (value) === "bigint") ||
isBytes(value));
}
export class BigNumber {
constructor(constructorGuard, hex) {
logger.checkNew(new.target, BigNumber);
if (constructorGuard !== _constructorGuard) {
logger.throwError("cannot call constructor directly; use BigNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new (BigNumber)"
});
}
this._hex = hex;
this._isBigNumber = true;
Object.freeze(this);
}
fromTwos(value) {
return toBigNumber(toBN(this).fromTwos(value));
}
toTwos(value) {
return toBigNumber(toBN(this).toTwos(value));
}
abs() {
if (this._hex[0] === "-") {
return BigNumber.from(this._hex.substring(1));
}
return this;
}
add(other) {
return toBigNumber(toBN(this).add(toBN(other)));
}
sub(other) {
return toBigNumber(toBN(this).sub(toBN(other)));
}
div(other) {
const o = BigNumber.from(other);
if (o.isZero()) {
throwFault("division by zero", "div");
}
return toBigNumber(toBN(this).div(toBN(other)));
}
mul(other) {
return toBigNumber(toBN(this).mul(toBN(other)));
}
mod(other) {
const value = toBN(other);
if (value.isNeg()) {
throwFault("cannot modulo negative values", "mod");
}
return toBigNumber(toBN(this).umod(value));
}
pow(other) {
const value = toBN(other);
if (value.isNeg()) {
throwFault("cannot raise to negative values", "pow");
}
return toBigNumber(toBN(this).pow(value));
}
and(other) {
const value = toBN(other);
if (this.isNegative() || value.isNeg()) {
throwFault("cannot 'and' negative values", "and");
}
return toBigNumber(toBN(this).and(value));
}
or(other) {
const value = toBN(other);
if (this.isNegative() || value.isNeg()) {
throwFault("cannot 'or' negative values", "or");
}
return toBigNumber(toBN(this).or(value));
}
xor(other) {
const value = toBN(other);
if (this.isNegative() || value.isNeg()) {
throwFault("cannot 'xor' negative values", "xor");
}
return toBigNumber(toBN(this).xor(value));
}
mask(value) {
if (this.isNegative() || value < 0) {
throwFault("cannot mask negative values", "mask");
}
return toBigNumber(toBN(this).maskn(value));
}
shl(value) {
if (this.isNegative() || value < 0) {
throwFault("cannot shift negative values", "shl");
}
return toBigNumber(toBN(this).shln(value));
}
shr(value) {
if (this.isNegative() || value < 0) {
throwFault("cannot shift negative values", "shr");
}
return toBigNumber(toBN(this).shrn(value));
}
eq(other) {
return toBN(this).eq(toBN(other));
}
lt(other) {
return toBN(this).lt(toBN(other));
}
lte(other) {
return toBN(this).lte(toBN(other));
}
gt(other) {
return toBN(this).gt(toBN(other));
}
gte(other) {
return toBN(this).gte(toBN(other));
}
isNegative() {
return (this._hex[0] === "-");
}
isZero() {
return toBN(this).isZero();
}
toNumber() {
try {
return toBN(this).toNumber();
}
catch (error) {
throwFault("overflow", "toNumber", this.toString());
}
return null;
}
toString() {
// Lots of people expect this, which we do not support, so check
if (arguments.length !== 0) {
logger.throwError("bigNumber.toString does not accept parameters", Logger.errors.UNEXPECTED_ARGUMENT, {});
}
return toBN(this).toString(10);
}
toHexString() {
return this._hex;
}
toJSON(key) {
return { type: "BigNumber", hex: this.toHexString() };
}
static from(value) {
if (value instanceof BigNumber) {
return value;
}
if (typeof (value) === "string") {
if (value.match(/^-?0x[0-9a-f]+$/i)) {
return new BigNumber(_constructorGuard, toHex(value));
}
if (value.match(/^-?[0-9]+$/)) {
return new BigNumber(_constructorGuard, toHex(new BN(value)));
}
return logger.throwArgumentError("invalid BigNumber string", "value", value);
}
if (typeof (value) === "number") {
if (value % 1) {
throwFault("underflow", "BigNumber.from", value);
}
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
throwFault("overflow", "BigNumber.from", value);
}
return BigNumber.from(String(value));
}
const anyValue = value;
if (typeof (anyValue) === "bigint") {
return BigNumber.from(anyValue.toString());
}
if (isBytes(anyValue)) {
return BigNumber.from(hexlify(anyValue));
}
if (anyValue) {
// Hexable interface (takes piority)
if (anyValue.toHexString) {
const hex = anyValue.toHexString();
if (typeof (hex) === "string") {
return BigNumber.from(hex);
}
}
else {
// For now, handle legacy JSON-ified values (goes away in v6)
let hex = anyValue._hex;
// New-form JSON
if (hex == null && anyValue.type === "BigNumber") {
hex = anyValue.hex;
}
if (typeof (hex) === "string") {
if (isHexString(hex) || (hex[0] === "-" && isHexString(hex.substring(1)))) {
return BigNumber.from(hex);
}
}
}
}
return logger.throwArgumentError("invalid BigNumber value", "value", value);
}
static isBigNumber(value) {
return !!(value && value._isBigNumber);
}
}
// Normalize the hex string
function toHex(value) {
// For BN, call on the hex string
if (typeof (value) !== "string") {
return toHex(value.toString(16));
}
// If negative, prepend the negative sign to the normalized positive value
if (value[0] === "-") {
// Strip off the negative sign
value = value.substring(1);
// Cannot have mulitple negative signs (e.g. "--0x04")
if (value[0] === "-") {
logger.throwArgumentError("invalid hex", "value", value);
}
// Call toHex on the positive component
value = toHex(value);
// Do not allow "-0x00"
if (value === "0x00") {
return value;
}
// Negate the value
return "-" + value;
}
// Add a "0x" prefix if missing
if (value.substring(0, 2) !== "0x") {
value = "0x" + value;
}
// Normalize zero
if (value === "0x") {
return "0x00";
}
// Make the string even length
if (value.length % 2) {
value = "0x0" + value.substring(2);
}
// Trim to smallest even-length string
while (value.length > 4 && value.substring(0, 4) === "0x00") {
value = "0x" + value.substring(4);
}
return value;
}
function toBigNumber(value) {
return BigNumber.from(toHex(value));
}
function toBN(value) {
const hex = BigNumber.from(value).toHexString();
if (hex[0] === "-") {
return (new BN("-" + hex.substring(3), 16));
}
return new BN(hex.substring(2), 16);
}
function throwFault(fault, operation, value) {
const params = { fault: fault, operation: operation };
if (value != null) {
params.value = value;
}
return logger.throwError(fault, Logger.errors.NUMERIC_FAULT, params);
}
//# sourceMappingURL=bignumber.js.map
-339
View File
@@ -1,339 +0,0 @@
"use strict";
import { arrayify, hexZeroPad, isBytes } from "@ethersproject/bytes";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
import { BigNumber, isBigNumberish } from "./bignumber";
const _constructorGuard = {};
const Zero = BigNumber.from(0);
const NegativeOne = BigNumber.from(-1);
function throwFault(message, fault, operation, value) {
const params = { fault: fault, operation: operation };
if (value !== undefined) {
params.value = value;
}
return logger.throwError(message, Logger.errors.NUMERIC_FAULT, params);
}
// Constant to pull zeros from for multipliers
let zeros = "0";
while (zeros.length < 256) {
zeros += zeros;
}
// Returns a string "1" followed by decimal "0"s
function getMultiplier(decimals) {
if (typeof (decimals) !== "number") {
try {
decimals = BigNumber.from(decimals).toNumber();
}
catch (e) { }
}
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
return ("1" + zeros.substring(0, decimals));
}
return logger.throwArgumentError("invalid decimal size", "decimals", decimals);
}
export function formatFixed(value, decimals) {
if (decimals == null) {
decimals = 0;
}
const multiplier = getMultiplier(decimals);
// Make sure wei is a big number (convert as necessary)
value = BigNumber.from(value);
const negative = value.lt(Zero);
if (negative) {
value = value.mul(NegativeOne);
}
let fraction = value.mod(multiplier).toString();
while (fraction.length < multiplier.length - 1) {
fraction = "0" + fraction;
}
// Strip training 0
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
const whole = value.div(multiplier).toString();
value = whole + "." + fraction;
if (negative) {
value = "-" + value;
}
return value;
}
export function parseFixed(value, decimals) {
if (decimals == null) {
decimals = 0;
}
const multiplier = getMultiplier(decimals);
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
logger.throwArgumentError("invalid decimal value", "value", value);
}
if (multiplier.length - 1 === 0) {
return BigNumber.from(value);
}
// Is it negative?
const negative = (value.substring(0, 1) === "-");
if (negative) {
value = value.substring(1);
}
if (value === ".") {
logger.throwArgumentError("missing value", "value", value);
}
// Split it into a whole and fractional part
const comps = value.split(".");
if (comps.length > 2) {
logger.throwArgumentError("too many decimal points", "value", value);
}
let whole = comps[0], fraction = comps[1];
if (!whole) {
whole = "0";
}
if (!fraction) {
fraction = "0";
}
// Prevent underflow
if (fraction.length > multiplier.length - 1) {
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
}
// Fully pad the string with zeros to get to wei
while (fraction.length < multiplier.length - 1) {
fraction += "0";
}
const wholeValue = BigNumber.from(whole);
const fractionValue = BigNumber.from(fraction);
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
if (negative) {
wei = wei.mul(NegativeOne);
}
return wei;
}
export class FixedFormat {
constructor(constructorGuard, signed, width, decimals) {
if (constructorGuard !== _constructorGuard) {
logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new FixedFormat"
});
}
this.signed = signed;
this.width = width;
this.decimals = decimals;
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
this._multiplier = getMultiplier(decimals);
Object.freeze(this);
}
static from(value) {
if (value instanceof FixedFormat) {
return value;
}
let signed = true;
let width = 128;
let decimals = 18;
if (typeof (value) === "string") {
if (value === "fixed") {
// defaults...
}
else if (value === "ufixed") {
signed = false;
}
else if (value != null) {
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
if (!match) {
logger.throwArgumentError("invalid fixed format", "format", value);
}
signed = (match[1] !== "u");
width = parseInt(match[2]);
decimals = parseInt(match[3]);
}
}
else if (value) {
const check = (key, type, defaultValue) => {
if (value[key] == null) {
return defaultValue;
}
if (typeof (value[key]) !== type) {
logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
}
return value[key];
};
signed = check("signed", "boolean", signed);
width = check("width", "number", width);
decimals = check("decimals", "number", decimals);
}
if (width % 8) {
logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
}
if (decimals > 80) {
logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
}
return new FixedFormat(_constructorGuard, signed, width, decimals);
}
}
export class FixedNumber {
constructor(constructorGuard, hex, value, format) {
logger.checkNew(new.target, FixedNumber);
if (constructorGuard !== _constructorGuard) {
logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new FixedFormat"
});
}
this.format = format;
this._hex = hex;
this._value = value;
this._isFixedNumber = true;
Object.freeze(this);
}
_checkFormat(other) {
if (this.format.name !== other.format.name) {
logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
}
}
addUnsafe(other) {
this._checkFormat(other);
const a = parseFixed(this._value, this.format.decimals);
const b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
}
subUnsafe(other) {
this._checkFormat(other);
const a = parseFixed(this._value, this.format.decimals);
const b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
}
mulUnsafe(other) {
this._checkFormat(other);
const a = parseFixed(this._value, this.format.decimals);
const b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
}
divUnsafe(other) {
this._checkFormat(other);
const a = parseFixed(this._value, this.format.decimals);
const b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
}
floor() {
let comps = this.toString().split(".");
let result = FixedNumber.from(comps[0], this.format);
const hasFraction = !comps[1].match(/^(0*)$/);
if (this.isNegative() && hasFraction) {
result = result.subUnsafe(ONE);
}
return result;
}
ceiling() {
let comps = this.toString().split(".");
let result = FixedNumber.from(comps[0], this.format);
const hasFraction = !comps[1].match(/^(0*)$/);
if (!this.isNegative() && hasFraction) {
result = result.addUnsafe(ONE);
}
return result;
}
// @TODO: Support other rounding algorithms
round(decimals) {
if (decimals == null) {
decimals = 0;
}
// If we are already in range, we're done
let comps = this.toString().split(".");
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
logger.throwArgumentError("invalid decimal count", "decimals", decimals);
}
if (comps[1].length <= decimals) {
return this;
}
const factor = FixedNumber.from("1" + zeros.substring(0, decimals));
return this.mulUnsafe(factor).addUnsafe(BUMP).floor().divUnsafe(factor);
}
isZero() {
return (this._value === "0.0");
}
isNegative() {
return (this._value[0] === "-");
}
toString() { return this._value; }
toHexString(width) {
if (width == null) {
return this._hex;
}
if (width % 8) {
logger.throwArgumentError("invalid byte width", "width", width);
}
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
return hexZeroPad(hex, width / 8);
}
toUnsafeFloat() { return parseFloat(this.toString()); }
toFormat(format) {
return FixedNumber.fromString(this._value, format);
}
static fromValue(value, decimals, format) {
// If decimals looks more like a format, and there is no format, shift the parameters
if (format == null && decimals != null && !isBigNumberish(decimals)) {
format = decimals;
decimals = null;
}
if (decimals == null) {
decimals = 0;
}
if (format == null) {
format = "fixed";
}
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
}
static fromString(value, format) {
if (format == null) {
format = "fixed";
}
const fixedFormat = FixedFormat.from(format);
const numeric = parseFixed(value, fixedFormat.decimals);
if (!fixedFormat.signed && numeric.lt(Zero)) {
throwFault("unsigned value cannot be negative", "overflow", "value", value);
}
let hex = null;
if (fixedFormat.signed) {
hex = numeric.toTwos(fixedFormat.width).toHexString();
}
else {
hex = numeric.toHexString();
hex = hexZeroPad(hex, fixedFormat.width / 8);
}
const decimal = formatFixed(numeric, fixedFormat.decimals);
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
}
static fromBytes(value, format) {
if (format == null) {
format = "fixed";
}
const fixedFormat = FixedFormat.from(format);
if (arrayify(value).length > fixedFormat.width / 8) {
throw new Error("overflow");
}
let numeric = BigNumber.from(value);
if (fixedFormat.signed) {
numeric = numeric.fromTwos(fixedFormat.width);
}
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
const decimal = formatFixed(numeric, fixedFormat.decimals);
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
}
static from(value, format) {
if (typeof (value) === "string") {
return FixedNumber.fromString(value, format);
}
if (isBytes(value)) {
return FixedNumber.fromBytes(value, format);
}
try {
return FixedNumber.fromValue(value, 0, format);
}
catch (error) {
// Allow NUMERIC_FAULT to bubble up
if (error.code !== Logger.errors.INVALID_ARGUMENT) {
throw error;
}
}
return logger.throwArgumentError("invalid FixedNumber value", "value", value);
}
static isFixedNumber(value) {
return !!(value && value._isFixedNumber);
}
}
const ONE = FixedNumber.from(1);
const BUMP = FixedNumber.from("0.5");
//# sourceMappingURL=fixednumber.js.map
-3
View File
@@ -1,3 +0,0 @@
export { BigNumber } from "./bignumber";
export { formatFixed, FixedFormat, FixedNumber, parseFixed } from "./fixednumber";
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bignumber/5.0.8";
//# sourceMappingURL=_version.js.map
-280
View File
@@ -1,280 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* BigNumber
*
* A wrapper around the BN.js object. We use the BN.js library
* because it is used by elliptic, so it is required regardles.
*
*/
var bn_js_1 = require("bn.js");
var bytes_1 = require("@ethersproject/bytes");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var _constructorGuard = {};
var MAX_SAFE = 0x1fffffffffffff;
function isBigNumberish(value) {
return (value != null) && (BigNumber.isBigNumber(value) ||
(typeof (value) === "number" && (value % 1) === 0) ||
(typeof (value) === "string" && !!value.match(/^-?[0-9]+$/)) ||
bytes_1.isHexString(value) ||
(typeof (value) === "bigint") ||
bytes_1.isBytes(value));
}
exports.isBigNumberish = isBigNumberish;
var BigNumber = /** @class */ (function () {
function BigNumber(constructorGuard, hex) {
var _newTarget = this.constructor;
logger.checkNew(_newTarget, BigNumber);
if (constructorGuard !== _constructorGuard) {
logger.throwError("cannot call constructor directly; use BigNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new (BigNumber)"
});
}
this._hex = hex;
this._isBigNumber = true;
Object.freeze(this);
}
BigNumber.prototype.fromTwos = function (value) {
return toBigNumber(toBN(this).fromTwos(value));
};
BigNumber.prototype.toTwos = function (value) {
return toBigNumber(toBN(this).toTwos(value));
};
BigNumber.prototype.abs = function () {
if (this._hex[0] === "-") {
return BigNumber.from(this._hex.substring(1));
}
return this;
};
BigNumber.prototype.add = function (other) {
return toBigNumber(toBN(this).add(toBN(other)));
};
BigNumber.prototype.sub = function (other) {
return toBigNumber(toBN(this).sub(toBN(other)));
};
BigNumber.prototype.div = function (other) {
var o = BigNumber.from(other);
if (o.isZero()) {
throwFault("division by zero", "div");
}
return toBigNumber(toBN(this).div(toBN(other)));
};
BigNumber.prototype.mul = function (other) {
return toBigNumber(toBN(this).mul(toBN(other)));
};
BigNumber.prototype.mod = function (other) {
var value = toBN(other);
if (value.isNeg()) {
throwFault("cannot modulo negative values", "mod");
}
return toBigNumber(toBN(this).umod(value));
};
BigNumber.prototype.pow = function (other) {
var value = toBN(other);
if (value.isNeg()) {
throwFault("cannot raise to negative values", "pow");
}
return toBigNumber(toBN(this).pow(value));
};
BigNumber.prototype.and = function (other) {
var value = toBN(other);
if (this.isNegative() || value.isNeg()) {
throwFault("cannot 'and' negative values", "and");
}
return toBigNumber(toBN(this).and(value));
};
BigNumber.prototype.or = function (other) {
var value = toBN(other);
if (this.isNegative() || value.isNeg()) {
throwFault("cannot 'or' negative values", "or");
}
return toBigNumber(toBN(this).or(value));
};
BigNumber.prototype.xor = function (other) {
var value = toBN(other);
if (this.isNegative() || value.isNeg()) {
throwFault("cannot 'xor' negative values", "xor");
}
return toBigNumber(toBN(this).xor(value));
};
BigNumber.prototype.mask = function (value) {
if (this.isNegative() || value < 0) {
throwFault("cannot mask negative values", "mask");
}
return toBigNumber(toBN(this).maskn(value));
};
BigNumber.prototype.shl = function (value) {
if (this.isNegative() || value < 0) {
throwFault("cannot shift negative values", "shl");
}
return toBigNumber(toBN(this).shln(value));
};
BigNumber.prototype.shr = function (value) {
if (this.isNegative() || value < 0) {
throwFault("cannot shift negative values", "shr");
}
return toBigNumber(toBN(this).shrn(value));
};
BigNumber.prototype.eq = function (other) {
return toBN(this).eq(toBN(other));
};
BigNumber.prototype.lt = function (other) {
return toBN(this).lt(toBN(other));
};
BigNumber.prototype.lte = function (other) {
return toBN(this).lte(toBN(other));
};
BigNumber.prototype.gt = function (other) {
return toBN(this).gt(toBN(other));
};
BigNumber.prototype.gte = function (other) {
return toBN(this).gte(toBN(other));
};
BigNumber.prototype.isNegative = function () {
return (this._hex[0] === "-");
};
BigNumber.prototype.isZero = function () {
return toBN(this).isZero();
};
BigNumber.prototype.toNumber = function () {
try {
return toBN(this).toNumber();
}
catch (error) {
throwFault("overflow", "toNumber", this.toString());
}
return null;
};
BigNumber.prototype.toString = function () {
// Lots of people expect this, which we do not support, so check
if (arguments.length !== 0) {
logger.throwError("bigNumber.toString does not accept parameters", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {});
}
return toBN(this).toString(10);
};
BigNumber.prototype.toHexString = function () {
return this._hex;
};
BigNumber.prototype.toJSON = function (key) {
return { type: "BigNumber", hex: this.toHexString() };
};
BigNumber.from = function (value) {
if (value instanceof BigNumber) {
return value;
}
if (typeof (value) === "string") {
if (value.match(/^-?0x[0-9a-f]+$/i)) {
return new BigNumber(_constructorGuard, toHex(value));
}
if (value.match(/^-?[0-9]+$/)) {
return new BigNumber(_constructorGuard, toHex(new bn_js_1.BN(value)));
}
return logger.throwArgumentError("invalid BigNumber string", "value", value);
}
if (typeof (value) === "number") {
if (value % 1) {
throwFault("underflow", "BigNumber.from", value);
}
if (value >= MAX_SAFE || value <= -MAX_SAFE) {
throwFault("overflow", "BigNumber.from", value);
}
return BigNumber.from(String(value));
}
var anyValue = value;
if (typeof (anyValue) === "bigint") {
return BigNumber.from(anyValue.toString());
}
if (bytes_1.isBytes(anyValue)) {
return BigNumber.from(bytes_1.hexlify(anyValue));
}
if (anyValue) {
// Hexable interface (takes piority)
if (anyValue.toHexString) {
var hex = anyValue.toHexString();
if (typeof (hex) === "string") {
return BigNumber.from(hex);
}
}
else {
// For now, handle legacy JSON-ified values (goes away in v6)
var hex = anyValue._hex;
// New-form JSON
if (hex == null && anyValue.type === "BigNumber") {
hex = anyValue.hex;
}
if (typeof (hex) === "string") {
if (bytes_1.isHexString(hex) || (hex[0] === "-" && bytes_1.isHexString(hex.substring(1)))) {
return BigNumber.from(hex);
}
}
}
}
return logger.throwArgumentError("invalid BigNumber value", "value", value);
};
BigNumber.isBigNumber = function (value) {
return !!(value && value._isBigNumber);
};
return BigNumber;
}());
exports.BigNumber = BigNumber;
// Normalize the hex string
function toHex(value) {
// For BN, call on the hex string
if (typeof (value) !== "string") {
return toHex(value.toString(16));
}
// If negative, prepend the negative sign to the normalized positive value
if (value[0] === "-") {
// Strip off the negative sign
value = value.substring(1);
// Cannot have mulitple negative signs (e.g. "--0x04")
if (value[0] === "-") {
logger.throwArgumentError("invalid hex", "value", value);
}
// Call toHex on the positive component
value = toHex(value);
// Do not allow "-0x00"
if (value === "0x00") {
return value;
}
// Negate the value
return "-" + value;
}
// Add a "0x" prefix if missing
if (value.substring(0, 2) !== "0x") {
value = "0x" + value;
}
// Normalize zero
if (value === "0x") {
return "0x00";
}
// Make the string even length
if (value.length % 2) {
value = "0x0" + value.substring(2);
}
// Trim to smallest even-length string
while (value.length > 4 && value.substring(0, 4) === "0x00") {
value = "0x" + value.substring(4);
}
return value;
}
function toBigNumber(value) {
return BigNumber.from(toHex(value));
}
function toBN(value) {
var hex = BigNumber.from(value).toHexString();
if (hex[0] === "-") {
return (new bn_js_1.BN("-" + hex.substring(3), 16));
}
return new bn_js_1.BN(hex.substring(2), 16);
}
function throwFault(fault, operation, value) {
var params = { fault: fault, operation: operation };
if (value != null) {
params.value = value;
}
return logger.throwError(fault, logger_1.Logger.errors.NUMERIC_FAULT, params);
}
//# sourceMappingURL=bignumber.js.map
-347
View File
@@ -1,347 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var bignumber_1 = require("./bignumber");
var _constructorGuard = {};
var Zero = bignumber_1.BigNumber.from(0);
var NegativeOne = bignumber_1.BigNumber.from(-1);
function throwFault(message, fault, operation, value) {
var params = { fault: fault, operation: operation };
if (value !== undefined) {
params.value = value;
}
return logger.throwError(message, logger_1.Logger.errors.NUMERIC_FAULT, params);
}
// Constant to pull zeros from for multipliers
var zeros = "0";
while (zeros.length < 256) {
zeros += zeros;
}
// Returns a string "1" followed by decimal "0"s
function getMultiplier(decimals) {
if (typeof (decimals) !== "number") {
try {
decimals = bignumber_1.BigNumber.from(decimals).toNumber();
}
catch (e) { }
}
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
return ("1" + zeros.substring(0, decimals));
}
return logger.throwArgumentError("invalid decimal size", "decimals", decimals);
}
function formatFixed(value, decimals) {
if (decimals == null) {
decimals = 0;
}
var multiplier = getMultiplier(decimals);
// Make sure wei is a big number (convert as necessary)
value = bignumber_1.BigNumber.from(value);
var negative = value.lt(Zero);
if (negative) {
value = value.mul(NegativeOne);
}
var fraction = value.mod(multiplier).toString();
while (fraction.length < multiplier.length - 1) {
fraction = "0" + fraction;
}
// Strip training 0
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
var whole = value.div(multiplier).toString();
value = whole + "." + fraction;
if (negative) {
value = "-" + value;
}
return value;
}
exports.formatFixed = formatFixed;
function parseFixed(value, decimals) {
if (decimals == null) {
decimals = 0;
}
var multiplier = getMultiplier(decimals);
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
logger.throwArgumentError("invalid decimal value", "value", value);
}
if (multiplier.length - 1 === 0) {
return bignumber_1.BigNumber.from(value);
}
// Is it negative?
var negative = (value.substring(0, 1) === "-");
if (negative) {
value = value.substring(1);
}
if (value === ".") {
logger.throwArgumentError("missing value", "value", value);
}
// Split it into a whole and fractional part
var comps = value.split(".");
if (comps.length > 2) {
logger.throwArgumentError("too many decimal points", "value", value);
}
var whole = comps[0], fraction = comps[1];
if (!whole) {
whole = "0";
}
if (!fraction) {
fraction = "0";
}
// Prevent underflow
if (fraction.length > multiplier.length - 1) {
throwFault("fractional component exceeds decimals", "underflow", "parseFixed");
}
// Fully pad the string with zeros to get to wei
while (fraction.length < multiplier.length - 1) {
fraction += "0";
}
var wholeValue = bignumber_1.BigNumber.from(whole);
var fractionValue = bignumber_1.BigNumber.from(fraction);
var wei = (wholeValue.mul(multiplier)).add(fractionValue);
if (negative) {
wei = wei.mul(NegativeOne);
}
return wei;
}
exports.parseFixed = parseFixed;
var FixedFormat = /** @class */ (function () {
function FixedFormat(constructorGuard, signed, width, decimals) {
if (constructorGuard !== _constructorGuard) {
logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new FixedFormat"
});
}
this.signed = signed;
this.width = width;
this.decimals = decimals;
this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals);
this._multiplier = getMultiplier(decimals);
Object.freeze(this);
}
FixedFormat.from = function (value) {
if (value instanceof FixedFormat) {
return value;
}
var signed = true;
var width = 128;
var decimals = 18;
if (typeof (value) === "string") {
if (value === "fixed") {
// defaults...
}
else if (value === "ufixed") {
signed = false;
}
else if (value != null) {
var match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
if (!match) {
logger.throwArgumentError("invalid fixed format", "format", value);
}
signed = (match[1] !== "u");
width = parseInt(match[2]);
decimals = parseInt(match[3]);
}
}
else if (value) {
var check = function (key, type, defaultValue) {
if (value[key] == null) {
return defaultValue;
}
if (typeof (value[key]) !== type) {
logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
}
return value[key];
};
signed = check("signed", "boolean", signed);
width = check("width", "number", width);
decimals = check("decimals", "number", decimals);
}
if (width % 8) {
logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
}
if (decimals > 80) {
logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
}
return new FixedFormat(_constructorGuard, signed, width, decimals);
};
return FixedFormat;
}());
exports.FixedFormat = FixedFormat;
var FixedNumber = /** @class */ (function () {
function FixedNumber(constructorGuard, hex, value, format) {
var _newTarget = this.constructor;
logger.checkNew(_newTarget, FixedNumber);
if (constructorGuard !== _constructorGuard) {
logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new FixedFormat"
});
}
this.format = format;
this._hex = hex;
this._value = value;
this._isFixedNumber = true;
Object.freeze(this);
}
FixedNumber.prototype._checkFormat = function (other) {
if (this.format.name !== other.format.name) {
logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
}
};
FixedNumber.prototype.addUnsafe = function (other) {
this._checkFormat(other);
var a = parseFixed(this._value, this.format.decimals);
var b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
};
FixedNumber.prototype.subUnsafe = function (other) {
this._checkFormat(other);
var a = parseFixed(this._value, this.format.decimals);
var b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
};
FixedNumber.prototype.mulUnsafe = function (other) {
this._checkFormat(other);
var a = parseFixed(this._value, this.format.decimals);
var b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
};
FixedNumber.prototype.divUnsafe = function (other) {
this._checkFormat(other);
var a = parseFixed(this._value, this.format.decimals);
var b = parseFixed(other._value, other.format.decimals);
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
};
FixedNumber.prototype.floor = function () {
var comps = this.toString().split(".");
var result = FixedNumber.from(comps[0], this.format);
var hasFraction = !comps[1].match(/^(0*)$/);
if (this.isNegative() && hasFraction) {
result = result.subUnsafe(ONE);
}
return result;
};
FixedNumber.prototype.ceiling = function () {
var comps = this.toString().split(".");
var result = FixedNumber.from(comps[0], this.format);
var hasFraction = !comps[1].match(/^(0*)$/);
if (!this.isNegative() && hasFraction) {
result = result.addUnsafe(ONE);
}
return result;
};
// @TODO: Support other rounding algorithms
FixedNumber.prototype.round = function (decimals) {
if (decimals == null) {
decimals = 0;
}
// If we are already in range, we're done
var comps = this.toString().split(".");
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
logger.throwArgumentError("invalid decimal count", "decimals", decimals);
}
if (comps[1].length <= decimals) {
return this;
}
var factor = FixedNumber.from("1" + zeros.substring(0, decimals));
return this.mulUnsafe(factor).addUnsafe(BUMP).floor().divUnsafe(factor);
};
FixedNumber.prototype.isZero = function () {
return (this._value === "0.0");
};
FixedNumber.prototype.isNegative = function () {
return (this._value[0] === "-");
};
FixedNumber.prototype.toString = function () { return this._value; };
FixedNumber.prototype.toHexString = function (width) {
if (width == null) {
return this._hex;
}
if (width % 8) {
logger.throwArgumentError("invalid byte width", "width", width);
}
var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
return bytes_1.hexZeroPad(hex, width / 8);
};
FixedNumber.prototype.toUnsafeFloat = function () { return parseFloat(this.toString()); };
FixedNumber.prototype.toFormat = function (format) {
return FixedNumber.fromString(this._value, format);
};
FixedNumber.fromValue = function (value, decimals, format) {
// If decimals looks more like a format, and there is no format, shift the parameters
if (format == null && decimals != null && !bignumber_1.isBigNumberish(decimals)) {
format = decimals;
decimals = null;
}
if (decimals == null) {
decimals = 0;
}
if (format == null) {
format = "fixed";
}
return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format));
};
FixedNumber.fromString = function (value, format) {
if (format == null) {
format = "fixed";
}
var fixedFormat = FixedFormat.from(format);
var numeric = parseFixed(value, fixedFormat.decimals);
if (!fixedFormat.signed && numeric.lt(Zero)) {
throwFault("unsigned value cannot be negative", "overflow", "value", value);
}
var hex = null;
if (fixedFormat.signed) {
hex = numeric.toTwos(fixedFormat.width).toHexString();
}
else {
hex = numeric.toHexString();
hex = bytes_1.hexZeroPad(hex, fixedFormat.width / 8);
}
var decimal = formatFixed(numeric, fixedFormat.decimals);
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
};
FixedNumber.fromBytes = function (value, format) {
if (format == null) {
format = "fixed";
}
var fixedFormat = FixedFormat.from(format);
if (bytes_1.arrayify(value).length > fixedFormat.width / 8) {
throw new Error("overflow");
}
var numeric = bignumber_1.BigNumber.from(value);
if (fixedFormat.signed) {
numeric = numeric.fromTwos(fixedFormat.width);
}
var hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
var decimal = formatFixed(numeric, fixedFormat.decimals);
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
};
FixedNumber.from = function (value, format) {
if (typeof (value) === "string") {
return FixedNumber.fromString(value, format);
}
if (bytes_1.isBytes(value)) {
return FixedNumber.fromBytes(value, format);
}
try {
return FixedNumber.fromValue(value, 0, format);
}
catch (error) {
// Allow NUMERIC_FAULT to bubble up
if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT) {
throw error;
}
}
return logger.throwArgumentError("invalid FixedNumber value", "value", value);
};
FixedNumber.isFixedNumber = function (value) {
return !!(value && value._isFixedNumber);
};
return FixedNumber;
}());
exports.FixedNumber = FixedNumber;
var ONE = FixedNumber.from(1);
var BUMP = FixedNumber.from("0.5");
//# sourceMappingURL=fixednumber.js.map
-10
View File
@@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("./bignumber");
exports.BigNumber = bignumber_1.BigNumber;
var fixednumber_1 = require("./fixednumber");
exports.formatFixed = fixednumber_1.formatFixed;
exports.FixedFormat = fixednumber_1.FixedFormat;
exports.FixedNumber = fixednumber_1.FixedNumber;
exports.parseFixed = fixednumber_1.parseFixed;
//# sourceMappingURL=index.js.map
-72
View File
@@ -1,72 +0,0 @@
{
"_from": "@ethersproject/bignumber@^5.0.7",
"_id": "@ethersproject/bignumber@5.0.8",
"_inBundle": false,
"_integrity": "sha512-KXFVAFKS1jdTXYN8BE5Oj+ZfPMh28iRdFeNGBVT6cUFdtiPVqeXqc0ggvBqA3A1VoFFGgM7oAeaagA393aORHA==",
"_location": "/@ethersproject/bignumber",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@ethersproject/bignumber@^5.0.7",
"name": "@ethersproject/bignumber",
"escapedName": "@ethersproject%2fbignumber",
"scope": "@ethersproject",
"rawSpec": "^5.0.7",
"saveSpec": null,
"fetchSpec": "^5.0.7"
},
"_requiredBy": [
"/@ethersproject/abi",
"/@ethersproject/abstract-provider",
"/@ethersproject/abstract-signer",
"/@ethersproject/address",
"/@ethersproject/constants",
"/@ethersproject/hash",
"/@ethersproject/transactions"
],
"_resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.0.8.tgz",
"_shasum": "cee33bd8eb0266176def0d371b45274b1d2c4ec0",
"_spec": "@ethersproject/bignumber@^5.0.7",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\@ethersproject\\transactions",
"author": {
"name": "Richard Moore",
"email": "me@ricmoo.com"
},
"bugs": {
"url": "https://github.com/ethers-io/ethers.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@ethersproject/bytes": "^5.0.4",
"@ethersproject/logger": "^5.0.5",
"bn.js": "^4.4.0"
},
"deprecated": false,
"description": "BigNumber library used in ethers.js.",
"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"homepage": "https://github.com/ethers-io/ethers.js#readme",
"keywords": [
"Ethereum",
"bignumber",
"bn"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/bignumber",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x13de0d9c0138d0d056ed658b8f8744fab45fcdf4b52dcd9456bfd7285a4288ce",
"types": "./lib/index.d.ts",
"version": "5.0.8"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "bytes/5.0.5";
//# sourceMappingURL=_version.js.map
-380
View File
@@ -1,380 +0,0 @@
"use strict";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
///////////////////////////////
function isHexable(value) {
return !!(value.toHexString);
}
function addSlice(array) {
if (array.slice) {
return array;
}
array.slice = function () {
const args = Array.prototype.slice.call(arguments);
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
};
return array;
}
export function isBytesLike(value) {
return ((isHexString(value) && !(value.length % 2)) || isBytes(value));
}
export function isBytes(value) {
if (value == null) {
return false;
}
if (value.constructor === Uint8Array) {
return true;
}
if (typeof (value) === "string") {
return false;
}
if (value.length == null) {
return false;
}
for (let i = 0; i < value.length; i++) {
const v = value[i];
if (v < 0 || v >= 256 || (v % 1)) {
return false;
}
}
return true;
}
export function arrayify(value, options) {
if (!options) {
options = {};
}
if (typeof (value) === "number") {
logger.checkSafeUint53(value, "invalid arrayify value");
const result = [];
while (value) {
result.unshift(value & 0xff);
value = parseInt(String(value / 256));
}
if (result.length === 0) {
result.push(0);
}
return addSlice(new Uint8Array(result));
}
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
value = "0x" + value;
}
if (isHexable(value)) {
value = value.toHexString();
}
if (isHexString(value)) {
let hex = value.substring(2);
if (hex.length % 2) {
if (options.hexPad === "left") {
hex = "0x0" + hex.substring(2);
}
else if (options.hexPad === "right") {
hex += "0";
}
else {
logger.throwArgumentError("hex data is odd-length", "value", value);
}
}
const result = [];
for (let i = 0; i < hex.length; i += 2) {
result.push(parseInt(hex.substring(i, i + 2), 16));
}
return addSlice(new Uint8Array(result));
}
if (isBytes(value)) {
return addSlice(new Uint8Array(value));
}
return logger.throwArgumentError("invalid arrayify value", "value", value);
}
export function concat(items) {
const objects = items.map(item => arrayify(item));
const length = objects.reduce((accum, item) => (accum + item.length), 0);
const result = new Uint8Array(length);
objects.reduce((offset, object) => {
result.set(object, offset);
return offset + object.length;
}, 0);
return addSlice(result);
}
export function stripZeros(value) {
let result = arrayify(value);
if (result.length === 0) {
return result;
}
// Find the first non-zero entry
let start = 0;
while (start < result.length && result[start] === 0) {
start++;
}
// If we started with zeros, strip them
if (start) {
result = result.slice(start);
}
return result;
}
export function zeroPad(value, length) {
value = arrayify(value);
if (value.length > length) {
logger.throwArgumentError("value out of range", "value", arguments[0]);
}
const result = new Uint8Array(length);
result.set(value, length - value.length);
return addSlice(result);
}
export function isHexString(value, length) {
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
return false;
}
if (length && value.length !== 2 + 2 * length) {
return false;
}
return true;
}
const HexCharacters = "0123456789abcdef";
export function hexlify(value, options) {
if (!options) {
options = {};
}
if (typeof (value) === "number") {
logger.checkSafeUint53(value, "invalid hexlify value");
let hex = "";
while (value) {
hex = HexCharacters[value & 0x0f] + hex;
value = Math.floor(value / 16);
}
if (hex.length) {
if (hex.length % 2) {
hex = "0" + hex;
}
return "0x" + hex;
}
return "0x00";
}
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
value = "0x" + value;
}
if (isHexable(value)) {
return value.toHexString();
}
if (isHexString(value)) {
if (value.length % 2) {
if (options.hexPad === "left") {
value = "0x0" + value.substring(2);
}
else if (options.hexPad === "right") {
value += "0";
}
else {
logger.throwArgumentError("hex data is odd-length", "value", value);
}
}
return value.toLowerCase();
}
if (isBytes(value)) {
let result = "0x";
for (let i = 0; i < value.length; i++) {
let v = value[i];
result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];
}
return result;
}
return logger.throwArgumentError("invalid hexlify value", "value", value);
}
/*
function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {
if (typeof(value) === "string" && value.length % 2 && value.substring(0, 2) === "0x") {
return "0x0" + value.substring(2);
}
return value;
}
*/
export function hexDataLength(data) {
if (typeof (data) !== "string") {
data = hexlify(data);
}
else if (!isHexString(data) || (data.length % 2)) {
return null;
}
return (data.length - 2) / 2;
}
export function hexDataSlice(data, offset, endOffset) {
if (typeof (data) !== "string") {
data = hexlify(data);
}
else if (!isHexString(data) || (data.length % 2)) {
logger.throwArgumentError("invalid hexData", "value", data);
}
offset = 2 + 2 * offset;
if (endOffset != null) {
return "0x" + data.substring(offset, 2 + 2 * endOffset);
}
return "0x" + data.substring(offset);
}
export function hexConcat(items) {
let result = "0x";
items.forEach((item) => {
result += hexlify(item).substring(2);
});
return result;
}
export function hexValue(value) {
const trimmed = hexStripZeros(hexlify(value, { hexPad: "left" }));
if (trimmed === "0x") {
return "0x0";
}
return trimmed;
}
export function hexStripZeros(value) {
if (typeof (value) !== "string") {
value = hexlify(value);
}
if (!isHexString(value)) {
logger.throwArgumentError("invalid hex string", "value", value);
}
value = value.substring(2);
let offset = 0;
while (offset < value.length && value[offset] === "0") {
offset++;
}
return "0x" + value.substring(offset);
}
export function hexZeroPad(value, length) {
if (typeof (value) !== "string") {
value = hexlify(value);
}
else if (!isHexString(value)) {
logger.throwArgumentError("invalid hex string", "value", value);
}
if (value.length > 2 * length + 2) {
logger.throwArgumentError("value out of range", "value", arguments[1]);
}
while (value.length < 2 * length + 2) {
value = "0x0" + value.substring(2);
}
return value;
}
export function splitSignature(signature) {
const result = {
r: "0x",
s: "0x",
_vs: "0x",
recoveryParam: 0,
v: 0
};
if (isBytesLike(signature)) {
const bytes = arrayify(signature);
if (bytes.length !== 65) {
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
}
// Get the r, s and v
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
result.v = bytes[64];
// Allow a recid to be used as the v
if (result.v < 27) {
if (result.v === 0 || result.v === 1) {
result.v += 27;
}
else {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute recoveryParam from v
result.recoveryParam = 1 - (result.v % 2);
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
}
result._vs = hexlify(bytes.slice(32, 64));
}
else {
result.r = signature.r;
result.s = signature.s;
result.v = signature.v;
result.recoveryParam = signature.recoveryParam;
result._vs = signature._vs;
// If the _vs is available, use it to populate missing s, v and recoveryParam
// and verify non-missing s, v and recoveryParam
if (result._vs != null) {
const vs = zeroPad(arrayify(result._vs), 32);
result._vs = hexlify(vs);
// Set or check the recid
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
if (result.recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
}
// Set or check the s
vs[0] &= 0x7f;
const s = hexlify(vs);
if (result.s == null) {
result.s = s;
}
else if (result.s !== s) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
}
// Use recid and v to populate each other
if (result.recoveryParam == null) {
if (result.v == null) {
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
}
else {
result.recoveryParam = 1 - (result.v % 2);
}
}
else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
}
else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
}
if (result.r == null || !isHexString(result.r)) {
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
}
else {
result.r = hexZeroPad(result.r, 32);
}
if (result.s == null || !isHexString(result.s)) {
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
}
else {
result.s = hexZeroPad(result.s, 32);
}
const vs = arrayify(result.s);
if (vs[0] >= 128) {
logger.throwArgumentError("signature s out of range", "signature", signature);
}
if (result.recoveryParam) {
vs[0] |= 0x80;
}
const _vs = hexlify(vs);
if (result._vs) {
if (!isHexString(result._vs)) {
logger.throwArgumentError("signature invalid _vs", "signature", signature);
}
result._vs = hexZeroPad(result._vs, 32);
}
// Set or check the _vs
if (result._vs == null) {
result._vs = _vs;
}
else if (result._vs !== _vs) {
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
}
}
return result;
}
export function joinSignature(signature) {
signature = splitSignature(signature);
return hexlify(concat([
signature.r,
signature.s,
(signature.recoveryParam ? "0x1c" : "0x1b")
]));
}
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bytes/5.0.5";
//# sourceMappingURL=_version.js.map
-397
View File
@@ -1,397 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
///////////////////////////////
function isHexable(value) {
return !!(value.toHexString);
}
function addSlice(array) {
if (array.slice) {
return array;
}
array.slice = function () {
var args = Array.prototype.slice.call(arguments);
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
};
return array;
}
function isBytesLike(value) {
return ((isHexString(value) && !(value.length % 2)) || isBytes(value));
}
exports.isBytesLike = isBytesLike;
function isBytes(value) {
if (value == null) {
return false;
}
if (value.constructor === Uint8Array) {
return true;
}
if (typeof (value) === "string") {
return false;
}
if (value.length == null) {
return false;
}
for (var i = 0; i < value.length; i++) {
var v = value[i];
if (v < 0 || v >= 256 || (v % 1)) {
return false;
}
}
return true;
}
exports.isBytes = isBytes;
function arrayify(value, options) {
if (!options) {
options = {};
}
if (typeof (value) === "number") {
logger.checkSafeUint53(value, "invalid arrayify value");
var result = [];
while (value) {
result.unshift(value & 0xff);
value = parseInt(String(value / 256));
}
if (result.length === 0) {
result.push(0);
}
return addSlice(new Uint8Array(result));
}
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
value = "0x" + value;
}
if (isHexable(value)) {
value = value.toHexString();
}
if (isHexString(value)) {
var hex = value.substring(2);
if (hex.length % 2) {
if (options.hexPad === "left") {
hex = "0x0" + hex.substring(2);
}
else if (options.hexPad === "right") {
hex += "0";
}
else {
logger.throwArgumentError("hex data is odd-length", "value", value);
}
}
var result = [];
for (var i = 0; i < hex.length; i += 2) {
result.push(parseInt(hex.substring(i, i + 2), 16));
}
return addSlice(new Uint8Array(result));
}
if (isBytes(value)) {
return addSlice(new Uint8Array(value));
}
return logger.throwArgumentError("invalid arrayify value", "value", value);
}
exports.arrayify = arrayify;
function concat(items) {
var objects = items.map(function (item) { return arrayify(item); });
var length = objects.reduce(function (accum, item) { return (accum + item.length); }, 0);
var result = new Uint8Array(length);
objects.reduce(function (offset, object) {
result.set(object, offset);
return offset + object.length;
}, 0);
return addSlice(result);
}
exports.concat = concat;
function stripZeros(value) {
var result = arrayify(value);
if (result.length === 0) {
return result;
}
// Find the first non-zero entry
var start = 0;
while (start < result.length && result[start] === 0) {
start++;
}
// If we started with zeros, strip them
if (start) {
result = result.slice(start);
}
return result;
}
exports.stripZeros = stripZeros;
function zeroPad(value, length) {
value = arrayify(value);
if (value.length > length) {
logger.throwArgumentError("value out of range", "value", arguments[0]);
}
var result = new Uint8Array(length);
result.set(value, length - value.length);
return addSlice(result);
}
exports.zeroPad = zeroPad;
function isHexString(value, length) {
if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
return false;
}
if (length && value.length !== 2 + 2 * length) {
return false;
}
return true;
}
exports.isHexString = isHexString;
var HexCharacters = "0123456789abcdef";
function hexlify(value, options) {
if (!options) {
options = {};
}
if (typeof (value) === "number") {
logger.checkSafeUint53(value, "invalid hexlify value");
var hex = "";
while (value) {
hex = HexCharacters[value & 0x0f] + hex;
value = Math.floor(value / 16);
}
if (hex.length) {
if (hex.length % 2) {
hex = "0" + hex;
}
return "0x" + hex;
}
return "0x00";
}
if (options.allowMissingPrefix && typeof (value) === "string" && value.substring(0, 2) !== "0x") {
value = "0x" + value;
}
if (isHexable(value)) {
return value.toHexString();
}
if (isHexString(value)) {
if (value.length % 2) {
if (options.hexPad === "left") {
value = "0x0" + value.substring(2);
}
else if (options.hexPad === "right") {
value += "0";
}
else {
logger.throwArgumentError("hex data is odd-length", "value", value);
}
}
return value.toLowerCase();
}
if (isBytes(value)) {
var result = "0x";
for (var i = 0; i < value.length; i++) {
var v = value[i];
result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];
}
return result;
}
return logger.throwArgumentError("invalid hexlify value", "value", value);
}
exports.hexlify = hexlify;
/*
function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number {
if (typeof(value) === "string" && value.length % 2 && value.substring(0, 2) === "0x") {
return "0x0" + value.substring(2);
}
return value;
}
*/
function hexDataLength(data) {
if (typeof (data) !== "string") {
data = hexlify(data);
}
else if (!isHexString(data) || (data.length % 2)) {
return null;
}
return (data.length - 2) / 2;
}
exports.hexDataLength = hexDataLength;
function hexDataSlice(data, offset, endOffset) {
if (typeof (data) !== "string") {
data = hexlify(data);
}
else if (!isHexString(data) || (data.length % 2)) {
logger.throwArgumentError("invalid hexData", "value", data);
}
offset = 2 + 2 * offset;
if (endOffset != null) {
return "0x" + data.substring(offset, 2 + 2 * endOffset);
}
return "0x" + data.substring(offset);
}
exports.hexDataSlice = hexDataSlice;
function hexConcat(items) {
var result = "0x";
items.forEach(function (item) {
result += hexlify(item).substring(2);
});
return result;
}
exports.hexConcat = hexConcat;
function hexValue(value) {
var trimmed = hexStripZeros(hexlify(value, { hexPad: "left" }));
if (trimmed === "0x") {
return "0x0";
}
return trimmed;
}
exports.hexValue = hexValue;
function hexStripZeros(value) {
if (typeof (value) !== "string") {
value = hexlify(value);
}
if (!isHexString(value)) {
logger.throwArgumentError("invalid hex string", "value", value);
}
value = value.substring(2);
var offset = 0;
while (offset < value.length && value[offset] === "0") {
offset++;
}
return "0x" + value.substring(offset);
}
exports.hexStripZeros = hexStripZeros;
function hexZeroPad(value, length) {
if (typeof (value) !== "string") {
value = hexlify(value);
}
else if (!isHexString(value)) {
logger.throwArgumentError("invalid hex string", "value", value);
}
if (value.length > 2 * length + 2) {
logger.throwArgumentError("value out of range", "value", arguments[1]);
}
while (value.length < 2 * length + 2) {
value = "0x0" + value.substring(2);
}
return value;
}
exports.hexZeroPad = hexZeroPad;
function splitSignature(signature) {
var result = {
r: "0x",
s: "0x",
_vs: "0x",
recoveryParam: 0,
v: 0
};
if (isBytesLike(signature)) {
var bytes = arrayify(signature);
if (bytes.length !== 65) {
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
}
// Get the r, s and v
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
result.v = bytes[64];
// Allow a recid to be used as the v
if (result.v < 27) {
if (result.v === 0 || result.v === 1) {
result.v += 27;
}
else {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute recoveryParam from v
result.recoveryParam = 1 - (result.v % 2);
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
}
result._vs = hexlify(bytes.slice(32, 64));
}
else {
result.r = signature.r;
result.s = signature.s;
result.v = signature.v;
result.recoveryParam = signature.recoveryParam;
result._vs = signature._vs;
// If the _vs is available, use it to populate missing s, v and recoveryParam
// and verify non-missing s, v and recoveryParam
if (result._vs != null) {
var vs_1 = zeroPad(arrayify(result._vs), 32);
result._vs = hexlify(vs_1);
// Set or check the recid
var recoveryParam = ((vs_1[0] >= 128) ? 1 : 0);
if (result.recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
}
// Set or check the s
vs_1[0] &= 0x7f;
var s = hexlify(vs_1);
if (result.s == null) {
result.s = s;
}
else if (result.s !== s) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
}
// Use recid and v to populate each other
if (result.recoveryParam == null) {
if (result.v == null) {
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
}
else {
result.recoveryParam = 1 - (result.v % 2);
}
}
else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
}
else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
}
if (result.r == null || !isHexString(result.r)) {
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
}
else {
result.r = hexZeroPad(result.r, 32);
}
if (result.s == null || !isHexString(result.s)) {
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
}
else {
result.s = hexZeroPad(result.s, 32);
}
var vs = arrayify(result.s);
if (vs[0] >= 128) {
logger.throwArgumentError("signature s out of range", "signature", signature);
}
if (result.recoveryParam) {
vs[0] |= 0x80;
}
var _vs = hexlify(vs);
if (result._vs) {
if (!isHexString(result._vs)) {
logger.throwArgumentError("signature invalid _vs", "signature", signature);
}
result._vs = hexZeroPad(result._vs, 32);
}
// Set or check the _vs
if (result._vs == null) {
result._vs = _vs;
}
else if (result._vs !== _vs) {
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
}
}
return result;
}
exports.splitSignature = splitSignature;
function joinSignature(signature) {
signature = splitSignature(signature);
return hexlify(concat([
signature.r,
signature.s,
(signature.recoveryParam ? "0x1c" : "0x1b")
]));
}
exports.joinSignature = joinSignature;
//# sourceMappingURL=index.js.map
-77
View File
@@ -1,77 +0,0 @@
{
"_from": "@ethersproject/bytes@^5.0.4",
"_id": "@ethersproject/bytes@5.0.5",
"_inBundle": false,
"_integrity": "sha512-IEj9HpZB+ACS6cZ+QQMTqmu/cnUK2fYNE6ms/PVxjoBjoxc6HCraLpam1KuRvreMy0i523PLmjN8OYeikRdcUQ==",
"_location": "/@ethersproject/bytes",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@ethersproject/bytes@^5.0.4",
"name": "@ethersproject/bytes",
"escapedName": "@ethersproject%2fbytes",
"scope": "@ethersproject",
"rawSpec": "^5.0.4",
"saveSpec": null,
"fetchSpec": "^5.0.4"
},
"_requiredBy": [
"/@ethersproject/abi",
"/@ethersproject/abstract-provider",
"/@ethersproject/abstract-signer",
"/@ethersproject/address",
"/@ethersproject/base64",
"/@ethersproject/bignumber",
"/@ethersproject/hash",
"/@ethersproject/keccak256",
"/@ethersproject/rlp",
"/@ethersproject/signing-key",
"/@ethersproject/strings",
"/@ethersproject/transactions",
"/@ethersproject/web"
],
"_resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.0.5.tgz",
"_shasum": "688b70000e550de0c97a151a21f15b87d7f97d7c",
"_spec": "@ethersproject/bytes@^5.0.4",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\@ethersproject\\transactions",
"author": {
"name": "Richard Moore",
"email": "me@ricmoo.com"
},
"bugs": {
"url": "https://github.com/ethers-io/ethers.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@ethersproject/logger": "^5.0.5"
},
"deprecated": false,
"description": "Bytes utility functions for ethers.",
"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"homepage": "https://github.com/ethers-io/ethers.js#readme",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/bytes",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"auto-build": "npm run build -- -w",
"build": "tsc -p ./tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x132538d3d8927299393c28ac01243ebc0e7ea34f5af1feadf23b364745f7c130",
"types": "./lib/index.d.ts",
"version": "5.0.5"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "constants/5.0.5";
//# sourceMappingURL=_version.js.map
-14
View File
@@ -1,14 +0,0 @@
"use strict";
import { BigNumber } from "@ethersproject/bignumber";
const AddressZero = "0x0000000000000000000000000000000000000000";
const HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
// NFKC (composed) // (decomposed)
const EtherSymbol = "\u039e"; // "\uD835\uDF63";
const NegativeOne = BigNumber.from(-1);
const Zero = BigNumber.from(0);
const One = BigNumber.from(1);
const Two = BigNumber.from(2);
const WeiPerEther = BigNumber.from("1000000000000000000");
const MaxUint256 = BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
export { AddressZero, HashZero, EtherSymbol, NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256 };
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "constants/5.0.5";
//# sourceMappingURL=_version.js.map
-23
View File
@@ -1,23 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bignumber_1 = require("@ethersproject/bignumber");
var AddressZero = "0x0000000000000000000000000000000000000000";
exports.AddressZero = AddressZero;
var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000";
exports.HashZero = HashZero;
// NFKC (composed) // (decomposed)
var EtherSymbol = "\u039e"; // "\uD835\uDF63";
exports.EtherSymbol = EtherSymbol;
var NegativeOne = bignumber_1.BigNumber.from(-1);
exports.NegativeOne = NegativeOne;
var Zero = bignumber_1.BigNumber.from(0);
exports.Zero = Zero;
var One = bignumber_1.BigNumber.from(1);
exports.One = One;
var Two = bignumber_1.BigNumber.from(2);
exports.Two = Two;
var WeiPerEther = bignumber_1.BigNumber.from("1000000000000000000");
exports.WeiPerEther = WeiPerEther;
var MaxUint256 = bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
exports.MaxUint256 = MaxUint256;
//# sourceMappingURL=index.js.map
-65
View File
@@ -1,65 +0,0 @@
{
"_from": "@ethersproject/constants@^5.0.4",
"_id": "@ethersproject/constants@5.0.5",
"_inBundle": false,
"_integrity": "sha512-foaQVmxp2+ik9FrLUCtVrLZCj4M3Ibgkqvh+Xw/vFRSerkjVSYePApaVE5essxhoSlF1U9oXfWY09QI2AXtgKA==",
"_location": "/@ethersproject/constants",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@ethersproject/constants@^5.0.4",
"name": "@ethersproject/constants",
"escapedName": "@ethersproject%2fconstants",
"scope": "@ethersproject",
"rawSpec": "^5.0.4",
"saveSpec": null,
"fetchSpec": "^5.0.4"
},
"_requiredBy": [
"/@ethersproject/abi",
"/@ethersproject/strings",
"/@ethersproject/transactions"
],
"_resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.0.5.tgz",
"_shasum": "0ed19b002e8404bdf6d135234dc86a7d9bcf9b71",
"_spec": "@ethersproject/constants@^5.0.4",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\@ethersproject\\transactions",
"author": {
"name": "Richard Moore",
"email": "me@ricmoo.com"
},
"bugs": {
"url": "https://github.com/ethers-io/ethers.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@ethersproject/bignumber": "^5.0.7"
},
"deprecated": false,
"description": "Common Ethereum constants used for ethers.",
"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"homepage": "https://github.com/ethers-io/ethers.js#readme",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/constants",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x638edaa4b45c46158073ede9fda2c54d6c60a2f11485e693021c484076970130",
"types": "./lib/index.d.ts",
"version": "5.0.5"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "hash/5.0.6";
//# sourceMappingURL=_version.js.map
-6
View File
@@ -1,6 +0,0 @@
import { keccak256 } from "@ethersproject/keccak256";
import { toUtf8Bytes } from "@ethersproject/strings";
export function id(text) {
return keccak256(toUtf8Bytes(text));
}
//# sourceMappingURL=id.js.map
-7
View File
@@ -1,7 +0,0 @@
"use strict";
import { id } from "./id";
import { isValidName, namehash } from "./namehash";
import { hashMessage, messagePrefix } from "./message";
import { TypedDataEncoder as _TypedDataEncoder } from "./typed-data";
export { id, namehash, isValidName, messagePrefix, hashMessage, _TypedDataEncoder, };
//# sourceMappingURL=index.js.map
-15
View File
@@ -1,15 +0,0 @@
import { concat } from "@ethersproject/bytes";
import { keccak256 } from "@ethersproject/keccak256";
import { toUtf8Bytes } from "@ethersproject/strings";
export const messagePrefix = "\x19Ethereum Signed Message:\n";
export function hashMessage(message) {
if (typeof (message) === "string") {
message = toUtf8Bytes(message);
}
return keccak256(concat([
toUtf8Bytes(messagePrefix),
toUtf8Bytes(String(message.length)),
message
]));
}
//# sourceMappingURL=message.js.map
-37
View File
@@ -1,37 +0,0 @@
import { concat, hexlify } from "@ethersproject/bytes";
import { nameprep, toUtf8Bytes } from "@ethersproject/strings";
import { keccak256 } from "@ethersproject/keccak256";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
const Zeros = new Uint8Array(32);
Zeros.fill(0);
const Partition = new RegExp("^((.*)\\.)?([^.]+)$");
export function isValidName(name) {
try {
const comps = name.split(".");
for (let i = 0; i < comps.length; i++) {
if (nameprep(comps[i]).length === 0) {
throw new Error("empty");
}
}
return true;
}
catch (error) { }
return false;
}
export function namehash(name) {
/* istanbul ignore if */
if (typeof (name) !== "string") {
logger.throwArgumentError("invalid address - " + String(name), "name", name);
}
let result = Zeros;
while (name.length) {
const partition = name.match(Partition);
const label = toUtf8Bytes(nameprep(partition[3]));
result = keccak256(concat([result, keccak256(label)]));
name = partition[2] || "";
}
return hexlify(result);
}
//# sourceMappingURL=namehash.js.map
-444
View File
@@ -1,444 +0,0 @@
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 { getAddress } from "@ethersproject/address";
import { BigNumber } from "@ethersproject/bignumber";
import { arrayify, hexConcat, hexlify, hexValue, hexZeroPad, isHexString } from "@ethersproject/bytes";
import { keccak256 } from "@ethersproject/keccak256";
import { deepCopy, defineReadOnly, shallowCopy } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
import { id } from "./id";
const padding = new Uint8Array(32);
padding.fill(0);
const NegativeOne = BigNumber.from(-1);
const Zero = BigNumber.from(0);
const One = BigNumber.from(1);
const MaxUint256 = BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
function hexPadRight(value) {
const bytes = arrayify(value);
const padOffset = bytes.length % 32;
if (padOffset) {
return hexConcat([bytes, padding.slice(padOffset)]);
}
return hexlify(bytes);
}
const hexTrue = hexZeroPad(One.toHexString(), 32);
const hexFalse = hexZeroPad(Zero.toHexString(), 32);
const domainFieldTypes = {
name: "string",
version: "string",
chainId: "uint256",
verifyingContract: "address",
salt: "bytes32"
};
const domainFieldNames = [
"name", "version", "chainId", "verifyingContract", "salt"
];
function checkString(key) {
return function (value) {
if (typeof (value) !== "string") {
logger.throwArgumentError(`invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value);
}
return value;
};
}
const domainChecks = {
name: checkString("name"),
version: checkString("version"),
chainId: function (value) {
try {
return BigNumber.from(value).toString();
}
catch (error) { }
return logger.throwArgumentError(`invalid domain value for "chainId"`, "domain.chainId", value);
},
verifyingContract: function (value) {
try {
return getAddress(value).toLowerCase();
}
catch (error) { }
return logger.throwArgumentError(`invalid domain value "verifyingContract"`, "domain.verifyingContract", value);
},
salt: function (value) {
try {
const bytes = arrayify(value);
if (bytes.length !== 32) {
throw new Error("bad length");
}
return hexlify(bytes);
}
catch (error) { }
return logger.throwArgumentError(`invalid domain value "salt"`, "domain.salt", value);
}
};
function getBaseEncoder(type) {
// intXX and uintXX
{
const match = type.match(/^(u?)int(\d*)$/);
if (match) {
const signed = (match[1] === "");
const width = parseInt(match[2] || "256");
if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) {
logger.throwArgumentError("invalid numeric width", "type", type);
}
const boundsUpper = MaxUint256.mask(signed ? (width - 1) : width);
const boundsLower = signed ? boundsUpper.add(One).mul(NegativeOne) : Zero;
return function (value) {
const v = BigNumber.from(value);
if (v.lt(boundsLower) || v.gt(boundsUpper)) {
logger.throwArgumentError(`value out-of-bounds for ${type}`, "value", value);
}
return hexZeroPad(v.toTwos(256).toHexString(), 32);
};
}
}
// bytesXX
{
const match = type.match(/^bytes(\d+)$/);
if (match) {
const width = parseInt(match[1]);
if (width === 0 || width > 32 || match[1] !== String(width)) {
logger.throwArgumentError("invalid bytes width", "type", type);
}
return function (value) {
const bytes = arrayify(value);
if (bytes.length !== width) {
logger.throwArgumentError(`invalid length for ${type}`, "value", value);
}
return hexPadRight(value);
};
}
}
switch (type) {
case "address": return function (value) {
return hexZeroPad(getAddress(value), 32);
};
case "bool": return function (value) {
return ((!value) ? hexFalse : hexTrue);
};
case "bytes": return function (value) {
return keccak256(value);
};
case "string": return function (value) {
return id(value);
};
}
return null;
}
function encodeType(name, fields) {
return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`;
}
export class TypedDataEncoder {
constructor(types) {
defineReadOnly(this, "types", Object.freeze(deepCopy(types)));
defineReadOnly(this, "_encoderCache", {});
defineReadOnly(this, "_types", {});
// Link struct types to their direct child structs
const links = {};
// Link structs to structs which contain them as a child
const parents = {};
// Link all subtypes within a given struct
const subtypes = {};
Object.keys(types).forEach((type) => {
links[type] = {};
parents[type] = [];
subtypes[type] = {};
});
for (const name in types) {
const uniqueNames = {};
types[name].forEach((field) => {
// Check each field has a unique name
if (uniqueNames[field.name]) {
logger.throwArgumentError(`duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types);
}
uniqueNames[field.name] = true;
// Get the base type (drop any array specifiers)
const baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1];
if (baseType === name) {
logger.throwArgumentError(`circular type reference to ${JSON.stringify(baseType)}`, "types", types);
}
// Is this a base encoding type?
const encoder = getBaseEncoder(baseType);
if (encoder) {
return;
}
if (!parents[baseType]) {
logger.throwArgumentError(`unknown type ${JSON.stringify(baseType)}`, "types", types);
}
// Add linkage
parents[baseType].push(name);
links[name][baseType] = true;
});
}
// Deduce the primary type
const primaryTypes = Object.keys(parents).filter((n) => (parents[n].length === 0));
if (primaryTypes.length === 0) {
logger.throwArgumentError("missing primary type", "types", types);
}
else if (primaryTypes.length > 1) {
logger.throwArgumentError(`ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types);
}
defineReadOnly(this, "primaryType", primaryTypes[0]);
// Check for circular type references
function checkCircular(type, found) {
if (found[type]) {
logger.throwArgumentError(`circular type reference to ${JSON.stringify(type)}`, "types", types);
}
found[type] = true;
Object.keys(links[type]).forEach((child) => {
if (!parents[child]) {
return;
}
// Recursively check children
checkCircular(child, found);
// Mark all ancestors as having this decendant
Object.keys(found).forEach((subtype) => {
subtypes[subtype][child] = true;
});
});
delete found[type];
}
checkCircular(this.primaryType, {});
// Compute each fully describe type
for (const name in subtypes) {
const st = Object.keys(subtypes[name]);
st.sort();
this._types[name] = encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("");
}
}
getEncoder(type) {
let encoder = this._encoderCache[type];
if (!encoder) {
encoder = this._encoderCache[type] = this._getEncoder(type);
}
return encoder;
}
_getEncoder(type) {
// Basic encoder type (address, bool, uint256, etc)
{
const encoder = getBaseEncoder(type);
if (encoder) {
return encoder;
}
}
// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
const subtype = match[1];
const subEncoder = this.getEncoder(subtype);
const length = parseInt(match[3]);
return (value) => {
if (length >= 0 && value.length !== length) {
logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value);
}
let result = value.map(subEncoder);
if (this._types[subtype]) {
result = result.map(keccak256);
}
return keccak256(hexConcat(result));
};
}
// Struct
const fields = this.types[type];
if (fields) {
const encodedType = id(this._types[type]);
return (value) => {
const values = fields.map(({ name, type }) => {
const result = this.getEncoder(type)(value[name]);
if (this._types[type]) {
return keccak256(result);
}
return result;
});
values.unshift(encodedType);
return hexConcat(values);
};
}
return logger.throwArgumentError(`unknown type: ${type}`, "type", type);
}
encodeType(name) {
const result = this._types[name];
if (!result) {
logger.throwArgumentError(`unknown type: ${JSON.stringify(name)}`, "name", name);
}
return result;
}
encodeData(type, value) {
return this.getEncoder(type)(value);
}
hashStruct(name, value) {
return keccak256(this.encodeData(name, value));
}
encode(value) {
return this.encodeData(this.primaryType, value);
}
hash(value) {
return this.hashStruct(this.primaryType, value);
}
_visit(type, value, callback) {
// Basic encoder type (address, bool, uint256, etc)
{
const encoder = getBaseEncoder(type);
if (encoder) {
return callback(type, value);
}
}
// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
const subtype = match[1];
const length = parseInt(match[3]);
if (length >= 0 && value.length !== length) {
logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value);
}
return value.map((v) => this._visit(subtype, v, callback));
}
// Struct
const fields = this.types[type];
if (fields) {
return fields.reduce((accum, { name, type }) => {
accum[name] = this._visit(type, value[name], callback);
return accum;
}, {});
}
return logger.throwArgumentError(`unknown type: ${type}`, "type", type);
}
visit(value, callback) {
return this._visit(this.primaryType, value, callback);
}
static from(types) {
return new TypedDataEncoder(types);
}
static getPrimaryType(types) {
return TypedDataEncoder.from(types).primaryType;
}
static hashStruct(name, types, value) {
return TypedDataEncoder.from(types).hashStruct(name, value);
}
static hashDomain(domain) {
const domainFields = [];
for (const name in domain) {
const type = domainFieldTypes[name];
if (!type) {
logger.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain);
}
domainFields.push({ name, type });
}
domainFields.sort((a, b) => {
return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name);
});
return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain);
}
static encode(domain, types, value) {
return hexConcat([
"0x1901",
TypedDataEncoder.hashDomain(domain),
TypedDataEncoder.from(types).hash(value)
]);
}
static hash(domain, types, value) {
return keccak256(TypedDataEncoder.encode(domain, types, value));
}
// Replaces all address types with ENS names with their looked up address
static resolveNames(domain, types, value, resolveName) {
return __awaiter(this, void 0, void 0, function* () {
// Make a copy to isolate it from the object passed in
domain = shallowCopy(domain);
// Look up all ENS names
const ensCache = {};
// Do we need to look up the domain's verifyingContract?
if (domain.verifyingContract && !isHexString(domain.verifyingContract, 20)) {
ensCache[domain.verifyingContract] = "0x";
}
// We are going to use the encoder to visit all the base values
const encoder = TypedDataEncoder.from(types);
// Get a list of all the addresses
encoder.visit(value, (type, value) => {
if (type === "address" && !isHexString(value, 20)) {
ensCache[value] = "0x";
}
return value;
});
// Lookup each name
for (const name in ensCache) {
ensCache[name] = yield resolveName(name);
}
// Replace the domain verifyingContract if needed
if (domain.verifyingContract && ensCache[domain.verifyingContract]) {
domain.verifyingContract = ensCache[domain.verifyingContract];
}
// Replace all ENS names with their address
value = encoder.visit(value, (type, value) => {
if (type === "address" && ensCache[value]) {
return ensCache[value];
}
return value;
});
return { domain, value };
});
}
static getPayload(domain, types, value) {
// Validate the domain fields
TypedDataEncoder.hashDomain(domain);
// Derive the EIP712Domain Struct reference type
const domainValues = {};
const domainTypes = [];
domainFieldNames.forEach((name) => {
const value = domain[name];
if (value == null) {
return;
}
domainValues[name] = domainChecks[name](value);
domainTypes.push({ name, type: domainFieldTypes[name] });
});
const encoder = TypedDataEncoder.from(types);
const typesWithDomain = shallowCopy(types);
if (typesWithDomain.EIP712Domain) {
typesWithDomain.EIP712Domain = domainTypes;
}
// Validate the data structures and types
encoder.encode(value);
return {
types: typesWithDomain,
domain: domainValues,
primaryType: encoder.primaryType,
message: encoder.visit(value, (type, value) => {
// bytes
if (type.match(/^bytes(\d*)/)) {
return hexlify(arrayify(value));
}
// uint or int
if (type.match(/^u?int/)) {
let prefix = "";
let v = BigNumber.from(value);
if (v.isNegative()) {
prefix = "-";
v = v.mul(-1);
}
return prefix + hexValue(v.toHexString());
}
switch (type) {
case "address":
return value.toLowerCase();
case "bool":
return !!value;
case "string":
if (typeof (value) !== "string") {
logger.throwArgumentError(`invalid string`, "value", value);
}
return value;
}
return logger.throwArgumentError("unsupported type", "type", type);
})
};
}
}
//# sourceMappingURL=typed-data.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "hash/5.0.6";
//# sourceMappingURL=_version.js.map
-9
View File
@@ -1,9 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var keccak256_1 = require("@ethersproject/keccak256");
var strings_1 = require("@ethersproject/strings");
function id(text) {
return keccak256_1.keccak256(strings_1.toUtf8Bytes(text));
}
exports.id = id;
//# sourceMappingURL=id.js.map
-13
View File
@@ -1,13 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var id_1 = require("./id");
exports.id = id_1.id;
var namehash_1 = require("./namehash");
exports.isValidName = namehash_1.isValidName;
exports.namehash = namehash_1.namehash;
var message_1 = require("./message");
exports.hashMessage = message_1.hashMessage;
exports.messagePrefix = message_1.messagePrefix;
var typed_data_1 = require("./typed-data");
exports._TypedDataEncoder = typed_data_1.TypedDataEncoder;
//# sourceMappingURL=index.js.map
-18
View File
@@ -1,18 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var keccak256_1 = require("@ethersproject/keccak256");
var strings_1 = require("@ethersproject/strings");
exports.messagePrefix = "\x19Ethereum Signed Message:\n";
function hashMessage(message) {
if (typeof (message) === "string") {
message = strings_1.toUtf8Bytes(message);
}
return keccak256_1.keccak256(bytes_1.concat([
strings_1.toUtf8Bytes(exports.messagePrefix),
strings_1.toUtf8Bytes(String(message.length)),
message
]));
}
exports.hashMessage = hashMessage;
//# sourceMappingURL=message.js.map
-41
View File
@@ -1,41 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var bytes_1 = require("@ethersproject/bytes");
var strings_1 = require("@ethersproject/strings");
var keccak256_1 = require("@ethersproject/keccak256");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var Zeros = new Uint8Array(32);
Zeros.fill(0);
var Partition = new RegExp("^((.*)\\.)?([^.]+)$");
function isValidName(name) {
try {
var comps = name.split(".");
for (var i = 0; i < comps.length; i++) {
if (strings_1.nameprep(comps[i]).length === 0) {
throw new Error("empty");
}
}
return true;
}
catch (error) { }
return false;
}
exports.isValidName = isValidName;
function namehash(name) {
/* istanbul ignore if */
if (typeof (name) !== "string") {
logger.throwArgumentError("invalid address - " + String(name), "name", name);
}
var result = Zeros;
while (name.length) {
var partition = name.match(Partition);
var label = strings_1.toUtf8Bytes(strings_1.nameprep(partition[3]));
result = keccak256_1.keccak256(bytes_1.concat([result, keccak256_1.keccak256(label)]));
name = partition[2] || "";
}
return bytes_1.hexlify(result);
}
exports.namehash = namehash;
//# sourceMappingURL=namehash.js.map
-503
View File
@@ -1,503 +0,0 @@
"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 });
var address_1 = require("@ethersproject/address");
var bignumber_1 = require("@ethersproject/bignumber");
var bytes_1 = require("@ethersproject/bytes");
var keccak256_1 = require("@ethersproject/keccak256");
var properties_1 = require("@ethersproject/properties");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
var id_1 = require("./id");
var padding = new Uint8Array(32);
padding.fill(0);
var NegativeOne = bignumber_1.BigNumber.from(-1);
var Zero = bignumber_1.BigNumber.from(0);
var One = bignumber_1.BigNumber.from(1);
var MaxUint256 = bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
function hexPadRight(value) {
var bytes = bytes_1.arrayify(value);
var padOffset = bytes.length % 32;
if (padOffset) {
return bytes_1.hexConcat([bytes, padding.slice(padOffset)]);
}
return bytes_1.hexlify(bytes);
}
var hexTrue = bytes_1.hexZeroPad(One.toHexString(), 32);
var hexFalse = bytes_1.hexZeroPad(Zero.toHexString(), 32);
var domainFieldTypes = {
name: "string",
version: "string",
chainId: "uint256",
verifyingContract: "address",
salt: "bytes32"
};
var domainFieldNames = [
"name", "version", "chainId", "verifyingContract", "salt"
];
function checkString(key) {
return function (value) {
if (typeof (value) !== "string") {
logger.throwArgumentError("invalid domain value for " + JSON.stringify(key), "domain." + key, value);
}
return value;
};
}
var domainChecks = {
name: checkString("name"),
version: checkString("version"),
chainId: function (value) {
try {
return bignumber_1.BigNumber.from(value).toString();
}
catch (error) { }
return logger.throwArgumentError("invalid domain value for \"chainId\"", "domain.chainId", value);
},
verifyingContract: function (value) {
try {
return address_1.getAddress(value).toLowerCase();
}
catch (error) { }
return logger.throwArgumentError("invalid domain value \"verifyingContract\"", "domain.verifyingContract", value);
},
salt: function (value) {
try {
var bytes = bytes_1.arrayify(value);
if (bytes.length !== 32) {
throw new Error("bad length");
}
return bytes_1.hexlify(bytes);
}
catch (error) { }
return logger.throwArgumentError("invalid domain value \"salt\"", "domain.salt", value);
}
};
function getBaseEncoder(type) {
// intXX and uintXX
{
var match = type.match(/^(u?)int(\d*)$/);
if (match) {
var signed = (match[1] === "");
var width = parseInt(match[2] || "256");
if (width % 8 !== 0 || width > 256 || (match[2] && match[2] !== String(width))) {
logger.throwArgumentError("invalid numeric width", "type", type);
}
var boundsUpper_1 = MaxUint256.mask(signed ? (width - 1) : width);
var boundsLower_1 = signed ? boundsUpper_1.add(One).mul(NegativeOne) : Zero;
return function (value) {
var v = bignumber_1.BigNumber.from(value);
if (v.lt(boundsLower_1) || v.gt(boundsUpper_1)) {
logger.throwArgumentError("value out-of-bounds for " + type, "value", value);
}
return bytes_1.hexZeroPad(v.toTwos(256).toHexString(), 32);
};
}
}
// bytesXX
{
var match = type.match(/^bytes(\d+)$/);
if (match) {
var width_1 = parseInt(match[1]);
if (width_1 === 0 || width_1 > 32 || match[1] !== String(width_1)) {
logger.throwArgumentError("invalid bytes width", "type", type);
}
return function (value) {
var bytes = bytes_1.arrayify(value);
if (bytes.length !== width_1) {
logger.throwArgumentError("invalid length for " + type, "value", value);
}
return hexPadRight(value);
};
}
}
switch (type) {
case "address": return function (value) {
return bytes_1.hexZeroPad(address_1.getAddress(value), 32);
};
case "bool": return function (value) {
return ((!value) ? hexFalse : hexTrue);
};
case "bytes": return function (value) {
return keccak256_1.keccak256(value);
};
case "string": return function (value) {
return id_1.id(value);
};
}
return null;
}
function encodeType(name, fields) {
return name + "(" + fields.map(function (_a) {
var name = _a.name, type = _a.type;
return (type + " " + name);
}).join(",") + ")";
}
var TypedDataEncoder = /** @class */ (function () {
function TypedDataEncoder(types) {
properties_1.defineReadOnly(this, "types", Object.freeze(properties_1.deepCopy(types)));
properties_1.defineReadOnly(this, "_encoderCache", {});
properties_1.defineReadOnly(this, "_types", {});
// Link struct types to their direct child structs
var links = {};
// Link structs to structs which contain them as a child
var parents = {};
// Link all subtypes within a given struct
var subtypes = {};
Object.keys(types).forEach(function (type) {
links[type] = {};
parents[type] = [];
subtypes[type] = {};
});
var _loop_1 = function (name_1) {
var uniqueNames = {};
types[name_1].forEach(function (field) {
// Check each field has a unique name
if (uniqueNames[field.name]) {
logger.throwArgumentError("duplicate variable name " + JSON.stringify(field.name) + " in " + JSON.stringify(name_1), "types", types);
}
uniqueNames[field.name] = true;
// Get the base type (drop any array specifiers)
var baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1];
if (baseType === name_1) {
logger.throwArgumentError("circular type reference to " + JSON.stringify(baseType), "types", types);
}
// Is this a base encoding type?
var encoder = getBaseEncoder(baseType);
if (encoder) {
return;
}
if (!parents[baseType]) {
logger.throwArgumentError("unknown type " + JSON.stringify(baseType), "types", types);
}
// Add linkage
parents[baseType].push(name_1);
links[name_1][baseType] = true;
});
};
for (var name_1 in types) {
_loop_1(name_1);
}
// Deduce the primary type
var primaryTypes = Object.keys(parents).filter(function (n) { return (parents[n].length === 0); });
if (primaryTypes.length === 0) {
logger.throwArgumentError("missing primary type", "types", types);
}
else if (primaryTypes.length > 1) {
logger.throwArgumentError("ambiguous primary types or unused types: " + primaryTypes.map(function (t) { return (JSON.stringify(t)); }).join(", "), "types", types);
}
properties_1.defineReadOnly(this, "primaryType", primaryTypes[0]);
// Check for circular type references
function checkCircular(type, found) {
if (found[type]) {
logger.throwArgumentError("circular type reference to " + JSON.stringify(type), "types", types);
}
found[type] = true;
Object.keys(links[type]).forEach(function (child) {
if (!parents[child]) {
return;
}
// Recursively check children
checkCircular(child, found);
// Mark all ancestors as having this decendant
Object.keys(found).forEach(function (subtype) {
subtypes[subtype][child] = true;
});
});
delete found[type];
}
checkCircular(this.primaryType, {});
// Compute each fully describe type
for (var name_2 in subtypes) {
var st = Object.keys(subtypes[name_2]);
st.sort();
this._types[name_2] = encodeType(name_2, types[name_2]) + st.map(function (t) { return encodeType(t, types[t]); }).join("");
}
}
TypedDataEncoder.prototype.getEncoder = function (type) {
var encoder = this._encoderCache[type];
if (!encoder) {
encoder = this._encoderCache[type] = this._getEncoder(type);
}
return encoder;
};
TypedDataEncoder.prototype._getEncoder = function (type) {
var _this = this;
// Basic encoder type (address, bool, uint256, etc)
{
var encoder = getBaseEncoder(type);
if (encoder) {
return encoder;
}
}
// Array
var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
var subtype_1 = match[1];
var subEncoder_1 = this.getEncoder(subtype_1);
var length_1 = parseInt(match[3]);
return function (value) {
if (length_1 >= 0 && value.length !== length_1) {
logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value);
}
var result = value.map(subEncoder_1);
if (_this._types[subtype_1]) {
result = result.map(keccak256_1.keccak256);
}
return keccak256_1.keccak256(bytes_1.hexConcat(result));
};
}
// Struct
var fields = this.types[type];
if (fields) {
var encodedType_1 = id_1.id(this._types[type]);
return function (value) {
var values = fields.map(function (_a) {
var name = _a.name, type = _a.type;
var result = _this.getEncoder(type)(value[name]);
if (_this._types[type]) {
return keccak256_1.keccak256(result);
}
return result;
});
values.unshift(encodedType_1);
return bytes_1.hexConcat(values);
};
}
return logger.throwArgumentError("unknown type: " + type, "type", type);
};
TypedDataEncoder.prototype.encodeType = function (name) {
var result = this._types[name];
if (!result) {
logger.throwArgumentError("unknown type: " + JSON.stringify(name), "name", name);
}
return result;
};
TypedDataEncoder.prototype.encodeData = function (type, value) {
return this.getEncoder(type)(value);
};
TypedDataEncoder.prototype.hashStruct = function (name, value) {
return keccak256_1.keccak256(this.encodeData(name, value));
};
TypedDataEncoder.prototype.encode = function (value) {
return this.encodeData(this.primaryType, value);
};
TypedDataEncoder.prototype.hash = function (value) {
return this.hashStruct(this.primaryType, value);
};
TypedDataEncoder.prototype._visit = function (type, value, callback) {
var _this = this;
// Basic encoder type (address, bool, uint256, etc)
{
var encoder = getBaseEncoder(type);
if (encoder) {
return callback(type, value);
}
}
// Array
var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
var subtype_2 = match[1];
var length_2 = parseInt(match[3]);
if (length_2 >= 0 && value.length !== length_2) {
logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value);
}
return value.map(function (v) { return _this._visit(subtype_2, v, callback); });
}
// Struct
var fields = this.types[type];
if (fields) {
return fields.reduce(function (accum, _a) {
var name = _a.name, type = _a.type;
accum[name] = _this._visit(type, value[name], callback);
return accum;
}, {});
}
return logger.throwArgumentError("unknown type: " + type, "type", type);
};
TypedDataEncoder.prototype.visit = function (value, callback) {
return this._visit(this.primaryType, value, callback);
};
TypedDataEncoder.from = function (types) {
return new TypedDataEncoder(types);
};
TypedDataEncoder.getPrimaryType = function (types) {
return TypedDataEncoder.from(types).primaryType;
};
TypedDataEncoder.hashStruct = function (name, types, value) {
return TypedDataEncoder.from(types).hashStruct(name, value);
};
TypedDataEncoder.hashDomain = function (domain) {
var domainFields = [];
for (var name_3 in domain) {
var type = domainFieldTypes[name_3];
if (!type) {
logger.throwArgumentError("invalid typed-data domain key: " + JSON.stringify(name_3), "domain", domain);
}
domainFields.push({ name: name_3, type: type });
}
domainFields.sort(function (a, b) {
return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name);
});
return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain);
};
TypedDataEncoder.encode = function (domain, types, value) {
return bytes_1.hexConcat([
"0x1901",
TypedDataEncoder.hashDomain(domain),
TypedDataEncoder.from(types).hash(value)
]);
};
TypedDataEncoder.hash = function (domain, types, value) {
return keccak256_1.keccak256(TypedDataEncoder.encode(domain, types, value));
};
// Replaces all address types with ENS names with their looked up address
TypedDataEncoder.resolveNames = function (domain, types, value, resolveName) {
return __awaiter(this, void 0, void 0, function () {
var ensCache, encoder, _a, _b, _i, name_4, _c, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
// Make a copy to isolate it from the object passed in
domain = properties_1.shallowCopy(domain);
ensCache = {};
// Do we need to look up the domain's verifyingContract?
if (domain.verifyingContract && !bytes_1.isHexString(domain.verifyingContract, 20)) {
ensCache[domain.verifyingContract] = "0x";
}
encoder = TypedDataEncoder.from(types);
// Get a list of all the addresses
encoder.visit(value, function (type, value) {
if (type === "address" && !bytes_1.isHexString(value, 20)) {
ensCache[value] = "0x";
}
return value;
});
_a = [];
for (_b in ensCache)
_a.push(_b);
_i = 0;
_e.label = 1;
case 1:
if (!(_i < _a.length)) return [3 /*break*/, 4];
name_4 = _a[_i];
_c = ensCache;
_d = name_4;
return [4 /*yield*/, resolveName(name_4)];
case 2:
_c[_d] = _e.sent();
_e.label = 3;
case 3:
_i++;
return [3 /*break*/, 1];
case 4:
// Replace the domain verifyingContract if needed
if (domain.verifyingContract && ensCache[domain.verifyingContract]) {
domain.verifyingContract = ensCache[domain.verifyingContract];
}
// Replace all ENS names with their address
value = encoder.visit(value, function (type, value) {
if (type === "address" && ensCache[value]) {
return ensCache[value];
}
return value;
});
return [2 /*return*/, { domain: domain, value: value }];
}
});
});
};
TypedDataEncoder.getPayload = function (domain, types, value) {
// Validate the domain fields
TypedDataEncoder.hashDomain(domain);
// Derive the EIP712Domain Struct reference type
var domainValues = {};
var domainTypes = [];
domainFieldNames.forEach(function (name) {
var value = domain[name];
if (value == null) {
return;
}
domainValues[name] = domainChecks[name](value);
domainTypes.push({ name: name, type: domainFieldTypes[name] });
});
var encoder = TypedDataEncoder.from(types);
var typesWithDomain = properties_1.shallowCopy(types);
if (typesWithDomain.EIP712Domain) {
typesWithDomain.EIP712Domain = domainTypes;
}
// Validate the data structures and types
encoder.encode(value);
return {
types: typesWithDomain,
domain: domainValues,
primaryType: encoder.primaryType,
message: encoder.visit(value, function (type, value) {
// bytes
if (type.match(/^bytes(\d*)/)) {
return bytes_1.hexlify(bytes_1.arrayify(value));
}
// uint or int
if (type.match(/^u?int/)) {
var prefix = "";
var v = bignumber_1.BigNumber.from(value);
if (v.isNegative()) {
prefix = "-";
v = v.mul(-1);
}
return prefix + bytes_1.hexValue(v.toHexString());
}
switch (type) {
case "address":
return value.toLowerCase();
case "bool":
return !!value;
case "string":
if (typeof (value) !== "string") {
logger.throwArgumentError("invalid string", "value", value);
}
return value;
}
return logger.throwArgumentError("unsupported type", "type", type);
})
};
};
return TypedDataEncoder;
}());
exports.TypedDataEncoder = TypedDataEncoder;
//# sourceMappingURL=typed-data.js.map
-41
View File
@@ -1,41 +0,0 @@
{
"author": "Richard Moore <me@ricmoo.com>",
"dependencies": {
"@ethersproject/abstract-signer": "^5.0.6",
"@ethersproject/address": "^5.0.5",
"@ethersproject/bignumber": "^5.0.8",
"@ethersproject/bytes": "^5.0.4",
"@ethersproject/keccak256": "^5.0.3",
"@ethersproject/logger": "^5.0.5",
"@ethersproject/properties": "^5.0.4",
"@ethersproject/strings": "^5.0.4"
},
"description": "Hash utility functions for Ethereum.",
"ethereum": "donations.ethers.eth",
"gitHead": "86146650d83865d83b10867e9592923eada5d7cc",
"keywords": [
"Ethereum",
"ethers"
],
"license": "MIT",
"main": "./lib/index.js",
"module": "./lib.esm/index.js",
"name": "@ethersproject/hash",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xd3ced44284f7527cca27da2835c7eaeb117480dc6d459415ece6a672679cd538",
"types": "./lib/index.d.ts",
"version": "5.0.6"
,"_resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.0.6.tgz"
,"_integrity": "sha512-Gvh57v6BWhwnud6l7tMfQm32PRQ2DYx2WaAAQmAxAfYvmzUkpQCBstnGeNMXIL8/2wdkvcB2u+WZRWaZtsFuUQ=="
,"_from": "@ethersproject/hash@>=5.0.0-beta.128"
}
-2
View File
@@ -1,2 +0,0 @@
export const version = "keccak256/5.0.4";
//# sourceMappingURL=_version.js.map
-7
View File
@@ -1,7 +0,0 @@
"use strict";
import sha3 from "js-sha3";
import { arrayify } from "@ethersproject/bytes";
export function keccak256(data) {
return '0x' + sha3.keccak_256(arrayify(data));
}
//# sourceMappingURL=index.js.map
-4
View File
@@ -1,4 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "keccak256/5.0.4";
//# sourceMappingURL=_version.js.map
-12
View File
@@ -1,12 +0,0 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var js_sha3_1 = __importDefault(require("js-sha3"));
var bytes_1 = require("@ethersproject/bytes");
function keccak256(data) {
return '0x' + js_sha3_1.default.keccak_256(bytes_1.arrayify(data));
}
exports.keccak256 = keccak256;
//# sourceMappingURL=index.js.map
Loaded 100 of 15274 files, more files were not shown because too many files have changed in this diff. Show more