@paraspell/sdk 8.11.1 → 8.12.0

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/README.md CHANGED
@@ -227,6 +227,42 @@ import { hasDryRunSupport } from "@paraspell/sdk-pjs";
227
227
  const result = hasDryRunSupport(node)
228
228
  ```
229
229
 
230
+ ### XCM Fee (Origin and Dest.)
231
+ Following queries allow you to query fee from both Origin and Destination of the XCM Message. You can get accurate result from DryRun query(Requires token balance) or less accurate from Payment info query (Doesn't require token balance).
232
+
233
+ #### More accurate query using DryRun
234
+ The query is designed to retrieve you XCM fee at any cost, but fallbacking to Payment info if DryRun query fails or is not supported by either origin or destination. This query requires user to have token balance (Token that they are sending and origin native asset to pay for execution fees on origin).
235
+
236
+ ```
237
+ NOTICE: When Payment info query is performed, it retrieves fees for destination in destination's native currency, however, they are paid in currency that is being sent. To solve this, you have to convert token(native) to token(transferred) based on price. DryRun returns fees in currency that is being transferred, so no additional calculations necessary in that case.
238
+ ```
239
+
240
+ ```ts
241
+ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
242
+ .from(ORIGIN_CHAIN)
243
+ .to(DESTINATION_CHAIN)
244
+ .currency(CURRENCY)
245
+ .address(RECIPIENT_ADDRESS, SENDER_ADDRESS) // Both sender and recipient addresses are required!
246
+ .getXcmFee({disableFallback: true / false}) //When fallback is disabled, you only get notified of DryRun error, but no Payment info query fallback is performed. Payment info is still performed if Origin or Destination chain do not support DryRun out of the box.
247
+ ```
248
+
249
+ #### Less accurate query using Payment info
250
+ This query is designed to retrieve you approximate fee and doesn't require any token balance.
251
+
252
+ ```
253
+ NOTICE: When Payment info query is performed, it retrieves fees for destination in destination's native currency, however, they are paid in currency that is being sent. To solve this, you have to convert token(native) to token(transferred) based on price.
254
+ ```
255
+
256
+ ```ts
257
+ const fee = await Builder(/*node api/ws_url_string/ws_url_array - optional*/)
258
+ .from(ORIGIN_CHAIN)
259
+ .to(DESTINATION_CHAIN)
260
+ .currency(CURRENCY)
261
+ .address(RECIPIENT_ADDRESS, SENDER_ADDRESS) // Both sender and recipient addresses are required!
262
+ .getXcmFeeEstimate()
263
+ ```
264
+
265
+
230
266
  ### Asset claim:
231
267
  ```ts
232
268
  //Claim XCM trapped assets from the selected chain