This SDK will be open for contributions from the community. Contribution guidelines will be added soon!
This library is currently in the developer preview phase (versions 0.x.x). There will be significant changes to the design of this library leading up to a 1.0.0 release. You can expect the API calls, library structure, etc. to break between each release. Once the library version reaches 1.0.0 and beyond, it will follow traditional semver conventions.
This SDK is powered by a client struct that contains instances of all Services used to talk to the 1inch APIs
Each Service maps 1-to-1 with the underlying Dev Portal REST API. See SwapService as an example. Under each function, you will find the matching REST API path)
Each Service uses various types and functions to do its job that are kept separate from the main service file. These can be found in the accompanying folder within the client directory (see the swap package)
Type generation is done using the generate_types.sh
script. To add a new openapi file or update an existing one, place
the openapi file in openapi
and run the script from the root of the project. It will generate the types files for all openapi specs and place them in the
appropriately-named sub-folder inside the generatedtypes
directory.
For consistency, openapi files should be formatted with prettier
This can be installed globally using npm:
npm install -g prettier
If using GoLand, you can set up this action to run automatically using File Watchers:
- Go to Settings or Preferences > Tools > File Watchers.
- Click the + button to add a new watcher.
- For
File type
, choose JSON. - For
Scope
, choose Project Files. - For
Program
, provide the path to theprettier
. This can be gotten by runningwhich prettier
. - For
Arguments
, use--write $FilePath$
. - For
Output paths to refresh
, use$FilePath$
. - Ensure the Auto-save edited files to trigger the watcher option is checked