defuse-py 0.1.0__tar.gz

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "WebFetch(domain:1click.chaindefuser.com)"
5
+ ]
6
+ }
7
+ }
@@ -0,0 +1,4 @@
1
+ .venv
2
+ venv
3
+ *.pyc
4
+ __pycache__
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.venv" />
6
+ </content>
7
+ <orderEntry type="jdk" jdkName="Python 3.10 (IntentsPy)" jdkType="Python SDK" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ <component name="PyDocumentationSettings">
11
+ <option name="format" value="GOOGLE" />
12
+ <option name="myDocStringFormat" value="Google" />
13
+ </component>
14
+ </module>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="DiscordProjectSettings">
4
+ <option name="show" value="PROJECT_FILES" />
5
+ <option name="description" value="" />
6
+ <option name="applicationTheme" value="default" />
7
+ <option name="iconsTheme" value="default" />
8
+ <option name="button1Title" value="" />
9
+ <option name="button1Url" value="" />
10
+ <option name="button2Title" value="" />
11
+ <option name="button2Url" value="" />
12
+ <option name="customApplicationId" value="" />
13
+ </component>
14
+ </project>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.10 (IntentsPy)" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (IntentsPy)" project-jdk-type="Python SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/IntentsPy.iml" filepath="$PROJECT_DIR$/.idea/IntentsPy.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,263 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="ChangeListManager">
7
+ <list default="true" id="14750bdc-ebdd-4543-996d-09003e230923" name="Changes" comment="Fix urls" />
8
+ <option name="SHOW_DIALOG" value="false" />
9
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
10
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
11
+ <option name="LAST_RESOLUTION" value="IGNORE" />
12
+ </component>
13
+ <component name="Git.Settings">
14
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
15
+ </component>
16
+ <component name="GitHubPullRequestSearchHistory">{
17
+ &quot;lastFilter&quot;: {
18
+ &quot;state&quot;: &quot;OPEN&quot;,
19
+ &quot;assignee&quot;: &quot;er&quot;
20
+ }
21
+ }</component>
22
+ <component name="GithubPullRequestsUISettings">{
23
+ &quot;selectedUrlAndAccountId&quot;: {
24
+ &quot;url&quot;: &quot;https://github.com/er/defuse.py.git&quot;,
25
+ &quot;accountId&quot;: &quot;a5a50ebf-b784-45a0-a0b7-b9141d289abe&quot;
26
+ }
27
+ }</component>
28
+ <component name="ProjectColorInfo">{
29
+ &quot;associatedIndex&quot;: 2
30
+ }</component>
31
+ <component name="ProjectId" id="3BDA7CD5ES9PfJilJb895R5yhQn" />
32
+ <component name="ProjectViewState">
33
+ <option name="hideEmptyMiddlePackages" value="true" />
34
+ <option name="showLibraryContents" value="true" />
35
+ </component>
36
+ <component name="PropertiesComponent"><![CDATA[{
37
+ "keyToString": {
38
+ "ModuleVcsDetector.initialDetectionPerformed": "true",
39
+ "Python.dry_quote.executor": "Run",
40
+ "Python.list_tokens.executor": "Run",
41
+ "Python.smoke_test.executor": "Run",
42
+ "Python.swap.executor": "Run",
43
+ "RunOnceActivity.ShowReadmeOnStart": "true",
44
+ "RunOnceActivity.git.unshallow": "true",
45
+ "git-widget-placeholder": "main",
46
+ "ignore.virus.scanning.warn.message": "true",
47
+ "last_opened_file_path": "C:/Users/Vigou/Dev/IntentsPy",
48
+ "node.js.detected.package.eslint": "true",
49
+ "node.js.detected.package.tslint": "true",
50
+ "node.js.selected.package.eslint": "(autodetect)",
51
+ "node.js.selected.package.tslint": "(autodetect)",
52
+ "nodejs_package_manager_path": "npm",
53
+ "settings.editor.selected.configurable": "discord-project",
54
+ "ts.external.directory.path": "C:\\Program Files\\JetBrains\\PyCharm 2025.1.1.1\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external",
55
+ "vue.rearranger.settings.migration": "true"
56
+ }
57
+ }]]></component>
58
+ <component name="RecentsManager">
59
+ <key name="CopyFile.RECENT_KEYS">
60
+ <recent name="C:\Users\Vigou\Dev\IntentsPy\ts-sdk" />
61
+ </key>
62
+ </component>
63
+ <component name="RunManager" selected="Python.dry_quote">
64
+ <configuration name="dry_quote" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
65
+ <module name="IntentsPy" />
66
+ <option name="ENV_FILES" value="" />
67
+ <option name="INTERPRETER_OPTIONS" value="" />
68
+ <option name="PARENT_ENVS" value="true" />
69
+ <envs>
70
+ <env name="PYTHONUNBUFFERED" value="1" />
71
+ </envs>
72
+ <option name="SDK_HOME" value="" />
73
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/examples" />
74
+ <option name="IS_MODULE_SDK" value="true" />
75
+ <option name="ADD_CONTENT_ROOTS" value="true" />
76
+ <option name="ADD_SOURCE_ROOTS" value="true" />
77
+ <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
78
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/examples/dry_quote.py" />
79
+ <option name="PARAMETERS" value="" />
80
+ <option name="SHOW_COMMAND_LINE" value="false" />
81
+ <option name="EMULATE_TERMINAL" value="false" />
82
+ <option name="MODULE_MODE" value="false" />
83
+ <option name="REDIRECT_INPUT" value="false" />
84
+ <option name="INPUT_FILE" value="" />
85
+ <method v="2" />
86
+ </configuration>
87
+ <configuration name="list_tokens" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
88
+ <module name="IntentsPy" />
89
+ <option name="ENV_FILES" value="" />
90
+ <option name="INTERPRETER_OPTIONS" value="" />
91
+ <option name="PARENT_ENVS" value="true" />
92
+ <envs>
93
+ <env name="PYTHONUNBUFFERED" value="1" />
94
+ </envs>
95
+ <option name="SDK_HOME" value="" />
96
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/examples" />
97
+ <option name="IS_MODULE_SDK" value="true" />
98
+ <option name="ADD_CONTENT_ROOTS" value="true" />
99
+ <option name="ADD_SOURCE_ROOTS" value="true" />
100
+ <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
101
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/examples/list_tokens.py" />
102
+ <option name="PARAMETERS" value="" />
103
+ <option name="SHOW_COMMAND_LINE" value="false" />
104
+ <option name="EMULATE_TERMINAL" value="false" />
105
+ <option name="MODULE_MODE" value="false" />
106
+ <option name="REDIRECT_INPUT" value="false" />
107
+ <option name="INPUT_FILE" value="" />
108
+ <method v="2" />
109
+ </configuration>
110
+ <configuration name="smoke_test" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
111
+ <module name="IntentsPy" />
112
+ <option name="ENV_FILES" value="" />
113
+ <option name="INTERPRETER_OPTIONS" value="" />
114
+ <option name="PARENT_ENVS" value="true" />
115
+ <envs>
116
+ <env name="PYTHONUNBUFFERED" value="1" />
117
+ </envs>
118
+ <option name="SDK_HOME" value="" />
119
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
120
+ <option name="IS_MODULE_SDK" value="true" />
121
+ <option name="ADD_CONTENT_ROOTS" value="true" />
122
+ <option name="ADD_SOURCE_ROOTS" value="true" />
123
+ <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
124
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/smoke_test.py" />
125
+ <option name="PARAMETERS" value="" />
126
+ <option name="SHOW_COMMAND_LINE" value="false" />
127
+ <option name="EMULATE_TERMINAL" value="false" />
128
+ <option name="MODULE_MODE" value="false" />
129
+ <option name="REDIRECT_INPUT" value="false" />
130
+ <option name="INPUT_FILE" value="" />
131
+ <method v="2" />
132
+ </configuration>
133
+ <configuration name="swap" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
134
+ <module name="IntentsPy" />
135
+ <option name="ENV_FILES" value="" />
136
+ <option name="INTERPRETER_OPTIONS" value="" />
137
+ <option name="PARENT_ENVS" value="true" />
138
+ <envs>
139
+ <env name="PYTHONUNBUFFERED" value="1" />
140
+ </envs>
141
+ <option name="SDK_HOME" value="" />
142
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/examples" />
143
+ <option name="IS_MODULE_SDK" value="true" />
144
+ <option name="ADD_CONTENT_ROOTS" value="true" />
145
+ <option name="ADD_SOURCE_ROOTS" value="true" />
146
+ <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
147
+ <option name="SCRIPT_NAME" value="$PROJECT_DIR$/examples/swap.py" />
148
+ <option name="PARAMETERS" value="" />
149
+ <option name="SHOW_COMMAND_LINE" value="false" />
150
+ <option name="EMULATE_TERMINAL" value="false" />
151
+ <option name="MODULE_MODE" value="false" />
152
+ <option name="REDIRECT_INPUT" value="false" />
153
+ <option name="INPUT_FILE" value="" />
154
+ <method v="2" />
155
+ </configuration>
156
+ <recent_temporary>
157
+ <list>
158
+ <item itemvalue="Python.dry_quote" />
159
+ <item itemvalue="Python.swap" />
160
+ <item itemvalue="Python.list_tokens" />
161
+ <item itemvalue="Python.smoke_test" />
162
+ </list>
163
+ </recent_temporary>
164
+ </component>
165
+ <component name="SharedIndexes">
166
+ <attachedChunks>
167
+ <set>
168
+ <option value="bundled-python-sdk-48aec45f0201-746f403e7f0c-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-241.17011.127" />
169
+ </set>
170
+ </attachedChunks>
171
+ </component>
172
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
173
+ <component name="TaskManager">
174
+ <task active="true" id="Default" summary="Default task">
175
+ <changelist id="14750bdc-ebdd-4543-996d-09003e230923" name="Changes" comment="" />
176
+ <created>1774013101937</created>
177
+ <option name="number" value="Default" />
178
+ <option name="presentableId" value="Default" />
179
+ <updated>1774013101937</updated>
180
+ <workItem from="1774013103358" duration="13680000" />
181
+ <workItem from="1774483641528" duration="846000" />
182
+ <workItem from="1774741789230" duration="1230000" />
183
+ </task>
184
+ <task id="LOCAL-00001" summary="Initial commit">
185
+ <option name="closed" value="true" />
186
+ <created>1774022663923</created>
187
+ <option name="number" value="00001" />
188
+ <option name="presentableId" value="LOCAL-00001" />
189
+ <option name="project" value="LOCAL" />
190
+ <updated>1774022663923</updated>
191
+ </task>
192
+ <task id="LOCAL-00002" summary="Initial commit">
193
+ <option name="closed" value="true" />
194
+ <created>1774024973664</created>
195
+ <option name="number" value="00002" />
196
+ <option name="presentableId" value="LOCAL-00002" />
197
+ <option name="project" value="LOCAL" />
198
+ <updated>1774024973664</updated>
199
+ </task>
200
+ <task id="LOCAL-00003" summary="Fix wheel">
201
+ <option name="closed" value="true" />
202
+ <created>1774025193376</created>
203
+ <option name="number" value="00003" />
204
+ <option name="presentableId" value="LOCAL-00003" />
205
+ <option name="project" value="LOCAL" />
206
+ <updated>1774025193376</updated>
207
+ </task>
208
+ <task id="LOCAL-00004" summary="Add gitignore">
209
+ <option name="closed" value="true" />
210
+ <created>1774032405356</created>
211
+ <option name="number" value="00004" />
212
+ <option name="presentableId" value="LOCAL-00004" />
213
+ <option name="project" value="LOCAL" />
214
+ <updated>1774032405356</updated>
215
+ </task>
216
+ <task id="LOCAL-00005" summary="Update docstrings, add README.md">
217
+ <option name="closed" value="true" />
218
+ <created>1774037510702</created>
219
+ <option name="number" value="00005" />
220
+ <option name="presentableId" value="LOCAL-00005" />
221
+ <option name="project" value="LOCAL" />
222
+ <updated>1774037510702</updated>
223
+ </task>
224
+ <task id="LOCAL-00006" summary="Fix urls">
225
+ <option name="closed" value="true" />
226
+ <created>1774743637197</created>
227
+ <option name="number" value="00006" />
228
+ <option name="presentableId" value="LOCAL-00006" />
229
+ <option name="project" value="LOCAL" />
230
+ <updated>1774743637197</updated>
231
+ </task>
232
+ <option name="localTasksCounter" value="7" />
233
+ <servers />
234
+ </component>
235
+ <component name="TypeScriptGeneratedFilesManager">
236
+ <option name="version" value="3" />
237
+ </component>
238
+ <component name="Vcs.Log.Tabs.Properties">
239
+ <option name="TAB_STATES">
240
+ <map>
241
+ <entry key="MAIN">
242
+ <value>
243
+ <State />
244
+ </value>
245
+ </entry>
246
+ </map>
247
+ </option>
248
+ </component>
249
+ <component name="VcsManagerConfiguration">
250
+ <MESSAGE value="Initial commit" />
251
+ <MESSAGE value="Fix wheel" />
252
+ <MESSAGE value="Add gitignore" />
253
+ <MESSAGE value="Update docstrings, add README.md" />
254
+ <MESSAGE value="Fix urls" />
255
+ <option name="LAST_COMMIT_MESSAGE" value="Fix urls" />
256
+ </component>
257
+ <component name="com.intellij.coverage.CoverageDataManagerImpl">
258
+ <SUITE FILE_PATH="coverage/IntentsPy$swap.coverage" NAME="swap Coverage Results" MODIFIED="1774020624562" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples" />
259
+ <SUITE FILE_PATH="coverage/IntentsPy$smoke_test.coverage" NAME="smoke_test Coverage Results" MODIFIED="1774018766554" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
260
+ <SUITE FILE_PATH="coverage/IntentsPy$dry_quote.coverage" NAME="dry_quote Coverage Results" MODIFIED="1774483819617" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples" />
261
+ <SUITE FILE_PATH="coverage/IntentsPy$list_tokens.coverage" NAME="list_tokens Coverage Results" MODIFIED="1774020470380" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="false" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/examples" />
262
+ </component>
263
+ </project>
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 er
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,181 @@
1
+ Metadata-Version: 2.4
2
+ Name: defuse-py
3
+ Version: 0.1.0
4
+ Summary: Async Python wrapper for the NEAR Intents 1Click Swap API
5
+ Project-URL: Homepage, https://github.com/er/defuse.py
6
+ Project-URL: Repository, https://github.com/er/defuse.py
7
+ License: MIT License
8
+
9
+ Copyright (c) 2026 er
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+ License-File: LICENSE
29
+ Requires-Python: >=3.10
30
+ Requires-Dist: httpx>=0.27
31
+ Requires-Dist: pydantic>=2.0
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
34
+ Requires-Dist: pytest>=8.0; extra == 'dev'
35
+ Requires-Dist: respx>=0.21; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # defuse.py
39
+
40
+ An async Python wrapper for the [NEAR Intents 1Click Swap API](https://1click.chaindefuser.com).
41
+
42
+ ```
43
+ pip install defuse-py
44
+ ```
45
+
46
+ ## Requirements
47
+
48
+ - Python 3.10+
49
+ - `httpx`
50
+ - `pydantic`
51
+
52
+ ## Quickstart
53
+
54
+ ```python
55
+ import asyncio
56
+ from defuse import IntentsClient, find_token
57
+
58
+ async def main():
59
+ async with IntentsClient() as client:
60
+ tokens = await client.get_tokens()
61
+ eth = find_token(tokens, "eth", "ETH")
62
+ print(eth.asset_id) # nep141:eth.omft.near
63
+
64
+ asyncio.run(main())
65
+ ```
66
+
67
+ ## Swap flow
68
+
69
+ ```python
70
+ import asyncio
71
+ from datetime import datetime, timedelta, timezone
72
+ from defuse import (
73
+ IntentsClient,
74
+ QuoteRequest,
75
+ SwapType,
76
+ DepositType,
77
+ RecipientType,
78
+ RefundType,
79
+ SwapStatus,
80
+ find_token,
81
+ token_to_atomic,
82
+ )
83
+
84
+ async def main():
85
+ async with IntentsClient(jwt_token="your-jwt-token") as client:
86
+ tokens = await client.get_tokens()
87
+ eth = find_token(tokens, "eth", "ETH")
88
+ usdc = find_token(tokens, "arb", "USDC")
89
+
90
+ # 1. Get a quote
91
+ response = await client.get_quote(QuoteRequest(
92
+ dry=False,
93
+ swap_type=SwapType.EXACT_INPUT,
94
+ slippage_tolerance=100, # 1% — use pct_to_bps(1) for clarity
95
+ origin_asset=eth.asset_id,
96
+ destination_asset=usdc.asset_id,
97
+ deposit_type=DepositType.ORIGIN_CHAIN,
98
+ amount=token_to_atomic("0.01", eth),
99
+ refund_to="0xYourAddress",
100
+ refund_type=RefundType.ORIGIN_CHAIN,
101
+ recipient="0xYourAddress",
102
+ recipient_type=RecipientType.DESTINATION_CHAIN,
103
+ deadline=datetime.now(timezone.utc) + timedelta(hours=1),
104
+ ))
105
+
106
+ quote = response.quote
107
+ print(f"Send {quote.amount_in_formatted} ETH to {quote.deposit_address}")
108
+ if quote.deposit_memo:
109
+ print(f"Memo (required): {quote.deposit_memo}")
110
+
111
+ # 2. Send funds to quote.deposit_address, then poll for status
112
+ while True:
113
+ status = await client.get_status(quote.deposit_address, quote.deposit_memo)
114
+ print(status.status)
115
+ if status.status in {SwapStatus.SUCCESS, SwapStatus.REFUNDED, SwapStatus.FAILED}:
116
+ break
117
+ await asyncio.sleep(10)
118
+
119
+ asyncio.run(main())
120
+ ```
121
+
122
+ ## Authentication
123
+
124
+ Most endpoints require a JWT token. Pass it when constructing the client:
125
+
126
+ ```python
127
+ client = IntentsClient(jwt_token="your-jwt-token")
128
+ ```
129
+
130
+ ## API reference
131
+
132
+ ### `IntentsClient`
133
+
134
+ | Method | Description |
135
+ |---|---|
136
+ | `get_tokens()` | List all supported tokens |
137
+ | `get_quote(request)` | Request a swap quote |
138
+ | `get_status(deposit_address, deposit_memo?)` | Check swap status |
139
+ | `get_any_input_withdrawals(deposit_address, ...)` | Get withdrawals for an `ANY_INPUT` quote |
140
+ | `submit_deposit(request)` | Notify the service a deposit has been sent |
141
+
142
+ ### Utilities
143
+
144
+ | Function | Description |
145
+ |---|---|
146
+ | `find_token(tokens, blockchain, symbol)` | Look up a token by chain and symbol |
147
+ | `to_atomic(amount, decimals)` | Convert `0.1` → `"100000000000000000"` |
148
+ | `from_atomic(amount, decimals)` | Convert `"100000000000000000"` → `Decimal("0.1")` |
149
+ | `token_to_atomic(amount, token)` | `to_atomic` using a `TokenResponse` |
150
+ | `token_from_atomic(amount, token)` | `from_atomic` using a `TokenResponse` |
151
+ | `pct_to_bps(percent)` | Convert `1` (%) → `100` (bps) |
152
+ | `bps_to_pct(bps)` | Convert `100` (bps) → `Decimal("1")` (%) |
153
+
154
+ ### Swap types
155
+
156
+ | Value | Behaviour |
157
+ |---|---|
158
+ | `EXACT_INPUT` | Specify input amount, receive calculated output |
159
+ | `EXACT_OUTPUT` | Specify output amount, deposit calculated input |
160
+ | `FLEX_INPUT` | Variable input with slippage bounds |
161
+ | `ANY_INPUT` | Multiple partial deposits over time |
162
+
163
+ ### Swap statuses
164
+
165
+ `KNOWN_DEPOSIT_TX` → `PENDING_DEPOSIT` → `PROCESSING` → `SUCCESS`
166
+
167
+ Terminal states: `SUCCESS`, `REFUNDED`, `FAILED`
168
+
169
+ ## Examples
170
+
171
+ See the [`examples/`](examples/) directory:
172
+
173
+ - [`list_tokens.py`](examples/list_tokens.py) — fetch and display all supported tokens
174
+ - [`dry_quote.py`](examples/dry_quote.py) — preview a swap without creating a deposit address
175
+ - [`swap.py`](examples/swap.py) — full swap lifecycle with status polling
176
+ - [`submit_deposit.py`](examples/submit_deposit.py) — notify the service after sending funds
177
+ - [`any_input_withdrawals.py`](examples/any_input_withdrawals.py) — fetch `ANY_INPUT` withdrawals
178
+
179
+ ## License
180
+
181
+ MIT