@metamask-previews/smart-transactions-controller 19.2.1-preview-54c655a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +715 -0
  2. package/LICENSE +18 -0
  3. package/README.md +103 -0
  4. package/dist/SmartTransactionsController.cjs +694 -0
  5. package/dist/SmartTransactionsController.cjs.map +1 -0
  6. package/dist/SmartTransactionsController.d.cts +150 -0
  7. package/dist/SmartTransactionsController.d.cts.map +1 -0
  8. package/dist/SmartTransactionsController.d.mts +150 -0
  9. package/dist/SmartTransactionsController.d.mts.map +1 -0
  10. package/dist/SmartTransactionsController.mjs +702 -0
  11. package/dist/SmartTransactionsController.mjs.map +1 -0
  12. package/dist/constants.cjs +33 -0
  13. package/dist/constants.cjs.map +1 -0
  14. package/dist/constants.d.cts +23 -0
  15. package/dist/constants.d.cts.map +1 -0
  16. package/dist/constants.d.mts +23 -0
  17. package/dist/constants.d.mts.map +1 -0
  18. package/dist/constants.mjs +33 -0
  19. package/dist/constants.mjs.map +1 -0
  20. package/dist/index.cjs +17 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.d.cts +6 -0
  23. package/dist/index.d.cts.map +1 -0
  24. package/dist/index.d.mts +6 -0
  25. package/dist/index.d.mts.map +1 -0
  26. package/dist/index.mjs +17 -0
  27. package/dist/index.mjs.map +1 -0
  28. package/dist/types.cjs +54 -0
  29. package/dist/types.cjs.map +1 -0
  30. package/dist/types.d.cts +118 -0
  31. package/dist/types.d.cts.map +1 -0
  32. package/dist/types.d.mts +118 -0
  33. package/dist/types.d.mts.map +1 -0
  34. package/dist/types.mjs +54 -0
  35. package/dist/types.mjs.map +1 -0
  36. package/dist/utils.cjs +281 -0
  37. package/dist/utils.cjs.map +1 -0
  38. package/dist/utils.d.cts +90 -0
  39. package/dist/utils.d.cts.map +1 -0
  40. package/dist/utils.d.mts +90 -0
  41. package/dist/utils.d.mts.map +1 -0
  42. package/dist/utils.mjs +289 -0
  43. package/dist/utils.mjs.map +1 -0
  44. package/package.json +135 -0
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright ConsenSys Software Inc. 2020. All rights reserved.
2
+
3
+ You acknowledge and agree that ConsenSys Software Inc. (“ConsenSys”) (or ConsenSys’s licensors) own all legal right, title and interest in and to the work, software, application, source code, documentation and any other documents in this repository (collectively, the “Program”), including any intellectual property rights which subsist in the Program (whether those rights happen to be registered or not, and wherever in the world those rights may exist), whether in source code or any other form.
4
+
5
+ Subject to the limited license below, you may not (and you may not permit anyone else to) distribute, publish, copy, modify, merge, combine with another program, create derivative works of, reverse engineer, decompile or otherwise attempt to extract the source code of, the Program or any part thereof, except that you may contribute to this repository.
6
+
7
+ You are granted a non-exclusive, non-transferable, non-sublicensable license to distribute, publish, copy, modify, merge, combine with another program or create derivative works of the Program (such resulting program, collectively, the “Resulting Program”) solely for Non-Commercial Use as long as you:
8
+ 1. give prominent notice (“Notice”) with each copy of the Resulting Program that the Program is used in the Resulting Program and that the Program is the copyright of ConsenSys; and
9
+ 2. subject the Resulting Program and any distribution, publication, copy, modification, merger therewith, combination with another program or derivative works thereof to the same Notice requirement and Non-Commercial Use restriction set forth herein.
10
+
11
+ “Non-Commercial Use” means each use as described in clauses (1)-(3) below, as reasonably determined by ConsenSys in its sole discretion:
12
+ 1. personal use for research, personal study, private entertainment, hobby projects or amateur pursuits, in each case without any anticipated commercial application;
13
+ 2. use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization or government institution; or
14
+ 3. the number of monthly active users of the Resulting Program across all versions thereof and platforms globally do not exceed 10,000 at any time.
15
+
16
+ You will not use any trade mark, service mark, trade name, logo of ConsenSys or any other company or organization in a way that is likely or intended to cause confusion about the owner or authorized user of such marks, names or logos.
17
+
18
+ If you have any questions, comments or interest in pursuing any other use cases, please reach out to us at metamask.license@consensys.net.
package/README.md ADDED
@@ -0,0 +1,103 @@
1
+ # `@metamask/smart-transactions-controller`
2
+
3
+ Improves success rates for swaps by trialing transactions privately and finding minimum fees.
4
+
5
+ ## Installation
6
+
7
+ `yarn add @metamask/smart-transactions-controller`
8
+
9
+ or
10
+
11
+ `npm install @metamask/smart-transactions-controller`
12
+
13
+ ## Contributing
14
+
15
+ ### Setup
16
+
17
+ - Install the current LTS version of [Node.js](https://nodejs.org)
18
+ - If you are using [nvm](https://github.com/creationix/nvm#installation) (recommended) running `nvm install` will install the latest suitable version and running `nvm use` will automatically choose the right node version for you.
19
+ - Install [Yarn v3](https://yarnpkg.com/getting-started/install)
20
+ - Run `yarn install` to install dependencies and run any required post-install scripts
21
+
22
+ ### Testing and Linting
23
+
24
+ Run `yarn test` to run the tests once. To run tests on file changes, run `yarn test:watch`.
25
+
26
+ Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.
27
+
28
+ ### Release & Publishing
29
+
30
+ The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) and [`action-publish-release`](https://github.com/MetaMask/action-publish-release) are used to automate the release process; see those repositories for more information about how they work.
31
+
32
+ 1. Choose a release version.
33
+
34
+ - The release version should be chosen according to SemVer. Analyze the changes to see whether they include any breaking changes, new features, or deprecations, then choose the appropriate SemVer version. See [the SemVer specification](https://semver.org/) for more information.
35
+
36
+ 2. If this release is backporting changes onto a previous release, then ensure there is a major version branch for that version (e.g. `1.x` for a `v1` backport release).
37
+
38
+ - The major version branch should be set to the most recent release with that major version. For example, when backporting a `v1.0.2` release, you'd want to ensure there was a `1.x` branch that was set to the `v1.0.1` tag.
39
+
40
+ 3. Trigger the [`workflow_dispatch`](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch) event [manually](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) for the `Create Release Pull Request` action to create the release PR.
41
+
42
+ - For a backport release, the base branch should be the major version branch that you ensured existed in step 2. For a normal release, the base branch should be the main branch for that repository (which should be the default value).
43
+ - This should trigger the [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) workflow to create the release PR.
44
+
45
+ 4. Update the changelog to move each change entry into the appropriate change category ([See here](https://keepachangelog.com/en/1.0.0/#types) for the full list of change categories, and the correct ordering), and edit them to be more easily understood by users of the package.
46
+
47
+ - Generally any changes that don't affect consumers of the package (e.g. lockfile changes or development environment changes) are omitted. Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
48
+ - Try to explain each change in terms that users of the package would understand (e.g. avoid referencing internal variables/concepts).
49
+ - Consolidate related changes into one change entry if it makes it easier to explain.
50
+ - Run `yarn auto-changelog validate --rc` to check that the changelog is correctly formatted.
51
+
52
+ 5. Review and QA the release.
53
+
54
+ - If changes are made to the base branch, the release branch will need to be updated with these changes and review/QA will need to restart again. As such, it's probably best to avoid merging other PRs into the base branch while review is underway.
55
+
56
+ 6. Squash & Merge the release.
57
+
58
+ - This should trigger the [`action-publish-release`](https://github.com/MetaMask/action-publish-release) workflow to tag the final release commit and publish the release on GitHub.
59
+
60
+ 7. Publish the release on npm.
61
+
62
+ - Wait for the `publish-release` GitHub Action workflow to finish. This should trigger a second job (`publish-npm`), which will wait for a run approval by the [`npm publishers`](https://github.com/orgs/MetaMask/teams/npm-publishers) team.
63
+ - Approve the `publish-npm` job (or ask somebody on the npm publishers team to approve it for you).
64
+ - Once the `publish-npm` job has finished, check npm to verify that it has been published.
65
+
66
+ ### Testing changes in other projects using preview builds
67
+
68
+ If you are working on a pull request and want to test changes in another project before you publish them, you can create a _preview build_ and then configure your project to use it.
69
+
70
+ #### Creating a preview build
71
+
72
+ 1. Within your pull request, post a comment with the text `@metamaskbot publish-preview`. This starts the `publish-preview` GitHub action, which will create a preview build and publish it to NPM.
73
+ 2. After a few minutes, the action should complete and you will see a new comment. Note two things:
74
+ - The name is scoped to `@metamask-previews` instead of `@metamask`.
75
+ - The ID of the last commit in the branch is appended to the version, e.g. `1.2.3-preview-e2df9b4` instead of `1.2.3`.
76
+
77
+ #### Using a preview build
78
+
79
+ To use a preview build within a project, you need to override the resolution logic for your package manager so that the "production" version of that package is replaced with the preview version. Here's how you do that:
80
+
81
+ 1. Open `package.json` in the project and locate the entry for this package in `dependencies`.
82
+ 2. Locate the section responsible for resolution overrides (or create it if it doesn't exist). If you're using Yarn, this is `resolutions`; if you're using NPM or any other package manager, this is `overrides`.
83
+ 3. Add a line to this section that mirrors the dependency entry on the left-hand side and points to the preview version on the right-hand side. Note the exact format of the left-hand side will differ based on which version of Yarn or NPM you are using. For example:
84
+ - For Yarn Modern, you will add something like this to `resolutions`:
85
+ ```
86
+ "@metamask/smart-transactions-controller@^1.2.3": "npm:@metamask-previews/smart-transactions-controller@1.2.3-preview-abcdefg"
87
+ ```
88
+ - For Yarn Classic, you will add something like this to `resolutions`:
89
+ ```
90
+ "@metamask/smart-transactions-controller": "npm:@metamask-previews/smart-transactions-controller@1.2.3-preview-abcdefg"
91
+ ```
92
+ - For NPM, you will add something like this to `overrides`:
93
+ ```
94
+ "@metamask/smart-transactions-controller": "npm:@metamask-previews/smart-transactions-controller@1.2.3-preview-abcdefg"
95
+ ```
96
+ 4. Run `yarn install`.
97
+
98
+ #### Updating a preview build
99
+
100
+ If you make more changes to your pull request and want to create a new preview build:
101
+
102
+ 1. Post another `@metamaskbot` comment on the pull request and wait for the response.
103
+ 2. Update the version of the preview build in your project's `package.json`. Make sure to re-run `yarn install`!