@lifi/sdk-provider-tron 0.0.0-preview-f5cf9f8
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.
- package/CHANGELOG.md +10 -0
- package/LICENSE +201 -0
- package/README.md +79 -0
- package/dist/cjs/TronProvider.d.ts +7 -0
- package/dist/cjs/TronProvider.js +33 -0
- package/dist/cjs/TronProvider.js.map +1 -0
- package/dist/cjs/actions/getMulticallAddress.d.ts +7 -0
- package/dist/cjs/actions/getMulticallAddress.js +10 -0
- package/dist/cjs/actions/getMulticallAddress.js.map +1 -0
- package/dist/cjs/actions/getTronBalance.d.ts +7 -0
- package/dist/cjs/actions/getTronBalance.js +92 -0
- package/dist/cjs/actions/getTronBalance.js.map +1 -0
- package/dist/cjs/actions/resolveTronAddress.d.ts +5 -0
- package/dist/cjs/actions/resolveTronAddress.js +9 -0
- package/dist/cjs/actions/resolveTronAddress.js.map +1 -0
- package/dist/cjs/core/TronStepExecutor.d.ts +15 -0
- package/dist/cjs/core/TronStepExecutor.js +52 -0
- package/dist/cjs/core/TronStepExecutor.js.map +1 -0
- package/dist/cjs/core/constants.d.ts +8 -0
- package/dist/cjs/core/constants.js +13 -0
- package/dist/cjs/core/constants.js.map +1 -0
- package/dist/cjs/core/tasks/TronCheckAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/TronCheckAllowanceTask.js +37 -0
- package/dist/cjs/core/tasks/TronCheckAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/TronSetAllowanceTask.d.ts +11 -0
- package/dist/cjs/core/tasks/TronSetAllowanceTask.js +67 -0
- package/dist/cjs/core/tasks/TronSetAllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/TronSignAndExecuteTask.d.ts +10 -0
- package/dist/cjs/core/tasks/TronSignAndExecuteTask.js +39 -0
- package/dist/cjs/core/tasks/TronSignAndExecuteTask.js.map +1 -0
- package/dist/cjs/core/tasks/TronWaitForTransactionTask.d.ts +10 -0
- package/dist/cjs/core/tasks/TronWaitForTransactionTask.js +31 -0
- package/dist/cjs/core/tasks/TronWaitForTransactionTask.js.map +1 -0
- package/dist/cjs/errors/parseTronErrors.d.ts +7 -0
- package/dist/cjs/errors/parseTronErrors.js +31 -0
- package/dist/cjs/errors/parseTronErrors.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/rpc/callTronRpcsWithRetry.d.ts +10 -0
- package/dist/cjs/rpc/callTronRpcsWithRetry.js +27 -0
- package/dist/cjs/rpc/callTronRpcsWithRetry.js.map +1 -0
- package/dist/cjs/rpc/waitForTronTxConfirmation.d.ts +17 -0
- package/dist/cjs/rpc/waitForTronTxConfirmation.js +30 -0
- package/dist/cjs/rpc/waitForTronTxConfirmation.js.map +1 -0
- package/dist/cjs/types.d.ts +26 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/address.d.ts +6 -0
- package/dist/cjs/utils/address.js +16 -0
- package/dist/cjs/utils/address.js.map +1 -0
- package/dist/cjs/utils/getTronTxLink.d.ts +7 -0
- package/dist/cjs/utils/getTronTxLink.js +11 -0
- package/dist/cjs/utils/getTronTxLink.js.map +1 -0
- package/dist/cjs/utils/isZeroAddress.d.ts +7 -0
- package/dist/cjs/utils/isZeroAddress.js +11 -0
- package/dist/cjs/utils/isZeroAddress.js.map +1 -0
- package/dist/cjs/utils/multicall3Abi.d.ts +7 -0
- package/dist/cjs/utils/multicall3Abi.js +61 -0
- package/dist/cjs/utils/multicall3Abi.js.map +1 -0
- package/dist/cjs/utils/stripHexPrefix.d.ts +5 -0
- package/dist/cjs/utils/stripHexPrefix.js +7 -0
- package/dist/cjs/utils/stripHexPrefix.js.map +1 -0
- package/dist/cjs/version.d.ts +6 -0
- package/dist/cjs/version.js +9 -0
- package/dist/cjs/version.js.map +1 -0
- package/dist/esm/TronProvider.d.ts +7 -0
- package/dist/esm/TronProvider.d.ts.map +1 -0
- package/dist/esm/TronProvider.js +32 -0
- package/dist/esm/TronProvider.js.map +1 -0
- package/dist/esm/actions/getMulticallAddress.d.ts +7 -0
- package/dist/esm/actions/getMulticallAddress.d.ts.map +1 -0
- package/dist/esm/actions/getMulticallAddress.js +9 -0
- package/dist/esm/actions/getMulticallAddress.js.map +1 -0
- package/dist/esm/actions/getTronBalance.d.ts +7 -0
- package/dist/esm/actions/getTronBalance.d.ts.map +1 -0
- package/dist/esm/actions/getTronBalance.js +91 -0
- package/dist/esm/actions/getTronBalance.js.map +1 -0
- package/dist/esm/actions/resolveTronAddress.d.ts +5 -0
- package/dist/esm/actions/resolveTronAddress.d.ts.map +1 -0
- package/dist/esm/actions/resolveTronAddress.js +8 -0
- package/dist/esm/actions/resolveTronAddress.js.map +1 -0
- package/dist/esm/core/TronStepExecutor.d.ts +15 -0
- package/dist/esm/core/TronStepExecutor.d.ts.map +1 -0
- package/dist/esm/core/TronStepExecutor.js +51 -0
- package/dist/esm/core/TronStepExecutor.js.map +1 -0
- package/dist/esm/core/constants.d.ts +8 -0
- package/dist/esm/core/constants.d.ts.map +1 -0
- package/dist/esm/core/constants.js +9 -0
- package/dist/esm/core/constants.js.map +1 -0
- package/dist/esm/core/tasks/TronCheckAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/TronCheckAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/TronCheckAllowanceTask.js +36 -0
- package/dist/esm/core/tasks/TronCheckAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/TronSetAllowanceTask.d.ts +11 -0
- package/dist/esm/core/tasks/TronSetAllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/TronSetAllowanceTask.js +66 -0
- package/dist/esm/core/tasks/TronSetAllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/TronSignAndExecuteTask.d.ts +10 -0
- package/dist/esm/core/tasks/TronSignAndExecuteTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/TronSignAndExecuteTask.js +38 -0
- package/dist/esm/core/tasks/TronSignAndExecuteTask.js.map +1 -0
- package/dist/esm/core/tasks/TronWaitForTransactionTask.d.ts +10 -0
- package/dist/esm/core/tasks/TronWaitForTransactionTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/TronWaitForTransactionTask.js +30 -0
- package/dist/esm/core/tasks/TronWaitForTransactionTask.js.map +1 -0
- package/dist/esm/errors/parseTronErrors.d.ts +7 -0
- package/dist/esm/errors/parseTronErrors.d.ts.map +1 -0
- package/dist/esm/errors/parseTronErrors.js +30 -0
- package/dist/esm/errors/parseTronErrors.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/rpc/callTronRpcsWithRetry.d.ts +10 -0
- package/dist/esm/rpc/callTronRpcsWithRetry.d.ts.map +1 -0
- package/dist/esm/rpc/callTronRpcsWithRetry.js +25 -0
- package/dist/esm/rpc/callTronRpcsWithRetry.js.map +1 -0
- package/dist/esm/rpc/waitForTronTxConfirmation.d.ts +17 -0
- package/dist/esm/rpc/waitForTronTxConfirmation.d.ts.map +1 -0
- package/dist/esm/rpc/waitForTronTxConfirmation.js +29 -0
- package/dist/esm/rpc/waitForTronTxConfirmation.js.map +1 -0
- package/dist/esm/types.d.ts +26 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/address.d.ts +6 -0
- package/dist/esm/utils/address.d.ts.map +1 -0
- package/dist/esm/utils/address.js +14 -0
- package/dist/esm/utils/address.js.map +1 -0
- package/dist/esm/utils/getTronTxLink.d.ts +7 -0
- package/dist/esm/utils/getTronTxLink.d.ts.map +1 -0
- package/dist/esm/utils/getTronTxLink.js +10 -0
- package/dist/esm/utils/getTronTxLink.js.map +1 -0
- package/dist/esm/utils/isZeroAddress.d.ts +7 -0
- package/dist/esm/utils/isZeroAddress.d.ts.map +1 -0
- package/dist/esm/utils/isZeroAddress.js +8 -0
- package/dist/esm/utils/isZeroAddress.js.map +1 -0
- package/dist/esm/utils/multicall3Abi.d.ts +7 -0
- package/dist/esm/utils/multicall3Abi.d.ts.map +1 -0
- package/dist/esm/utils/multicall3Abi.js +60 -0
- package/dist/esm/utils/multicall3Abi.js.map +1 -0
- package/dist/esm/utils/stripHexPrefix.d.ts +5 -0
- package/dist/esm/utils/stripHexPrefix.d.ts.map +1 -0
- package/dist/esm/utils/stripHexPrefix.js +6 -0
- package/dist/esm/utils/stripHexPrefix.js.map +1 -0
- package/dist/esm/version.d.ts +6 -0
- package/dist/esm/version.d.ts.map +1 -0
- package/dist/esm/version.js +7 -0
- package/dist/esm/version.js.map +1 -0
- package/package.json +73 -0
- package/src/TronProvider.ts +52 -0
- package/src/actions/getMulticallAddress.ts +11 -0
- package/src/actions/getTronBalance.ts +179 -0
- package/src/actions/resolveTronAddress.ts +4 -0
- package/src/core/TronStepExecutor.ts +108 -0
- package/src/core/constants.ts +9 -0
- package/src/core/tasks/TronCheckAllowanceTask.ts +61 -0
- package/src/core/tasks/TronSetAllowanceTask.ts +129 -0
- package/src/core/tasks/TronSignAndExecuteTask.ts +88 -0
- package/src/core/tasks/TronWaitForTransactionTask.ts +77 -0
- package/src/errors/parseTronErrors.ts +114 -0
- package/src/index.ts +4 -0
- package/src/rpc/callTronRpcsWithRetry.ts +32 -0
- package/src/rpc/waitForTronTxConfirmation.ts +56 -0
- package/src/types.ts +42 -0
- package/src/utils/address.ts +20 -0
- package/src/utils/getTronTxLink.ts +15 -0
- package/src/utils/isZeroAddress.ts +7 -0
- package/src/utils/multicall3Abi.ts +39 -0
- package/src/utils/stripHexPrefix.ts +2 -0
- package/src/version.ts +2 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @lifi/sdk-provider-tron
|
|
2
|
+
|
|
3
|
+
## 0.0.0-preview-f5cf9f8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#390](https://github.com/lifinance/sdk/pull/390) [`f5cf9f8`](https://github.com/lifinance/sdk/commit/f5cf9f8cfece9e62d43efd18911c1ad8638ef358) Thanks [@chybisov](https://github.com/chybisov)! - TEST ONLY — validates the preview-publish lockfile fix. Remove before merging.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @lifi/sdk@0.0.0-preview-f5cf9f8
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright LI.FI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[](/LICENSE)
|
|
4
|
+
[](https://www.npmjs.com/package/@lifi/sdk)
|
|
5
|
+
[](https://www.npmjs.com/package/@lifi/sdk)
|
|
6
|
+
[](https://twitter.com/lifiprotocol)
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<h1 align="center">LI.FI SDK</h1>
|
|
11
|
+
|
|
12
|
+
[**LI.FI SDK**](https://docs.li.fi/sdk/overview) provides a powerful toolkit for developers to enable seamless cross-chain and on-chain swaps and bridging within their applications. Our JavaScript/TypeScript SDK can be implemented in front-end or back-end environments, allowing you to build robust UX/UI around our advanced bridge and swap functionalities. LI.FI SDK efficiently manages all communications between our smart routing API and smart contracts and ensures optimal performance, security, and scalability for your cross-chain and on-chain needs.
|
|
13
|
+
|
|
14
|
+
[**LI.FI SDK**](https://docs.li.fi/sdk/overview) features include:
|
|
15
|
+
|
|
16
|
+
- All ecosystems, chains, bridges, exchanges, and solvers that [LI.FI](https://docs.li.fi/introduction/chains) supports
|
|
17
|
+
- Complete functionality covering full-cycle from obtaining routes/quotes to executing transactions
|
|
18
|
+
- Easy tracking of the route and quote execution through the robust event and hooks handling
|
|
19
|
+
- Highly customizable settings to tailor the SDK to your specific needs including configuration of RPCs and options to allow or deny certain chains, tokens, bridges, exchanges, solvers
|
|
20
|
+
- Supports widely adopted industry standards, including [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792), [ERC-2612](https://eips.ethereum.org/EIPS/eip-2612), [EIP-712](https://eips.ethereum.org/EIPS/eip-712), and [Permit2](https://github.com/Uniswap/permit2)
|
|
21
|
+
- SDK ecosystem providers are based on industry-standard libraries ([Viem](https://viem.sh/), [Wallet Standard](https://github.com/wallet-standard/wallet-standard), [Bigmi](https://github.com/lifinance/bigmi))
|
|
22
|
+
- Support for arbitrary contract calls on the destination chain
|
|
23
|
+
- Designed for optimal performance with tree-shaking and dead-code elimination, ensuring minimal bundle sizes and faster page load times in front-end environments
|
|
24
|
+
- Compatibility tested with Node.js and popular front-end tools like Vite
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add @lifi/sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install --save @lifi/sdk
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### Set up the SDK
|
|
41
|
+
|
|
42
|
+
Firstly, create SDK config with your integrator string.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { createConfig } from '@lifi/sdk'
|
|
46
|
+
|
|
47
|
+
createConfig({
|
|
48
|
+
integrator: 'Your dApp/company name',
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Request a Quote
|
|
53
|
+
|
|
54
|
+
Now you can interact with the SDK and for example request a quote.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { ChainId, getQuote } from '@lifi/sdk'
|
|
58
|
+
|
|
59
|
+
const quote = await getQuote({
|
|
60
|
+
fromAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
|
|
61
|
+
fromChain: ChainId.ARB,
|
|
62
|
+
toChain: ChainId.OPT,
|
|
63
|
+
fromToken: '0x0000000000000000000000000000000000000000',
|
|
64
|
+
toToken: '0x0000000000000000000000000000000000000000',
|
|
65
|
+
fromAmount: '1000000000000000000',
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Examples
|
|
70
|
+
|
|
71
|
+
See [examples](/examples) folder in this repository.
|
|
72
|
+
|
|
73
|
+
## Documentation
|
|
74
|
+
|
|
75
|
+
Please checkout the [SDK documentation](https://docs.li.fi/sdk/overview) and our [API reference](https://docs.li.fi/api-reference/introduction) for further information.
|
|
76
|
+
|
|
77
|
+
## Changelog
|
|
78
|
+
|
|
79
|
+
The [changelog](/CHANGELOG.md) is regularly updated to reflect what's changed in each new release.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TronProviderOptions, TronSDKProvider } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/TronProvider.d.ts
|
|
4
|
+
declare function TronProvider(options?: TronProviderOptions): TronSDKProvider;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { TronProvider };
|
|
7
|
+
//# sourceMappingURL=TronProvider.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_actions_getTronBalance = require("./actions/getTronBalance.js");
|
|
3
|
+
const require_actions_resolveTronAddress = require("./actions/resolveTronAddress.js");
|
|
4
|
+
const require_core_TronStepExecutor = require("./core/TronStepExecutor.js");
|
|
5
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
6
|
+
let tronweb = require("tronweb");
|
|
7
|
+
//#region src/TronProvider.ts
|
|
8
|
+
function TronProvider(options) {
|
|
9
|
+
const _options = options ?? {};
|
|
10
|
+
return {
|
|
11
|
+
get type() {
|
|
12
|
+
return _lifi_sdk.ChainType.TVM;
|
|
13
|
+
},
|
|
14
|
+
isAddress: (address) => tronweb.TronWeb.isAddress(address),
|
|
15
|
+
resolveAddress: require_actions_resolveTronAddress.resolveTronAddress,
|
|
16
|
+
getBalance: (client, walletAddress, tokens) => require_actions_getTronBalance.getTronBalance(client, walletAddress, tokens, _options.multicallBatchSize),
|
|
17
|
+
async getStepExecutor(options) {
|
|
18
|
+
if (!_options.getWallet) throw new _lifi_sdk.ProviderError(_lifi_sdk.LiFiErrorCode.ProviderUnavailable, "TronProvider requires a getWallet function.");
|
|
19
|
+
return new require_core_TronStepExecutor.TronStepExecutor({
|
|
20
|
+
wallet: await _options.getWallet(),
|
|
21
|
+
routeId: options.routeId,
|
|
22
|
+
executionOptions: options.executionOptions
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
setOptions(options) {
|
|
26
|
+
Object.assign(_options, options);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.TronProvider = TronProvider;
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=TronProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TronProvider.js","names":["ChainType","TronWeb","resolveTronAddress","getTronBalance","ProviderError","LiFiErrorCode","TronStepExecutor"],"sources":["../../src/TronProvider.ts"],"sourcesContent":["import {\n ChainType,\n LiFiErrorCode,\n ProviderError,\n type StepExecutorOptions,\n} from '@lifi/sdk'\nimport { TronWeb } from 'tronweb'\nimport { getTronBalance } from './actions/getTronBalance.js'\nimport { resolveTronAddress } from './actions/resolveTronAddress.js'\nimport { TronStepExecutor } from './core/TronStepExecutor.js'\nimport type { TronProviderOptions, TronSDKProvider } from './types.js'\n\nexport function TronProvider(options?: TronProviderOptions): TronSDKProvider {\n const _options: TronProviderOptions = options ?? {}\n return {\n get type() {\n return ChainType.TVM\n },\n isAddress: (address: string) => TronWeb.isAddress(address),\n resolveAddress: resolveTronAddress,\n getBalance: (client, walletAddress, tokens) =>\n getTronBalance(\n client,\n walletAddress,\n tokens,\n _options.multicallBatchSize\n ),\n async getStepExecutor(\n options: StepExecutorOptions\n ): Promise<TronStepExecutor> {\n if (!_options.getWallet) {\n throw new ProviderError(\n LiFiErrorCode.ProviderUnavailable,\n 'TronProvider requires a getWallet function.'\n )\n }\n\n const wallet = await _options.getWallet()\n\n const executor = new TronStepExecutor({\n wallet,\n routeId: options.routeId,\n executionOptions: options.executionOptions,\n })\n\n return executor\n },\n setOptions(options: TronProviderOptions) {\n Object.assign(_options, options)\n },\n }\n}\n"],"mappings":";;;;;;;AAYA,SAAgB,aAAa,SAAgD;CAC3E,MAAM,WAAgC,WAAW,CAAC;CAClD,OAAO;EACL,IAAI,OAAO;GACT,OAAOA,UAAAA,UAAU;EACnB;EACA,YAAY,YAAoBC,QAAAA,QAAQ,UAAU,OAAO;EACzD,gBAAgBC,mCAAAA;EAChB,aAAa,QAAQ,eAAe,WAClCC,+BAAAA,eACE,QACA,eACA,QACA,SAAS,kBACX;EACF,MAAM,gBACJ,SAC2B;GAC3B,IAAI,CAAC,SAAS,WACZ,MAAM,IAAIC,UAAAA,cACRC,UAAAA,cAAc,qBACd,6CACF;GAWF,OAAO,IANcC,8BAAAA,iBAAiB;IACpC,QAAA,MAHmB,SAAS,UAAU;IAItC,SAAS,QAAQ;IACjB,kBAAkB,QAAQ;GAC5B,CAEc;EAChB;EACA,WAAW,SAA8B;GACvC,OAAO,OAAO,UAAU,OAAO;EACjC;CACF;AACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChainId, SDKClient } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/actions/getMulticallAddress.d.ts
|
|
4
|
+
declare const getMulticallAddress: (client: SDKClient, chainId: ChainId) => Promise<string | undefined>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getMulticallAddress };
|
|
7
|
+
//# sourceMappingURL=getMulticallAddress.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
3
|
+
//#region src/actions/getMulticallAddress.ts
|
|
4
|
+
const getMulticallAddress = async (client, chainId) => {
|
|
5
|
+
return (await client.getChains())?.find((chain) => chain.id === chainId && chain.chainType === _lifi_sdk.ChainType.TVM)?.multicallAddress;
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.getMulticallAddress = getMulticallAddress;
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=getMulticallAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getMulticallAddress.js","names":["ChainType"],"sources":["../../../src/actions/getMulticallAddress.ts"],"sourcesContent":["import { type ChainId, ChainType, type SDKClient } from '@lifi/sdk'\n\nexport const getMulticallAddress = async (\n client: SDKClient,\n chainId: ChainId\n): Promise<string | undefined> => {\n const chains = await client.getChains()\n return chains?.find(\n (chain) => chain.id === chainId && chain.chainType === ChainType.TVM\n )?.multicallAddress\n}\n"],"mappings":";;;AAEA,MAAa,sBAAsB,OACjC,QACA,YACgC;CAEhC,QAAO,MADc,OAAO,UAAU,IACvB,MACZ,UAAU,MAAM,OAAO,WAAW,MAAM,cAAcA,UAAAA,UAAU,GACnE,GAAG;AACL"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SDKClient, Token, TokenAmount } from "@lifi/sdk";
|
|
2
|
+
|
|
3
|
+
//#region src/actions/getTronBalance.d.ts
|
|
4
|
+
declare const getTronBalance: (client: SDKClient, walletAddress: string, tokens: Token[], multicallBatchSize?: number) => Promise<TokenAmount[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { getTronBalance };
|
|
7
|
+
//# sourceMappingURL=getTronBalance.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../core/constants.js");
|
|
3
|
+
const require_rpc_callTronRpcsWithRetry = require("../rpc/callTronRpcsWithRetry.js");
|
|
4
|
+
const require_utils_address = require("../utils/address.js");
|
|
5
|
+
const require_utils_isZeroAddress = require("../utils/isZeroAddress.js");
|
|
6
|
+
const require_utils_multicall3Abi = require("../utils/multicall3Abi.js");
|
|
7
|
+
const require_actions_getMulticallAddress = require("./getMulticallAddress.js");
|
|
8
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
9
|
+
let tronweb = require("tronweb");
|
|
10
|
+
//#region src/actions/getTronBalance.ts
|
|
11
|
+
const BALANCE_OF_SELECTOR = tronweb.TronWeb.sha3("balanceOf(address)").slice(2, 10);
|
|
12
|
+
const GET_ETH_BALANCE_SELECTOR = tronweb.TronWeb.sha3("getEthBalance(address)").slice(2, 10);
|
|
13
|
+
const getTronBalance = async (client, walletAddress, tokens, multicallBatchSize = 50) => {
|
|
14
|
+
if (tokens.length === 0) return [];
|
|
15
|
+
const { chainId } = tokens[0];
|
|
16
|
+
for (const token of tokens) if (token.chainId !== chainId) console.warn("Requested tokens have to be on the same chain.");
|
|
17
|
+
const multicallAddress = await require_actions_getMulticallAddress.getMulticallAddress(client, chainId);
|
|
18
|
+
if (multicallAddress && tokens.length > 1) return getTronBalanceMulticall(client, tokens, walletAddress, multicallAddress, multicallBatchSize);
|
|
19
|
+
return getTronBalanceDefault(client, tokens, walletAddress);
|
|
20
|
+
};
|
|
21
|
+
const getTronBalanceMulticall = async (client, tokens, walletAddress, multicallAddress, batchSize) => {
|
|
22
|
+
const walletHex = require_utils_address.toEvmHex(walletAddress);
|
|
23
|
+
const multicallHex = require_utils_address.toEvmHex(multicallAddress);
|
|
24
|
+
const [blockNumber, results] = await require_rpc_callTronRpcsWithRetry.callTronRpcsWithRetry(client, async (tronWeb) => {
|
|
25
|
+
const contract = tronWeb.contract(require_utils_multicall3Abi.multicall3Abi, multicallAddress);
|
|
26
|
+
const allCalls = tokens.map((token) => {
|
|
27
|
+
const isNative = require_utils_isZeroAddress.isZeroAddress(token.address);
|
|
28
|
+
return [
|
|
29
|
+
isNative ? multicallHex : require_utils_address.toEvmHex(token.address),
|
|
30
|
+
true,
|
|
31
|
+
require_utils_address.encodeAddressCalldata(isNative ? GET_ETH_BALANCE_SELECTOR : BALANCE_OF_SELECTOR, walletHex)
|
|
32
|
+
];
|
|
33
|
+
});
|
|
34
|
+
const batches = [];
|
|
35
|
+
for (let i = 0; i < allCalls.length; i += batchSize) batches.push(allCalls.slice(i, i + batchSize));
|
|
36
|
+
const [block, ...batchResults] = await Promise.all([tronWeb.trx.getCurrentBlock(), ...batches.map((batch, idx) => contract.aggregate3(batch).call({ from: walletAddress }).then((r) => r[0]).catch((error) => {
|
|
37
|
+
console.warn(`[getTronBalance] batch ${idx + 1}/${batches.length} failed:`, error.message);
|
|
38
|
+
return batch.map(() => [false, "0x"]);
|
|
39
|
+
}))]);
|
|
40
|
+
const blockNumber = block.block_header?.raw_data?.number;
|
|
41
|
+
return [blockNumber !== void 0 ? BigInt(blockNumber) : void 0, batchResults.flat()];
|
|
42
|
+
});
|
|
43
|
+
return tokens.map((token, i) => {
|
|
44
|
+
const entry = results[i];
|
|
45
|
+
if (!entry) return {
|
|
46
|
+
...token,
|
|
47
|
+
blockNumber
|
|
48
|
+
};
|
|
49
|
+
const [success, returnData] = entry;
|
|
50
|
+
if (!success) return {
|
|
51
|
+
...token,
|
|
52
|
+
blockNumber
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
...token,
|
|
56
|
+
amount: BigInt(returnData),
|
|
57
|
+
blockNumber
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const getTronBalanceDefault = async (client, tokens, walletAddress) => {
|
|
62
|
+
const [blockNumber, results] = await require_rpc_callTronRpcsWithRetry.callTronRpcsWithRetry(client, async (tronWeb) => {
|
|
63
|
+
const host = tronWeb.fullNode.host;
|
|
64
|
+
const queue = tokens.map((token) => {
|
|
65
|
+
if (require_utils_isZeroAddress.isZeroAddress(token.address)) return (0, _lifi_sdk.withDedupe)(async () => BigInt(await tronWeb.trx.getBalance(walletAddress)), { id: `${getTronBalanceDefault.name}.getBalance.${host}` });
|
|
66
|
+
return (0, _lifi_sdk.withDedupe)(async () => {
|
|
67
|
+
const balance = await (await tronWeb.contract().at(token.address)).balanceOf(walletAddress).call({ from: walletAddress });
|
|
68
|
+
return BigInt(balance.toString());
|
|
69
|
+
}, { id: `${getTronBalanceDefault.name}.balanceOf.${token.address}.${host}` });
|
|
70
|
+
});
|
|
71
|
+
return Promise.all([(0, _lifi_sdk.withDedupe)(async () => {
|
|
72
|
+
const n = (await tronWeb.trx.getCurrentBlock()).block_header?.raw_data?.number;
|
|
73
|
+
return n !== void 0 ? BigInt(n) : void 0;
|
|
74
|
+
}, { id: `${getTronBalanceDefault.name}.getCurrentBlock.${host}` }), Promise.allSettled(queue)]);
|
|
75
|
+
});
|
|
76
|
+
return tokens.map((token, index) => {
|
|
77
|
+
const result = results[index];
|
|
78
|
+
if (result.status === "rejected") return {
|
|
79
|
+
...token,
|
|
80
|
+
blockNumber
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
...token,
|
|
84
|
+
amount: result.value,
|
|
85
|
+
blockNumber
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
exports.getTronBalance = getTronBalance;
|
|
91
|
+
|
|
92
|
+
//# sourceMappingURL=getTronBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTronBalance.js","names":["TronWeb","getMulticallAddress","toEvmHex","callTronRpcsWithRetry","multicall3Abi","isZeroAddress","encodeAddressCalldata"],"sources":["../../../src/actions/getTronBalance.ts"],"sourcesContent":["import type { SDKClient, Token, TokenAmount } from '@lifi/sdk'\nimport { withDedupe } from '@lifi/sdk'\nimport { TronWeb } from 'tronweb'\nimport { DEFAULT_MULTICALL_BATCH_SIZE } from '../core/constants.js'\nimport { callTronRpcsWithRetry } from '../rpc/callTronRpcsWithRetry.js'\nimport { encodeAddressCalldata, toEvmHex } from '../utils/address.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { multicall3Abi } from '../utils/multicall3Abi.js'\nimport { getMulticallAddress } from './getMulticallAddress.js'\n\nconst BALANCE_OF_SELECTOR = TronWeb.sha3('balanceOf(address)').slice(2, 10)\nconst GET_ETH_BALANCE_SELECTOR = TronWeb.sha3('getEthBalance(address)').slice(\n 2,\n 10\n)\n\nexport const getTronBalance = async (\n client: SDKClient,\n walletAddress: string,\n tokens: Token[],\n multicallBatchSize: number = DEFAULT_MULTICALL_BATCH_SIZE\n): Promise<TokenAmount[]> => {\n if (tokens.length === 0) {\n return []\n }\n const { chainId } = tokens[0]\n for (const token of tokens) {\n if (token.chainId !== chainId) {\n console.warn('Requested tokens have to be on the same chain.')\n }\n }\n\n const multicallAddress = await getMulticallAddress(client, chainId)\n\n if (multicallAddress && tokens.length > 1) {\n return getTronBalanceMulticall(\n client,\n tokens,\n walletAddress,\n multicallAddress,\n multicallBatchSize\n )\n }\n\n return getTronBalanceDefault(client, tokens, walletAddress)\n}\n\nconst getTronBalanceMulticall = async (\n client: SDKClient,\n tokens: Token[],\n walletAddress: string,\n multicallAddress: string,\n batchSize: number\n): Promise<TokenAmount[]> => {\n const walletHex = toEvmHex(walletAddress)\n const multicallHex = toEvmHex(multicallAddress)\n\n const [blockNumber, results] = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const contract = tronWeb.contract(multicall3Abi, multicallAddress)\n\n // TronWeb encodes tuples positionally: [target, allowFailure, callData]\n const allCalls = tokens.map((token) => {\n const isNative = isZeroAddress(token.address)\n return [\n isNative ? multicallHex : toEvmHex(token.address),\n true,\n encodeAddressCalldata(\n isNative ? GET_ETH_BALANCE_SELECTOR : BALANCE_OF_SELECTOR,\n walletHex\n ),\n ]\n })\n\n // Chunk calls to avoid CPU timeout on Tron nodes\n const batches: (typeof allCalls)[] = []\n for (let i = 0; i < allCalls.length; i += batchSize) {\n batches.push(allCalls.slice(i, i + batchSize))\n }\n\n const [block, ...batchResults] = await Promise.all([\n tronWeb.trx.getCurrentBlock(),\n ...batches.map((batch, idx) =>\n contract\n .aggregate3(batch)\n .call({ from: walletAddress })\n // TronWeb wraps the single return value in an extra array\n .then((r: unknown[]) => r[0] as Array<[boolean, string]>)\n .catch((error: Error) => {\n console.warn(\n `[getTronBalance] batch ${idx + 1}/${batches.length} failed:`,\n error.message\n )\n return batch.map(() => [false, '0x'] as [boolean, string])\n })\n ),\n ])\n\n const blockNumber = block.block_header?.raw_data?.number\n return [\n blockNumber !== undefined ? BigInt(blockNumber) : undefined,\n batchResults.flat(),\n ]\n }\n )\n\n return tokens.map((token, i) => {\n // Guard against an unexpected length mismatch between tokens and flattened batch results.\n const entry = results[i] as [boolean, string] | undefined\n if (!entry) {\n return { ...token, blockNumber }\n }\n const [success, returnData] = entry\n if (!success) {\n // RPC failure: amount is omitted (undefined)\n // Consumers must treat a missing amount as \"balance unavailable\", not zero.\n return { ...token, blockNumber }\n }\n return { ...token, amount: BigInt(returnData), blockNumber }\n })\n}\n\nconst getTronBalanceDefault = async (\n client: SDKClient,\n tokens: Token[],\n walletAddress: string\n): Promise<TokenAmount[]> => {\n const [blockNumber, results] = await callTronRpcsWithRetry(\n client,\n async (tronWeb) => {\n const host = tronWeb.fullNode.host\n const queue: Promise<bigint>[] = tokens.map((token) => {\n if (isZeroAddress(token.address)) {\n return withDedupe(\n async () => BigInt(await tronWeb.trx.getBalance(walletAddress)),\n { id: `${getTronBalanceDefault.name}.getBalance.${host}` }\n )\n }\n return withDedupe(\n async () => {\n const contract = await tronWeb.contract().at(token.address)\n const balance = await contract\n .balanceOf(walletAddress)\n .call({ from: walletAddress })\n return BigInt(balance.toString())\n },\n {\n id: `${getTronBalanceDefault.name}.balanceOf.${token.address}.${host}`,\n }\n )\n })\n\n return Promise.all([\n withDedupe(\n async (): Promise<bigint | undefined> => {\n const block = await tronWeb.trx.getCurrentBlock()\n const n = block.block_header?.raw_data?.number\n return n !== undefined ? BigInt(n) : undefined\n },\n { id: `${getTronBalanceDefault.name}.getCurrentBlock.${host}` }\n ),\n Promise.allSettled(queue),\n ])\n }\n )\n\n const tokenAmounts: TokenAmount[] = tokens.map((token, index) => {\n const result = results[index]\n if (result.status === 'rejected') {\n // RPC failure: amount is omitted (undefined), matching getSolanaBalance's contract.\n // Consumers must treat a missing amount as \"balance unavailable\", not zero.\n return { ...token, blockNumber }\n }\n return { ...token, amount: result.value, blockNumber }\n })\n\n return tokenAmounts\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/actions/resolveTronAddress.ts
|
|
3
|
+
async function resolveTronAddress(name) {
|
|
4
|
+
return name;
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.resolveTronAddress = resolveTronAddress;
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=resolveTronAddress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveTronAddress.js","names":[],"sources":["../../../src/actions/resolveTronAddress.ts"],"sourcesContent":["export async function resolveTronAddress(name: string): Promise<string> {\n // Tron does not have a name service, return the address as-is\n return name\n}\n"],"mappings":";;AAAA,eAAsB,mBAAmB,MAA+B;CAEtE,OAAO;AACT"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TronStepExecutorContext, TronStepExecutorOptions } from "../types.js";
|
|
2
|
+
import { BaseStepExecutor, ExecutionAction, LiFiStepExtended, SDKError, StepExecutorBaseContext, TaskPipeline } from "@lifi/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/core/TronStepExecutor.d.ts
|
|
5
|
+
declare class TronStepExecutor extends BaseStepExecutor {
|
|
6
|
+
private wallet;
|
|
7
|
+
constructor(options: TronStepExecutorOptions);
|
|
8
|
+
checkWallet: (step: LiFiStepExtended) => void;
|
|
9
|
+
override parseErrors: (error: Error, step?: LiFiStepExtended, action?: ExecutionAction) => Promise<SDKError>;
|
|
10
|
+
override createContext: (baseContext: StepExecutorBaseContext) => Promise<TronStepExecutorContext>;
|
|
11
|
+
override createPipeline: (context: TronStepExecutorContext) => TaskPipeline;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { TronStepExecutor };
|
|
15
|
+
//# sourceMappingURL=TronStepExecutor.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utils_isZeroAddress = require("../utils/isZeroAddress.js");
|
|
3
|
+
const require_errors_parseTronErrors = require("../errors/parseTronErrors.js");
|
|
4
|
+
const require_core_tasks_TronCheckAllowanceTask = require("./tasks/TronCheckAllowanceTask.js");
|
|
5
|
+
const require_core_tasks_TronSetAllowanceTask = require("./tasks/TronSetAllowanceTask.js");
|
|
6
|
+
const require_core_tasks_TronSignAndExecuteTask = require("./tasks/TronSignAndExecuteTask.js");
|
|
7
|
+
const require_core_tasks_TronWaitForTransactionTask = require("./tasks/TronWaitForTransactionTask.js");
|
|
8
|
+
let _lifi_sdk = require("@lifi/sdk");
|
|
9
|
+
//#region src/core/TronStepExecutor.ts
|
|
10
|
+
var TronStepExecutor = class extends _lifi_sdk.BaseStepExecutor {
|
|
11
|
+
wallet;
|
|
12
|
+
constructor(options) {
|
|
13
|
+
super(options);
|
|
14
|
+
this.wallet = options.wallet;
|
|
15
|
+
}
|
|
16
|
+
checkWallet = (step) => {
|
|
17
|
+
const address = this.wallet.address;
|
|
18
|
+
if (address && address !== step.action.fromAddress) throw new _lifi_sdk.TransactionError(_lifi_sdk.LiFiErrorCode.WalletChangedDuringExecution, "The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.");
|
|
19
|
+
};
|
|
20
|
+
parseErrors = (error, step, action) => require_errors_parseTronErrors.parseTronErrors(error, step, action);
|
|
21
|
+
createContext = async (baseContext) => {
|
|
22
|
+
return {
|
|
23
|
+
...baseContext,
|
|
24
|
+
wallet: this.wallet,
|
|
25
|
+
checkWallet: this.checkWallet
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
createPipeline = (context) => {
|
|
29
|
+
const { step, isBridgeExecution } = context;
|
|
30
|
+
const isFromNativeToken = require_utils_isZeroAddress.isZeroAddress(step.action.fromToken.address);
|
|
31
|
+
const tasks = [
|
|
32
|
+
new require_core_tasks_TronCheckAllowanceTask.TronCheckAllowanceTask(),
|
|
33
|
+
new require_core_tasks_TronSetAllowanceTask.TronSetAllowanceTask(),
|
|
34
|
+
new _lifi_sdk.CheckBalanceTask(),
|
|
35
|
+
new _lifi_sdk.PrepareTransactionTask(),
|
|
36
|
+
new require_core_tasks_TronSignAndExecuteTask.TronSignAndExecuteTask(),
|
|
37
|
+
new require_core_tasks_TronWaitForTransactionTask.TronWaitForTransactionTask(),
|
|
38
|
+
new _lifi_sdk.WaitForTransactionStatusTask(isBridgeExecution ? "RECEIVING_CHAIN" : "SWAP")
|
|
39
|
+
];
|
|
40
|
+
const swapOrBridgeAction = this.statusManager.findAction(step, isBridgeExecution ? "CROSS_CHAIN" : "SWAP");
|
|
41
|
+
const doCheckAllowance = !swapOrBridgeAction?.txHash && !isFromNativeToken && !!step.estimate.approvalAddress && !step.estimate.skipApproval;
|
|
42
|
+
let taskName;
|
|
43
|
+
if (doCheckAllowance) taskName = require_core_tasks_TronCheckAllowanceTask.TronCheckAllowanceTask.name;
|
|
44
|
+
else taskName = swapOrBridgeAction?.txHash && swapOrBridgeAction?.status === "DONE" ? _lifi_sdk.WaitForTransactionStatusTask.name : _lifi_sdk.CheckBalanceTask.name;
|
|
45
|
+
const firstTaskIndex = tasks.findIndex((task) => task.constructor.name === taskName);
|
|
46
|
+
return new _lifi_sdk.TaskPipeline(tasks.slice(firstTaskIndex));
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
//#endregion
|
|
50
|
+
exports.TronStepExecutor = TronStepExecutor;
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=TronStepExecutor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TronStepExecutor.js","names":["BaseStepExecutor","TransactionError","LiFiErrorCode","parseTronErrors","isZeroAddress","TronCheckAllowanceTask","TronSetAllowanceTask","CheckBalanceTask","PrepareTransactionTask","TronSignAndExecuteTask","TronWaitForTransactionTask","WaitForTransactionStatusTask","TaskPipeline"],"sources":["../../../src/core/TronStepExecutor.ts"],"sourcesContent":["import {\n BaseStepExecutor,\n CheckBalanceTask,\n type ExecutionAction,\n LiFiErrorCode,\n type LiFiStepExtended,\n PrepareTransactionTask,\n type SDKError,\n type StepExecutorBaseContext,\n TaskPipeline,\n TransactionError,\n WaitForTransactionStatusTask,\n} from '@lifi/sdk'\nimport type { Adapter } from '@tronweb3/tronwallet-abstract-adapter'\nimport { parseTronErrors } from '../errors/parseTronErrors.js'\nimport type {\n TronStepExecutorContext,\n TronStepExecutorOptions,\n} from '../types.js'\nimport { isZeroAddress } from '../utils/isZeroAddress.js'\nimport { TronCheckAllowanceTask } from './tasks/TronCheckAllowanceTask.js'\nimport { TronSetAllowanceTask } from './tasks/TronSetAllowanceTask.js'\nimport { TronSignAndExecuteTask } from './tasks/TronSignAndExecuteTask.js'\nimport { TronWaitForTransactionTask } from './tasks/TronWaitForTransactionTask.js'\n\nexport class TronStepExecutor extends BaseStepExecutor {\n private wallet: Adapter\n\n constructor(options: TronStepExecutorOptions) {\n super(options)\n this.wallet = options.wallet\n }\n\n checkWallet = (step: LiFiStepExtended): void => {\n const address = this.wallet.address\n if (address && address !== step.action.fromAddress) {\n throw new TransactionError(\n LiFiErrorCode.WalletChangedDuringExecution,\n 'The wallet address that requested the quote does not match the wallet address attempting to sign the transaction.'\n )\n }\n }\n\n override parseErrors = (\n error: Error,\n step?: LiFiStepExtended,\n action?: ExecutionAction\n ): Promise<SDKError> => parseTronErrors(error, step, action)\n\n override createContext = async (\n baseContext: StepExecutorBaseContext\n ): Promise<TronStepExecutorContext> => {\n return {\n ...baseContext,\n wallet: this.wallet,\n checkWallet: this.checkWallet,\n }\n }\n\n override createPipeline = (\n context: TronStepExecutorContext\n ): TaskPipeline => {\n const { step, isBridgeExecution } = context\n\n const isFromNativeToken = isZeroAddress(step.action.fromToken.address)\n\n const tasks = [\n new TronCheckAllowanceTask(),\n new TronSetAllowanceTask(),\n new CheckBalanceTask(),\n new PrepareTransactionTask(),\n new TronSignAndExecuteTask(),\n new TronWaitForTransactionTask(),\n new WaitForTransactionStatusTask(\n isBridgeExecution ? 'RECEIVING_CHAIN' : 'SWAP'\n ),\n ]\n\n const swapOrBridgeAction = this.statusManager.findAction(\n step,\n isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'\n )\n\n const doCheckAllowance =\n !swapOrBridgeAction?.txHash &&\n !isFromNativeToken &&\n !!step.estimate.approvalAddress &&\n !step.estimate.skipApproval\n\n let taskName: string\n if (doCheckAllowance) {\n taskName = TronCheckAllowanceTask.name\n } else {\n taskName =\n swapOrBridgeAction?.txHash && swapOrBridgeAction?.status === 'DONE'\n ? WaitForTransactionStatusTask.name\n : CheckBalanceTask.name\n }\n\n const firstTaskIndex = tasks.findIndex(\n (task) => task.constructor.name === taskName\n )\n\n const tasksToRun = tasks.slice(firstTaskIndex)\n\n return new TaskPipeline(tasksToRun)\n }\n}\n"],"mappings":";;;;;;;;;AAyBA,IAAa,mBAAb,cAAsCA,UAAAA,iBAAiB;CACrD;CAEA,YAAY,SAAkC;EAC5C,MAAM,OAAO;EACb,KAAK,SAAS,QAAQ;CACxB;CAEA,eAAe,SAAiC;EAC9C,MAAM,UAAU,KAAK,OAAO;EAC5B,IAAI,WAAW,YAAY,KAAK,OAAO,aACrC,MAAM,IAAIC,UAAAA,iBACRC,UAAAA,cAAc,8BACd,mHACF;CAEJ;CAEA,eACE,OACA,MACA,WACsBC,+BAAAA,gBAAgB,OAAO,MAAM,MAAM;CAE3D,gBAAyB,OACvB,gBACqC;EACrC,OAAO;GACL,GAAG;GACH,QAAQ,KAAK;GACb,aAAa,KAAK;EACpB;CACF;CAEA,kBACE,YACiB;EACjB,MAAM,EAAE,MAAM,sBAAsB;EAEpC,MAAM,oBAAoBC,4BAAAA,cAAc,KAAK,OAAO,UAAU,OAAO;EAErE,MAAM,QAAQ;GACZ,IAAIC,0CAAAA,uBAAuB;GAC3B,IAAIC,wCAAAA,qBAAqB;GACzB,IAAIC,UAAAA,iBAAiB;GACrB,IAAIC,UAAAA,uBAAuB;GAC3B,IAAIC,0CAAAA,uBAAuB;GAC3B,IAAIC,8CAAAA,2BAA2B;GAC/B,IAAIC,UAAAA,6BACF,oBAAoB,oBAAoB,MAC1C;EACF;EAEA,MAAM,qBAAqB,KAAK,cAAc,WAC5C,MACA,oBAAoB,gBAAgB,MACtC;EAEA,MAAM,mBACJ,CAAC,oBAAoB,UACrB,CAAC,qBACD,CAAC,CAAC,KAAK,SAAS,mBAChB,CAAC,KAAK,SAAS;EAEjB,IAAI;EACJ,IAAI,kBACF,WAAWN,0CAAAA,uBAAuB;OAElC,WACE,oBAAoB,UAAU,oBAAoB,WAAW,SACzDM,UAAAA,6BAA6B,OAC7BJ,UAAAA,iBAAiB;EAGzB,MAAM,iBAAiB,MAAM,WAC1B,SAAS,KAAK,YAAY,SAAS,QACtC;EAIA,OAAO,IAAIK,UAAAA,aAFQ,MAAM,MAAM,cAEE,CAAC;CACpC;AACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/core/constants.d.ts
|
|
2
|
+
declare const TRON_POLL_INTERVAL_MS = 3e3;
|
|
3
|
+
declare const TRON_POLL_MAX_POLLS = 40;
|
|
4
|
+
declare const TRON_POLL_MAX_ERROR_RETRIES = 5;
|
|
5
|
+
declare const DEFAULT_MULTICALL_BATCH_SIZE = 50;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { DEFAULT_MULTICALL_BATCH_SIZE, TRON_POLL_INTERVAL_MS, TRON_POLL_MAX_ERROR_RETRIES, TRON_POLL_MAX_POLLS };
|
|
8
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/core/constants.ts
|
|
3
|
+
const TRON_POLL_INTERVAL_MS = 3e3;
|
|
4
|
+
const TRON_POLL_MAX_POLLS = 40;
|
|
5
|
+
const TRON_POLL_MAX_ERROR_RETRIES = 5;
|
|
6
|
+
const DEFAULT_MULTICALL_BATCH_SIZE = 50;
|
|
7
|
+
//#endregion
|
|
8
|
+
exports.DEFAULT_MULTICALL_BATCH_SIZE = DEFAULT_MULTICALL_BATCH_SIZE;
|
|
9
|
+
exports.TRON_POLL_INTERVAL_MS = TRON_POLL_INTERVAL_MS;
|
|
10
|
+
exports.TRON_POLL_MAX_ERROR_RETRIES = TRON_POLL_MAX_ERROR_RETRIES;
|
|
11
|
+
exports.TRON_POLL_MAX_POLLS = TRON_POLL_MAX_POLLS;
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/core/constants.ts"],"sourcesContent":["export const TRON_POLL_INTERVAL_MS = 3000\n// Maximum number of poll attempts before the confirmation wait times out.\n// At TRON_POLL_INTERVAL_MS=3000 this caps total wait at ~2 minutes.\nexport const TRON_POLL_MAX_POLLS = 40\n// Maximum tolerated RPC errors during confirmation polling before bailing.\nexport const TRON_POLL_MAX_ERROR_RETRIES = 5\n\n// Max tokens per aggregate3 multicall — avoids Tron node CPU timeouts on large lists.\nexport const DEFAULT_MULTICALL_BATCH_SIZE = 50\n"],"mappings":";;AAAA,MAAa,wBAAwB;AAGrC,MAAa,sBAAsB;AAEnC,MAAa,8BAA8B;AAG3C,MAAa,+BAA+B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TronStepExecutorContext } from "../../types.js";
|
|
2
|
+
import { BaseStepExecutionTask, TaskResult } from "@lifi/sdk";
|
|
3
|
+
|
|
4
|
+
//#region src/core/tasks/TronCheckAllowanceTask.d.ts
|
|
5
|
+
declare class TronCheckAllowanceTask extends BaseStepExecutionTask {
|
|
6
|
+
override shouldRun(context: TronStepExecutorContext): Promise<boolean>;
|
|
7
|
+
run(context: TronStepExecutorContext): Promise<TaskResult>;
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { TronCheckAllowanceTask };
|
|
11
|
+
//# sourceMappingURL=TronCheckAllowanceTask.d.ts.map
|