@defuse-protocol/intents-sdk 0.38.0 → 0.39.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.
Files changed (55) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +10 -6
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.cts +2 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.cjs +0 -2
  7. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +0 -1
  8. package/dist/src/bridges/direct-bridge/direct-bridge-utils.cjs +0 -2
  9. package/dist/src/bridges/direct-bridge/direct-bridge.cjs +0 -2
  10. package/dist/src/bridges/direct-bridge/error.cjs +0 -1
  11. package/dist/src/bridges/hot-bridge/error.cjs +0 -1
  12. package/dist/src/bridges/hot-bridge/hot-bridge-utils.cjs +0 -2
  13. package/dist/src/bridges/hot-bridge/hot-bridge.cjs +0 -3
  14. package/dist/src/bridges/omni-bridge/error.cjs +10 -1
  15. package/dist/src/bridges/omni-bridge/error.d.cts +8 -1
  16. package/dist/src/bridges/omni-bridge/error.d.ts +8 -1
  17. package/dist/src/bridges/omni-bridge/error.js +10 -1
  18. package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +36 -23
  19. package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +36 -22
  20. package/dist/src/bridges/omni-bridge/omni-bridge.cjs +71 -19
  21. package/dist/src/bridges/omni-bridge/omni-bridge.js +74 -18
  22. package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +0 -1
  23. package/dist/src/bridges/poa-bridge/poa-bridge.cjs +0 -1
  24. package/dist/src/classes/errors.cjs +0 -1
  25. package/dist/src/intents/expirable-nonce.cjs +0 -2
  26. package/dist/src/intents/intent-executer-impl/intent-executer.cjs +2 -3
  27. package/dist/src/intents/intent-executer-impl/intent-executer.js +2 -2
  28. package/dist/src/intents/intent-hash.cjs +0 -1
  29. package/dist/src/intents/intent-hashes/erc191.cjs +0 -1
  30. package/dist/src/intents/intent-hashes/nep413.cjs +0 -1
  31. package/dist/src/intents/intent-hashes/raw-ed25519.cjs +0 -1
  32. package/dist/src/intents/intent-hashes/sep53.cjs +0 -2
  33. package/dist/src/intents/intent-hashes/tip191.cjs +0 -1
  34. package/dist/src/intents/intent-hashes/ton-connect.cjs +0 -1
  35. package/dist/src/intents/intent-hashes/webauthn.cjs +0 -1
  36. package/dist/src/intents/intent-payload-builder.cjs +0 -1
  37. package/dist/src/intents/intent-payload-factory.cjs +1 -1
  38. package/dist/src/intents/intent-payload-factory.js +1 -1
  39. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.cjs +0 -1
  40. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.cjs +0 -1
  41. package/dist/src/intents/intent-signer-impl/intent-signer-nep413.cjs +0 -1
  42. package/dist/src/intents/intent-signer-impl/intent-signer-viem.cjs +0 -1
  43. package/dist/src/intents/salt-manager.cjs +0 -2
  44. package/dist/src/lib/array.cjs +0 -1
  45. package/dist/src/lib/caip2.cjs +0 -1
  46. package/dist/src/lib/configure-rpc-config.cjs +0 -1
  47. package/dist/src/lib/estimate-fee.cjs +0 -1
  48. package/dist/src/lib/nep413.cjs +0 -1
  49. package/dist/src/lib/parse-defuse-asset-id.cjs +0 -1
  50. package/dist/src/lib/tokensUsdPricesHttpClient/apis.cjs +0 -1
  51. package/dist/src/lib/validateAddress.cjs +0 -6
  52. package/dist/src/sdk.cjs +0 -3
  53. package/dist/src/shared-types.d.cts +1 -1
  54. package/dist/src/shared-types.d.ts +1 -1
  55. package/package.json +4 -4
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
15
19
  }
16
20
  return to;
17
21
  };
package/dist/index.cjs CHANGED
@@ -13,7 +13,6 @@ const require_intent_payload_builder = require('./src/intents/intent-payload-bui
13
13
  const require_sdk = require('./src/sdk.cjs');
14
14
  const require_factories = require('./src/intents/intent-signer-impl/factories.cjs');
15
15
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
16
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
17
16
 
18
17
  Object.defineProperty(exports, 'AssertionError', {
19
18
  enumerable: true,
@@ -41,6 +40,7 @@ Object.defineProperty(exports, 'HttpRequestError', {
41
40
  return __defuse_protocol_internal_utils.HttpRequestError;
42
41
  }
43
42
  });
43
+ exports.InsufficientUtxoForOmniBridgeWithdrawalError = require_error$2.InsufficientUtxoForOmniBridgeWithdrawalError;
44
44
  exports.IntentPayloadBuilder = require_intent_payload_builder.IntentPayloadBuilder;
45
45
  Object.defineProperty(exports, 'IntentSettlementError', {
46
46
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -13,7 +13,7 @@ import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute,
13
13
  import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
14
14
  import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.cjs";
15
15
  import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.cjs";
16
- import { IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
16
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
17
17
  import { computeIntentHash } from "./src/intents/intent-hash.cjs";
18
18
  import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
19
- export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniTokenNormalisationCheckError, type OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, type OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, type OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, RelayPublishError, type RelayPublishErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute };
19
+ export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniTokenNormalisationCheckError, type OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, type OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, type OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, RelayPublishError, type RelayPublishErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute };
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute,
13
13
  import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
14
14
  import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.js";
15
15
  import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.js";
16
- import { IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
16
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
17
17
  import { computeIntentHash } from "./src/intents/intent-hash.js";
18
18
  import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
19
- export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniTokenNormalisationCheckError, type OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, type OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, type OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, RelayPublishError, type RelayPublishErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute };
19
+ export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniTokenNormalisationCheckError, type OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, type OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, type OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, RelayPublishError, type RelayPublishErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { Chains } from "./src/lib/caip2.js";
4
4
  import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
5
5
  import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
6
6
  import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./src/bridges/hot-bridge/error.js";
7
- import { IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
7
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
8
8
  import { computeIntentHash } from "./src/intents/intent-hash.js";
9
9
  import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.js";
10
10
  import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
@@ -13,4 +13,4 @@ import { IntentsSDK } from "./src/sdk.js";
13
13
  import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
14
14
  import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RpcRequestError, TimeoutError } from "@defuse-protocol/internal-utils";
15
15
 
16
- export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute };
16
+ export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute };
@@ -1,9 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_route_enum = require('../../constants/route-enum.cjs');
3
3
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
5
4
  let viem = require("viem");
6
- viem = require_rolldown_runtime.__toESM(viem);
7
5
 
8
6
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.ts
9
7
  function createWithdrawIntentPrimitive(params) {
@@ -8,7 +8,6 @@ const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.c
8
8
  const require_caip2 = require('../../lib/caip2.cjs');
9
9
  const require_validateAddress = require('../../lib/validateAddress.cjs');
10
10
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
11
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
12
11
 
13
12
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
14
13
  var AuroraEngineBridge = class {
@@ -2,9 +2,7 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs
2
2
  const require_route_enum = require('../../constants/route-enum.cjs');
3
3
  const require_direct_bridge_constants = require('./direct-bridge-constants.cjs');
4
4
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
6
5
  let near_api_js = require("near-api-js");
7
- near_api_js = require_rolldown_runtime.__toESM(near_api_js);
8
6
 
9
7
  //#region src/bridges/direct-bridge/direct-bridge-utils.ts
10
8
  function createWithdrawIntentPrimitive(params) {
@@ -10,9 +10,7 @@ const require_direct_bridge_constants = require('./direct-bridge-constants.cjs')
10
10
  const require_direct_bridge_utils = require('./direct-bridge-utils.cjs');
11
11
  const require_error = require('./error.cjs');
12
12
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
13
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
14
13
  let lru_cache = require("lru-cache");
15
- lru_cache = require_rolldown_runtime.__toESM(lru_cache);
16
14
 
17
15
  //#region src/bridges/direct-bridge/direct-bridge.ts
18
16
  var DirectBridge = class {
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/bridges/direct-bridge/error.ts
6
5
  var DestinationExplicitNearAccountDoesntExistError = class extends __defuse_protocol_internal_utils.BaseError {
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/bridges/hot-bridge/error.ts
6
5
  var HotWithdrawalPendingError = class extends __defuse_protocol_internal_utils.BaseError {
@@ -2,9 +2,7 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs
2
2
  const require_caip2 = require('../../lib/caip2.cjs');
3
3
  const require_hot_bridge_chains = require('./hot-bridge-chains.cjs');
4
4
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
6
5
  let __hot_labs_omni_sdk = require("@hot-labs/omni-sdk");
7
- __hot_labs_omni_sdk = require_rolldown_runtime.__toESM(__hot_labs_omni_sdk);
8
6
 
9
7
  //#region src/bridges/hot-bridge/hot-bridge-utils.ts
10
8
  const MONAD_MAINNET_NETWORK_ID = 143;
@@ -11,11 +11,8 @@ const require_hot_bridge_constants = require('./hot-bridge-constants.cjs');
11
11
  const require_hot_bridge_utils = require('./hot-bridge-utils.cjs');
12
12
  const require_hex = require('../../lib/hex.cjs');
13
13
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
14
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
15
14
  let __hot_labs_omni_sdk = require("@hot-labs/omni-sdk");
16
- __hot_labs_omni_sdk = require_rolldown_runtime.__toESM(__hot_labs_omni_sdk);
17
15
  let __lifeomic_attempt = require("@lifeomic/attempt");
18
- __lifeomic_attempt = require_rolldown_runtime.__toESM(__lifeomic_attempt);
19
16
 
20
17
  //#region src/bridges/hot-bridge/hot-bridge.ts
21
18
  var HotBridge = class {
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/bridges/omni-bridge/error.ts
6
5
  var OmniTransferNotFoundError = class extends __defuse_protocol_internal_utils.BaseError {
@@ -74,8 +73,18 @@ var OmniWithdrawalApiFeeRequestTimeoutError = class extends __defuse_protocol_in
74
73
  super("Omni bridge withdrawal fee request timed out.", { name: "OmniWithdrawalApiFeeRequestTimeoutError" });
75
74
  }
76
75
  };
76
+ var InsufficientUtxoForOmniBridgeWithdrawalError = class extends __defuse_protocol_internal_utils.BaseError {
77
+ constructor(destinationChain) {
78
+ super("Insufficient utxo for withdrawal to a utxo chain.", {
79
+ metaMessages: [`Destination Chain: ${destinationChain}`],
80
+ name: "InsufficientUtxoForOmniBridgeWithdrawalError"
81
+ });
82
+ this.destinationChain = destinationChain;
83
+ }
84
+ };
77
85
 
78
86
  //#endregion
87
+ exports.InsufficientUtxoForOmniBridgeWithdrawalError = InsufficientUtxoForOmniBridgeWithdrawalError;
79
88
  exports.IntentsNearOmniAvailableBalanceTooLowError = IntentsNearOmniAvailableBalanceTooLowError;
80
89
  exports.InvalidFeeValueError = InvalidFeeValueError;
81
90
  exports.OmniTokenNormalisationCheckError = OmniTokenNormalisationCheckError;
@@ -55,5 +55,12 @@ type OmniWithdrawalApiFeeRequestTimeoutErrorType = OmniWithdrawalApiFeeRequestTi
55
55
  declare class OmniWithdrawalApiFeeRequestTimeoutError extends BaseError {
56
56
  constructor();
57
57
  }
58
+ type InsufficientUtxoForOmniBridgeWithdrawalErrorType = InsufficientUtxoForOmniBridgeWithdrawalError & {
59
+ name: "InsufficientUtxoForOmniBridgeWithdrawalError";
60
+ };
61
+ declare class InsufficientUtxoForOmniBridgeWithdrawalError extends BaseError {
62
+ destinationChain: Chain;
63
+ constructor(destinationChain: Chain);
64
+ }
58
65
  //#endregion
59
- export { IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
66
+ export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
@@ -55,5 +55,12 @@ type OmniWithdrawalApiFeeRequestTimeoutErrorType = OmniWithdrawalApiFeeRequestTi
55
55
  declare class OmniWithdrawalApiFeeRequestTimeoutError extends BaseError {
56
56
  constructor();
57
57
  }
58
+ type InsufficientUtxoForOmniBridgeWithdrawalErrorType = InsufficientUtxoForOmniBridgeWithdrawalError & {
59
+ name: "InsufficientUtxoForOmniBridgeWithdrawalError";
60
+ };
61
+ declare class InsufficientUtxoForOmniBridgeWithdrawalError extends BaseError {
62
+ destinationChain: Chain;
63
+ constructor(destinationChain: Chain);
64
+ }
58
65
  //#endregion
59
- export { IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
66
+ export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
@@ -72,6 +72,15 @@ var OmniWithdrawalApiFeeRequestTimeoutError = class extends BaseError {
72
72
  super("Omni bridge withdrawal fee request timed out.", { name: "OmniWithdrawalApiFeeRequestTimeoutError" });
73
73
  }
74
74
  };
75
+ var InsufficientUtxoForOmniBridgeWithdrawalError = class extends BaseError {
76
+ constructor(destinationChain) {
77
+ super("Insufficient utxo for withdrawal to a utxo chain.", {
78
+ metaMessages: [`Destination Chain: ${destinationChain}`],
79
+ name: "InsufficientUtxoForOmniBridgeWithdrawalError"
80
+ });
81
+ this.destinationChain = destinationChain;
82
+ }
83
+ };
75
84
 
76
85
  //#endregion
77
- export { IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError };
86
+ export { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError };
@@ -2,45 +2,52 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs
2
2
  const require_caip2 = require('../../lib/caip2.cjs');
3
3
  const require_omni_bridge_constants = require('./omni-bridge-constants.cjs');
4
4
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
6
5
  let omni_bridge_sdk = require("omni-bridge-sdk");
7
- omni_bridge_sdk = require_rolldown_runtime.__toESM(omni_bridge_sdk);
8
6
  let valibot = require("valibot");
9
7
  valibot = require_rolldown_runtime.__toESM(valibot);
10
8
 
11
9
  //#region src/bridges/omni-bridge/omni-bridge-utils.ts
12
10
  function createWithdrawIntentsPrimitive(params) {
13
11
  const { contractId: tokenAccountId, standard } = __defuse_protocol_internal_utils.utils.parseDefuseAssetId(params.assetId);
12
+ (0, __defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
14
13
  const recipient = (0, omni_bridge_sdk.omniAddress)(params.omniChainKind, params.destinationAddress);
15
- const implicitAccount = (0, omni_bridge_sdk.calculateStorageAccountId)({
16
- token: `near:${tokenAccountId}`,
17
- amount: params.amount,
14
+ let msg = "";
15
+ const ftWithdrawPayload = {
18
16
  recipient,
19
- fee: {
20
- fee: 0n,
21
- native_fee: params.nativeFee
22
- },
23
- sender: `near:${params.intentsContract}`,
24
- msg: ""
25
- });
26
- (0, __defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
27
- return [{
28
- deposit_for_account_id: implicitAccount,
17
+ fee: "0",
18
+ native_token_fee: params.nativeFee.toString()
19
+ };
20
+ if (isUtxoChain(params.omniChainKind)) {
21
+ (0, __defuse_protocol_internal_utils.assert)(params.utxoMaxGasFee !== null && params.utxoMaxGasFee > 0n, `Invalid utxo max gas fee: expected > 0, got ${params.utxoMaxGasFee}`);
22
+ msg = JSON.stringify({ MaxGasFee: params.utxoMaxGasFee.toString() });
23
+ ftWithdrawPayload.msg = msg;
24
+ }
25
+ const intents = [];
26
+ if (params.nativeFee > 0n) intents.push({
27
+ deposit_for_account_id: (0, omni_bridge_sdk.calculateStorageAccountId)({
28
+ token: `near:${tokenAccountId}`,
29
+ amount: params.amount,
30
+ recipient,
31
+ fee: {
32
+ fee: 0n,
33
+ native_fee: params.nativeFee
34
+ },
35
+ sender: `near:${params.intentsContract}`,
36
+ msg
37
+ }),
29
38
  amount: params.nativeFee.toString(),
30
39
  contract_id: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
31
40
  intent: "storage_deposit"
32
- }, {
41
+ });
42
+ intents.push({
33
43
  intent: "ft_withdraw",
34
44
  token: tokenAccountId,
35
45
  receiver_id: require_omni_bridge_constants.OMNI_BRIDGE_CONTRACT,
36
46
  amount: params.amount.toString(),
37
47
  storage_deposit: params.storageDepositAmount > 0n ? params.storageDepositAmount.toString() : void 0,
38
- msg: JSON.stringify({
39
- recipient,
40
- fee: "0",
41
- native_token_fee: params.nativeFee.toString()
42
- })
43
- }];
48
+ msg: JSON.stringify(ftWithdrawPayload)
49
+ });
50
+ return intents;
44
51
  }
45
52
  /**
46
53
  * Mapping between CAIP-2 chain identifiers and Omni Bridge ChainKind.
@@ -51,7 +58,8 @@ const CHAIN_MAPPINGS = [
51
58
  [require_caip2.Chains.Base, omni_bridge_sdk.ChainKind.Base],
52
59
  [require_caip2.Chains.Arbitrum, omni_bridge_sdk.ChainKind.Arb],
53
60
  [require_caip2.Chains.Solana, omni_bridge_sdk.ChainKind.Sol],
54
- [require_caip2.Chains.BNB, omni_bridge_sdk.ChainKind.Bnb]
61
+ [require_caip2.Chains.BNB, omni_bridge_sdk.ChainKind.Bnb],
62
+ [require_caip2.Chains.Bitcoin, omni_bridge_sdk.ChainKind.Btc]
55
63
  ];
56
64
  function caip2ToChainKind(network) {
57
65
  return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
@@ -59,6 +67,10 @@ function caip2ToChainKind(network) {
59
67
  function chainKindToCaip2(network) {
60
68
  return CHAIN_MAPPINGS.find(([_, kind]) => kind === network)?.[0] ?? null;
61
69
  }
70
+ const UTXO_CHAINS = [omni_bridge_sdk.ChainKind.Btc];
71
+ function isUtxoChain(network) {
72
+ return UTXO_CHAINS.includes(network);
73
+ }
62
74
  function validateOmniToken(nearAddress) {
63
75
  if (nearAddress.endsWith(".testnet")) return false;
64
76
  return (0, omni_bridge_sdk.isBridgeToken)(nearAddress);
@@ -130,4 +142,5 @@ exports.createWithdrawIntentsPrimitive = createWithdrawIntentsPrimitive;
130
142
  exports.getAccountOmniStorageBalance = getAccountOmniStorageBalance;
131
143
  exports.getBridgedToken = getBridgedToken;
132
144
  exports.getTokenDecimals = getTokenDecimals;
145
+ exports.isUtxoChain = isUtxoChain;
133
146
  exports.validateOmniToken = validateOmniToken;
@@ -7,36 +7,45 @@ import * as v from "valibot";
7
7
  //#region src/bridges/omni-bridge/omni-bridge-utils.ts
8
8
  function createWithdrawIntentsPrimitive(params) {
9
9
  const { contractId: tokenAccountId, standard } = utils.parseDefuseAssetId(params.assetId);
10
+ assert(standard === "nep141", "Only NEP-141 is supported");
10
11
  const recipient = omniAddress(params.omniChainKind, params.destinationAddress);
11
- const implicitAccount = calculateStorageAccountId({
12
- token: `near:${tokenAccountId}`,
13
- amount: params.amount,
12
+ let msg = "";
13
+ const ftWithdrawPayload = {
14
14
  recipient,
15
- fee: {
16
- fee: 0n,
17
- native_fee: params.nativeFee
18
- },
19
- sender: `near:${params.intentsContract}`,
20
- msg: ""
21
- });
22
- assert(standard === "nep141", "Only NEP-141 is supported");
23
- return [{
24
- deposit_for_account_id: implicitAccount,
15
+ fee: "0",
16
+ native_token_fee: params.nativeFee.toString()
17
+ };
18
+ if (isUtxoChain(params.omniChainKind)) {
19
+ assert(params.utxoMaxGasFee !== null && params.utxoMaxGasFee > 0n, `Invalid utxo max gas fee: expected > 0, got ${params.utxoMaxGasFee}`);
20
+ msg = JSON.stringify({ MaxGasFee: params.utxoMaxGasFee.toString() });
21
+ ftWithdrawPayload.msg = msg;
22
+ }
23
+ const intents = [];
24
+ if (params.nativeFee > 0n) intents.push({
25
+ deposit_for_account_id: calculateStorageAccountId({
26
+ token: `near:${tokenAccountId}`,
27
+ amount: params.amount,
28
+ recipient,
29
+ fee: {
30
+ fee: 0n,
31
+ native_fee: params.nativeFee
32
+ },
33
+ sender: `near:${params.intentsContract}`,
34
+ msg
35
+ }),
25
36
  amount: params.nativeFee.toString(),
26
37
  contract_id: OMNI_BRIDGE_CONTRACT,
27
38
  intent: "storage_deposit"
28
- }, {
39
+ });
40
+ intents.push({
29
41
  intent: "ft_withdraw",
30
42
  token: tokenAccountId,
31
43
  receiver_id: OMNI_BRIDGE_CONTRACT,
32
44
  amount: params.amount.toString(),
33
45
  storage_deposit: params.storageDepositAmount > 0n ? params.storageDepositAmount.toString() : void 0,
34
- msg: JSON.stringify({
35
- recipient,
36
- fee: "0",
37
- native_token_fee: params.nativeFee.toString()
38
- })
39
- }];
46
+ msg: JSON.stringify(ftWithdrawPayload)
47
+ });
48
+ return intents;
40
49
  }
41
50
  /**
42
51
  * Mapping between CAIP-2 chain identifiers and Omni Bridge ChainKind.
@@ -47,7 +56,8 @@ const CHAIN_MAPPINGS = [
47
56
  [Chains.Base, ChainKind.Base],
48
57
  [Chains.Arbitrum, ChainKind.Arb],
49
58
  [Chains.Solana, ChainKind.Sol],
50
- [Chains.BNB, ChainKind.Bnb]
59
+ [Chains.BNB, ChainKind.Bnb],
60
+ [Chains.Bitcoin, ChainKind.Btc]
51
61
  ];
52
62
  function caip2ToChainKind(network) {
53
63
  return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
@@ -55,6 +65,10 @@ function caip2ToChainKind(network) {
55
65
  function chainKindToCaip2(network) {
56
66
  return CHAIN_MAPPINGS.find(([_, kind]) => kind === network)?.[0] ?? null;
57
67
  }
68
+ const UTXO_CHAINS = [ChainKind.Btc];
69
+ function isUtxoChain(network) {
70
+ return UTXO_CHAINS.includes(network);
71
+ }
58
72
  function validateOmniToken(nearAddress) {
59
73
  if (nearAddress.endsWith(".testnet")) return false;
60
74
  return isBridgeToken(nearAddress);
@@ -120,4 +134,4 @@ async function getTokenDecimals(nearProvider, tokenAddress) {
120
134
  }
121
135
 
122
136
  //#endregion
123
- export { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, validateOmniToken };
137
+ export { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, isUtxoChain, validateOmniToken };
@@ -9,15 +9,11 @@ const require_error = require('./error.cjs');
9
9
  const require_omni_bridge_constants = require('./omni-bridge-constants.cjs');
10
10
  const require_omni_bridge_utils = require('./omni-bridge-utils.cjs');
11
11
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
12
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
13
12
  let lru_cache = require("lru-cache");
14
- lru_cache = require_rolldown_runtime.__toESM(lru_cache);
15
13
  let __lifeomic_attempt = require("@lifeomic/attempt");
16
- __lifeomic_attempt = require_rolldown_runtime.__toESM(__lifeomic_attempt);
17
14
  let __isaacs_ttlcache = require("@isaacs/ttlcache");
18
15
  __isaacs_ttlcache = require_rolldown_runtime.__toESM(__isaacs_ttlcache);
19
16
  let omni_bridge_sdk = require("omni-bridge-sdk");
20
- omni_bridge_sdk = require_rolldown_runtime.__toESM(omni_bridge_sdk);
21
17
 
22
18
  //#region src/bridges/omni-bridge/omni-bridge.ts
23
19
  var OmniBridge = class {
@@ -113,15 +109,38 @@ var OmniBridge = class {
113
109
  referral: args.referral
114
110
  });
115
111
  const relayerFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "relayerFee");
116
- (0, __defuse_protocol_internal_utils.assert)(relayerFee > 0n, `Invalid Omni bridge relayer fee: expected > 0, got ${relayerFee}`);
112
+ (0, __defuse_protocol_internal_utils.assert)(relayerFee >= 0n, `Invalid Omni bridge relayer fee: expected >= 0, got ${relayerFee}`);
113
+ let amount = args.withdrawalParams.amount;
114
+ let utxoMaxGasFee = null;
115
+ /**
116
+ * UTXO withdrawals add protocol + max gas fees to the intent amount since they're paid
117
+ * from the withdrawn asset, not wrap.near.
118
+ *
119
+ * Example with nep141:nbtc.bridge.near (made-up values):
120
+ * utxoFees = 50 + 50 = 100, relayerFee = 2 (excluded; paid in wrap.near)
121
+ *
122
+ * feeInclusive=false:
123
+ * - amount = 4000 → intent = 4000 + 100 = 4100 → user receives 4000
124
+ *
125
+ * feeInclusive=true:
126
+ * - amount = 3898 (4000 − 102) → intent = 3898 + 100 = 3998 → user receives 3898
127
+ **/
128
+ if (require_omni_bridge_utils.isUtxoChain(omniChainKind)) {
129
+ utxoMaxGasFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoMaxGasFee");
130
+ const utxoProtocolFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoProtocolFee");
131
+ (0, __defuse_protocol_internal_utils.assert)(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
132
+ (0, __defuse_protocol_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
133
+ amount += utxoMaxGasFee + utxoProtocolFee;
134
+ }
117
135
  intents.push(...require_omni_bridge_utils.createWithdrawIntentsPrimitive({
118
136
  assetId: args.withdrawalParams.assetId,
119
137
  destinationAddress: args.withdrawalParams.destinationAddress,
120
- amount: args.withdrawalParams.amount,
138
+ amount,
121
139
  omniChainKind,
122
140
  intentsContract: __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID,
123
141
  nativeFee: relayerFee,
124
- storageDepositAmount: require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "storageDepositFee")
142
+ storageDepositAmount: require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "storageDepositFee"),
143
+ utxoMaxGasFee
125
144
  }));
126
145
  return Promise.resolve(intents);
127
146
  }
@@ -144,17 +163,37 @@ var OmniBridge = class {
144
163
  const storageBalance = await require_omni_bridge_utils.getAccountOmniStorageBalance(this.nearProvider, __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID);
145
164
  const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
146
165
  if (intentsNearStorageBalance <= require_omni_bridge_constants.MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new require_error.IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
166
+ const utxoChainWithdrawal = require_omni_bridge_utils.isUtxoChain(omniChainKind);
167
+ if (utxoChainWithdrawal === false) {
168
+ const relayerFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "relayerFee");
169
+ (0, __defuse_protocol_internal_utils.assert)(require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "relayerFee") > 0n, `Invalid Omni Bridge relayer fee for non UTXO chain withdrawal: expected > 0, got ${relayerFee}`);
170
+ }
171
+ if (utxoChainWithdrawal) {
172
+ const fee = await (0, __defuse_protocol_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID), (0, omni_bridge_sdk.omniAddress)(omniChainKind, args.destinationAddress), (0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, assetInfo.contractId), args.amount), {
173
+ timeout: typeof window !== "undefined" ? 1e4 : 3e3,
174
+ errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
175
+ });
176
+ if (fee.insufficient_utxo) throw new require_error.InsufficientUtxoForOmniBridgeWithdrawalError(assetInfo.blockchain);
177
+ (0, __defuse_protocol_internal_utils.assert)(fee.min_amount !== null && fee.min_amount !== void 0 && BigInt(fee.min_amount) > 0n, `Invalid min amount value for a UTXO chain withdrawal: expected > 0, got ${fee.min_amount}`);
178
+ const minAmount = BigInt(fee.min_amount);
179
+ const utxoMaxGasFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoMaxGasFee");
180
+ const utxoProtocolFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoProtocolFee");
181
+ (0, __defuse_protocol_internal_utils.assert)(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
182
+ (0, __defuse_protocol_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
183
+ const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
184
+ if (actualAmountWithFee < minAmount) throw new require_errors.MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
185
+ }
147
186
  }
148
187
  async estimateWithdrawalFee(args) {
149
188
  const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
150
189
  (0, __defuse_protocol_internal_utils.assert)(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
151
190
  const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
152
191
  (0, __defuse_protocol_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
153
- const fee = await (0, __defuse_protocol_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID), (0, omni_bridge_sdk.omniAddress)(omniChainKind, args.withdrawalParams.destinationAddress), (0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, assetInfo.contractId)), {
192
+ const fee = await (0, __defuse_protocol_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID), (0, omni_bridge_sdk.omniAddress)(omniChainKind, args.withdrawalParams.destinationAddress), (0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, assetInfo.contractId), args.withdrawalParams.amount), {
154
193
  timeout: typeof window !== "undefined" ? 1e4 : 3e3,
155
194
  errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
156
195
  });
157
- if (fee.native_token_fee === null || fee.native_token_fee <= 0n) throw new require_error.InvalidFeeValueError(args.withdrawalParams.assetId, fee.native_token_fee);
196
+ if (fee.native_token_fee === null || fee.native_token_fee < 0n) throw new require_error.InvalidFeeValueError(args.withdrawalParams.assetId, fee.native_token_fee);
158
197
  const underlyingFees = {
159
198
  relayerFee: fee.native_token_fee,
160
199
  storageDepositFee: 0n
@@ -171,17 +210,29 @@ var OmniBridge = class {
171
210
  quote: null,
172
211
  underlyingFees: { [require_route_enum.RouteEnum.OmniBridge]: underlyingFees }
173
212
  };
174
- const quote = await require_estimate_fee.getFeeQuote({
175
- feeAmount: totalAmountToQuote,
176
- feeAssetId: require_omni_bridge_constants.NEAR_NATIVE_ASSET_ID,
177
- tokenAssetId: args.withdrawalParams.assetId,
178
- logger: args.logger,
179
- env: this.env,
180
- quoteOptions: args.quoteOptions,
181
- solverRelayApiKey: this.solverRelayApiKey
182
- });
213
+ let amount = 0n;
214
+ let quote = null;
215
+ if (totalAmountToQuote > 0n) {
216
+ quote = await require_estimate_fee.getFeeQuote({
217
+ feeAmount: totalAmountToQuote,
218
+ feeAssetId: require_omni_bridge_constants.NEAR_NATIVE_ASSET_ID,
219
+ tokenAssetId: args.withdrawalParams.assetId,
220
+ logger: args.logger,
221
+ env: this.env,
222
+ quoteOptions: args.quoteOptions,
223
+ solverRelayApiKey: this.solverRelayApiKey
224
+ });
225
+ amount += BigInt(quote.amount_in);
226
+ }
227
+ if (require_omni_bridge_utils.isUtxoChain(omniChainKind)) {
228
+ (0, __defuse_protocol_internal_utils.assert)(fee.gas_fee !== null && fee.gas_fee !== void 0 && fee.gas_fee > 0n, `Invalid Omni Bridge utxo gas fee: expected > 0, got ${fee.gas_fee}`);
229
+ (0, __defuse_protocol_internal_utils.assert)(fee.protocol_fee !== null && fee.protocol_fee !== void 0 && fee.protocol_fee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${fee.protocol_fee}`);
230
+ amount += fee.gas_fee + fee.protocol_fee;
231
+ underlyingFees.utxoMaxGasFee = fee.gas_fee;
232
+ underlyingFees.utxoProtocolFee = fee.protocol_fee;
233
+ }
183
234
  return {
184
- amount: BigInt(quote.amount_in),
235
+ amount,
185
236
  quote,
186
237
  underlyingFees: { [require_route_enum.RouteEnum.OmniBridge]: underlyingFees }
187
238
  };
@@ -195,6 +246,7 @@ var OmniBridge = class {
195
246
  let txHash = null;
196
247
  if ((0, omni_bridge_sdk.isEvmChain)(destinationChain)) txHash = transfer.finalised?.EVMLog?.transaction_hash;
197
248
  else if (destinationChain === omni_bridge_sdk.ChainKind.Sol) txHash = transfer.finalised?.Solana?.signature;
249
+ else if (destinationChain === omni_bridge_sdk.ChainKind.Btc) txHash = typeof window !== "undefined" ? transfer.utxo_transfer?.btc_pending_id : transfer.finalised?.UtxoLog?.transaction_hash;
198
250
  else return { hash: null };
199
251
  if (!txHash) throw new require_error.OmniTransferDestinationChainHashNotFoundError(args.tx.hash, omni_bridge_sdk.ChainKind[destinationChain].toLowerCase());
200
252
  return { hash: txHash };
@@ -1,12 +1,12 @@
1
1
  import { RouteEnum } from "../../constants/route-enum.js";
2
2
  import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
3
- import { InvalidDestinationAddressForWithdrawalError, UnsupportedAssetIdError } from "../../classes/errors.js";
3
+ import { InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError, UnsupportedAssetIdError } from "../../classes/errors.js";
4
4
  import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
5
5
  import { validateAddress } from "../../lib/validateAddress.js";
6
6
  import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
7
- import { IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./error.js";
7
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./error.js";
8
8
  import { MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
9
- import { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, validateOmniToken } from "./omni-bridge-utils.js";
9
+ import { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, isUtxoChain, validateOmniToken } from "./omni-bridge-utils.js";
10
10
  import { RETRY_CONFIGS, assert, configsByEnvironment, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "@defuse-protocol/internal-utils";
11
11
  import { LRUCache } from "lru-cache";
12
12
  import { retry } from "@lifeomic/attempt";
@@ -107,15 +107,38 @@ var OmniBridge = class {
107
107
  referral: args.referral
108
108
  });
109
109
  const relayerFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "relayerFee");
110
- assert(relayerFee > 0n, `Invalid Omni bridge relayer fee: expected > 0, got ${relayerFee}`);
110
+ assert(relayerFee >= 0n, `Invalid Omni bridge relayer fee: expected >= 0, got ${relayerFee}`);
111
+ let amount = args.withdrawalParams.amount;
112
+ let utxoMaxGasFee = null;
113
+ /**
114
+ * UTXO withdrawals add protocol + max gas fees to the intent amount since they're paid
115
+ * from the withdrawn asset, not wrap.near.
116
+ *
117
+ * Example with nep141:nbtc.bridge.near (made-up values):
118
+ * utxoFees = 50 + 50 = 100, relayerFee = 2 (excluded; paid in wrap.near)
119
+ *
120
+ * feeInclusive=false:
121
+ * - amount = 4000 → intent = 4000 + 100 = 4100 → user receives 4000
122
+ *
123
+ * feeInclusive=true:
124
+ * - amount = 3898 (4000 − 102) → intent = 3898 + 100 = 3998 → user receives 3898
125
+ **/
126
+ if (isUtxoChain(omniChainKind)) {
127
+ utxoMaxGasFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "utxoMaxGasFee");
128
+ const utxoProtocolFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "utxoProtocolFee");
129
+ assert(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
130
+ assert(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
131
+ amount += utxoMaxGasFee + utxoProtocolFee;
132
+ }
111
133
  intents.push(...createWithdrawIntentsPrimitive({
112
134
  assetId: args.withdrawalParams.assetId,
113
135
  destinationAddress: args.withdrawalParams.destinationAddress,
114
- amount: args.withdrawalParams.amount,
136
+ amount,
115
137
  omniChainKind,
116
138
  intentsContract: configsByEnvironment[this.env].contractID,
117
139
  nativeFee: relayerFee,
118
- storageDepositAmount: getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "storageDepositFee")
140
+ storageDepositAmount: getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "storageDepositFee"),
141
+ utxoMaxGasFee
119
142
  }));
120
143
  return Promise.resolve(intents);
121
144
  }
@@ -138,17 +161,37 @@ var OmniBridge = class {
138
161
  const storageBalance = await getAccountOmniStorageBalance(this.nearProvider, configsByEnvironment[this.env].contractID);
139
162
  const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
140
163
  if (intentsNearStorageBalance <= MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
164
+ const utxoChainWithdrawal = isUtxoChain(omniChainKind);
165
+ if (utxoChainWithdrawal === false) {
166
+ const relayerFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "relayerFee");
167
+ assert(getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "relayerFee") > 0n, `Invalid Omni Bridge relayer fee for non UTXO chain withdrawal: expected > 0, got ${relayerFee}`);
168
+ }
169
+ if (utxoChainWithdrawal) {
170
+ const fee = await withTimeout(() => this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, configsByEnvironment[this.env].contractID), omniAddress(omniChainKind, args.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId), args.amount), {
171
+ timeout: typeof window !== "undefined" ? 1e4 : 3e3,
172
+ errorInstance: new OmniWithdrawalApiFeeRequestTimeoutError()
173
+ });
174
+ if (fee.insufficient_utxo) throw new InsufficientUtxoForOmniBridgeWithdrawalError(assetInfo.blockchain);
175
+ assert(fee.min_amount !== null && fee.min_amount !== void 0 && BigInt(fee.min_amount) > 0n, `Invalid min amount value for a UTXO chain withdrawal: expected > 0, got ${fee.min_amount}`);
176
+ const minAmount = BigInt(fee.min_amount);
177
+ const utxoMaxGasFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "utxoMaxGasFee");
178
+ const utxoProtocolFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "utxoProtocolFee");
179
+ assert(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
180
+ assert(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
181
+ const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
182
+ if (actualAmountWithFee < minAmount) throw new MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
183
+ }
141
184
  }
142
185
  async estimateWithdrawalFee(args) {
143
186
  const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
144
187
  assert(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
145
188
  const omniChainKind = caip2ToChainKind(assetInfo.blockchain);
146
189
  assert(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
147
- const fee = await withTimeout(() => this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, configsByEnvironment[this.env].contractID), omniAddress(omniChainKind, args.withdrawalParams.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId)), {
190
+ const fee = await withTimeout(() => this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, configsByEnvironment[this.env].contractID), omniAddress(omniChainKind, args.withdrawalParams.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId), args.withdrawalParams.amount), {
148
191
  timeout: typeof window !== "undefined" ? 1e4 : 3e3,
149
192
  errorInstance: new OmniWithdrawalApiFeeRequestTimeoutError()
150
193
  });
151
- if (fee.native_token_fee === null || fee.native_token_fee <= 0n) throw new InvalidFeeValueError(args.withdrawalParams.assetId, fee.native_token_fee);
194
+ if (fee.native_token_fee === null || fee.native_token_fee < 0n) throw new InvalidFeeValueError(args.withdrawalParams.assetId, fee.native_token_fee);
152
195
  const underlyingFees = {
153
196
  relayerFee: fee.native_token_fee,
154
197
  storageDepositFee: 0n
@@ -165,17 +208,29 @@ var OmniBridge = class {
165
208
  quote: null,
166
209
  underlyingFees: { [RouteEnum.OmniBridge]: underlyingFees }
167
210
  };
168
- const quote = await getFeeQuote({
169
- feeAmount: totalAmountToQuote,
170
- feeAssetId: NEAR_NATIVE_ASSET_ID,
171
- tokenAssetId: args.withdrawalParams.assetId,
172
- logger: args.logger,
173
- env: this.env,
174
- quoteOptions: args.quoteOptions,
175
- solverRelayApiKey: this.solverRelayApiKey
176
- });
211
+ let amount = 0n;
212
+ let quote = null;
213
+ if (totalAmountToQuote > 0n) {
214
+ quote = await getFeeQuote({
215
+ feeAmount: totalAmountToQuote,
216
+ feeAssetId: NEAR_NATIVE_ASSET_ID,
217
+ tokenAssetId: args.withdrawalParams.assetId,
218
+ logger: args.logger,
219
+ env: this.env,
220
+ quoteOptions: args.quoteOptions,
221
+ solverRelayApiKey: this.solverRelayApiKey
222
+ });
223
+ amount += BigInt(quote.amount_in);
224
+ }
225
+ if (isUtxoChain(omniChainKind)) {
226
+ assert(fee.gas_fee !== null && fee.gas_fee !== void 0 && fee.gas_fee > 0n, `Invalid Omni Bridge utxo gas fee: expected > 0, got ${fee.gas_fee}`);
227
+ assert(fee.protocol_fee !== null && fee.protocol_fee !== void 0 && fee.protocol_fee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${fee.protocol_fee}`);
228
+ amount += fee.gas_fee + fee.protocol_fee;
229
+ underlyingFees.utxoMaxGasFee = fee.gas_fee;
230
+ underlyingFees.utxoProtocolFee = fee.protocol_fee;
231
+ }
177
232
  return {
178
- amount: BigInt(quote.amount_in),
233
+ amount,
179
234
  quote,
180
235
  underlyingFees: { [RouteEnum.OmniBridge]: underlyingFees }
181
236
  };
@@ -189,6 +244,7 @@ var OmniBridge = class {
189
244
  let txHash = null;
190
245
  if (isEvmChain(destinationChain)) txHash = transfer.finalised?.EVMLog?.transaction_hash;
191
246
  else if (destinationChain === ChainKind.Sol) txHash = transfer.finalised?.Solana?.signature;
247
+ else if (destinationChain === ChainKind.Btc) txHash = typeof window !== "undefined" ? transfer.utxo_transfer?.btc_pending_id : transfer.finalised?.UtxoLog?.transaction_hash;
192
248
  else return { hash: null };
193
249
  if (!txHash) throw new OmniTransferDestinationChainHashNotFoundError(args.tx.hash, ChainKind[destinationChain].toLowerCase());
194
250
  return { hash: txHash };
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_caip2 = require('../../lib/caip2.cjs');
3
3
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
5
4
 
6
5
  //#region src/bridges/poa-bridge/poa-bridge-utils.ts
7
6
  function createWithdrawIntentPrimitive(params) {
@@ -7,7 +7,6 @@ const require_validateAddress = require('../../lib/validateAddress.cjs');
7
7
  const require_bridge_name_enum = require('../../constants/bridge-name-enum.cjs');
8
8
  const require_poa_bridge_utils = require('./poa-bridge-utils.cjs');
9
9
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
10
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
11
10
  let __isaacs_ttlcache = require("@isaacs/ttlcache");
12
11
  __isaacs_ttlcache = require_rolldown_runtime.__toESM(__isaacs_ttlcache);
13
12
 
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/classes/errors.ts
6
5
  var FeeExceedsAmountError = class extends __defuse_protocol_internal_utils.BaseError {
@@ -1,10 +1,8 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let __scure_base = require("@scure/base");
3
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
4
3
  let valibot = require("valibot");
5
4
  valibot = require_rolldown_runtime.__toESM(valibot);
6
5
  let near_api_js_lib_utils_serialize = require("near-api-js/lib/utils/serialize");
7
- near_api_js_lib_utils_serialize = require_rolldown_runtime.__toESM(near_api_js_lib_utils_serialize);
8
6
 
9
7
  //#region src/intents/expirable-nonce.ts
10
8
  const VERSIONED_MAGIC_PREFIX = new Uint8Array([
@@ -2,7 +2,6 @@ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs
2
2
  const require_intent_hash = require('../intent-hash.cjs');
3
3
  const require_intent_payload_factory = require('../intent-payload-factory.cjs');
4
4
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
6
5
 
7
6
  //#region src/intents/intent-executer-impl/intent-executer.ts
8
7
  var IntentExecuter = class {
@@ -14,7 +13,7 @@ var IntentExecuter = class {
14
13
  this.intentSigner = args.intentSigner;
15
14
  this.onBeforePublishIntent = args.onBeforePublishIntent;
16
15
  }
17
- async signAndSendIntent({ relayParams: relayParamsFactory, salt, signedIntents,...intentParams }) {
16
+ async signAndSendIntent({ relayParams: relayParamsFactory, salt, signedIntents, ...intentParams }) {
18
17
  const verifyingContract = __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID;
19
18
  let intentPayload = require_intent_payload_factory.defaultIntentPayloadFactory(salt, {
20
19
  verifying_contract: verifyingContract,
@@ -52,7 +51,7 @@ var IntentExecuter = class {
52
51
  async function mergeIntentPayloads(defaultPayload, intentPayloadFactory, salt) {
53
52
  const customPayload = await intentPayloadFactory(defaultPayload);
54
53
  const customPayloadIntents = customPayload.intents ?? [];
55
- const { nonce: _nonce,...basePayload } = defaultPayload;
54
+ const { nonce: _nonce, ...basePayload } = defaultPayload;
56
55
  return require_intent_payload_factory.defaultIntentPayloadFactory(salt, {
57
56
  ...basePayload,
58
57
  ...customPayload,
@@ -12,7 +12,7 @@ var IntentExecuter = class {
12
12
  this.intentSigner = args.intentSigner;
13
13
  this.onBeforePublishIntent = args.onBeforePublishIntent;
14
14
  }
15
- async signAndSendIntent({ relayParams: relayParamsFactory, salt, signedIntents,...intentParams }) {
15
+ async signAndSendIntent({ relayParams: relayParamsFactory, salt, signedIntents, ...intentParams }) {
16
16
  const verifyingContract = configsByEnvironment[this.env].contractID;
17
17
  let intentPayload = defaultIntentPayloadFactory(salt, {
18
18
  verifying_contract: verifyingContract,
@@ -50,7 +50,7 @@ var IntentExecuter = class {
50
50
  async function mergeIntentPayloads(defaultPayload, intentPayloadFactory, salt) {
51
51
  const customPayload = await intentPayloadFactory(defaultPayload);
52
52
  const customPayloadIntents = customPayload.intents ?? [];
53
- const { nonce: _nonce,...basePayload } = defaultPayload;
53
+ const { nonce: _nonce, ...basePayload } = defaultPayload;
54
54
  return defaultIntentPayloadFactory(salt, {
55
55
  ...basePayload,
56
56
  ...customPayload,
@@ -7,7 +7,6 @@ const require_webauthn = require('./intent-hashes/webauthn.cjs');
7
7
  const require_ton_connect = require('./intent-hashes/ton-connect.cjs');
8
8
  const require_sep53 = require('./intent-hashes/sep53.cjs');
9
9
  let __scure_base = require("@scure/base");
10
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
11
10
 
12
11
  //#region src/intents/intent-hash.ts
13
12
  /**
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __noble_hashes_sha3 = require("@noble/hashes/sha3");
3
- __noble_hashes_sha3 = require_rolldown_runtime.__toESM(__noble_hashes_sha3);
4
3
 
5
4
  //#region src/intents/intent-hashes/erc191.ts
6
5
  /**
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_nep413 = require('../../lib/nep413.cjs');
3
3
  let __scure_base = require("@scure/base");
4
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
5
4
 
6
5
  //#region src/intents/intent-hashes/nep413.ts
7
6
  /**
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __noble_hashes_sha2 = require("@noble/hashes/sha2");
3
- __noble_hashes_sha2 = require_rolldown_runtime.__toESM(__noble_hashes_sha2);
4
3
 
5
4
  //#region src/intents/intent-hashes/raw-ed25519.ts
6
5
  /**
@@ -1,8 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
  let __noble_hashes_sha2 = require("@noble/hashes/sha2");
5
- __noble_hashes_sha2 = require_rolldown_runtime.__toESM(__noble_hashes_sha2);
6
4
 
7
5
  //#region src/intents/intent-hashes/sep53.ts
8
6
  /**
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __noble_hashes_sha3 = require("@noble/hashes/sha3");
3
- __noble_hashes_sha3 = require_rolldown_runtime.__toESM(__noble_hashes_sha3);
4
3
 
5
4
  //#region src/intents/intent-hashes/tip191.ts
6
5
  /**
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __noble_hashes_sha2 = require("@noble/hashes/sha2");
3
- __noble_hashes_sha2 = require_rolldown_runtime.__toESM(__noble_hashes_sha2);
4
3
 
5
4
  //#region src/intents/intent-hashes/ton-connect.ts
6
5
  /**
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __noble_hashes_sha2 = require("@noble/hashes/sha2");
3
- __noble_hashes_sha2 = require_rolldown_runtime.__toESM(__noble_hashes_sha2);
4
3
 
5
4
  //#region src/intents/intent-hashes/webauthn.ts
6
5
  /**
@@ -2,7 +2,6 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_expirable_nonce = require('./expirable-nonce.cjs');
3
3
  const require_intent_payload_factory = require('./intent-payload-factory.cjs');
4
4
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
6
5
 
7
6
  //#region src/intents/intent-payload-builder.ts
8
7
  /**
@@ -3,7 +3,7 @@ const require_expirable_nonce = require('./expirable-nonce.cjs');
3
3
  //#region src/intents/intent-payload-factory.ts
4
4
  const DEFAULT_DEADLINE_MS = 60 * 1e3;
5
5
  const DEFAULT_NONCE_DEADLINE_OFFSET_MS = DEFAULT_DEADLINE_MS;
6
- function defaultIntentPayloadFactory(salt, { intents, verifying_contract,...params }) {
6
+ function defaultIntentPayloadFactory(salt, { intents, verifying_contract, ...params }) {
7
7
  params = Object.fromEntries(Object.entries(params).filter(([, value]) => value !== void 0));
8
8
  const deadline = params.deadline != null ? new Date(params.deadline) : new Date(Date.now() + DEFAULT_DEADLINE_MS);
9
9
  const nonceDeadline = new Date(deadline.getTime() + DEFAULT_NONCE_DEADLINE_OFFSET_MS);
@@ -3,7 +3,7 @@ import { VersionedNonceBuilder } from "./expirable-nonce.js";
3
3
  //#region src/intents/intent-payload-factory.ts
4
4
  const DEFAULT_DEADLINE_MS = 60 * 1e3;
5
5
  const DEFAULT_NONCE_DEADLINE_OFFSET_MS = DEFAULT_DEADLINE_MS;
6
- function defaultIntentPayloadFactory(salt, { intents, verifying_contract,...params }) {
6
+ function defaultIntentPayloadFactory(salt, { intents, verifying_contract, ...params }) {
7
7
  params = Object.fromEntries(Object.entries(params).filter(([, value]) => value !== void 0));
8
8
  const deadline = params.deadline != null ? new Date(params.deadline) : new Date(Date.now() + DEFAULT_DEADLINE_MS);
9
9
  const nonceDeadline = new Date(deadline.getTime() + DEFAULT_NONCE_DEADLINE_OFFSET_MS);
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/intents/intent-relayer-impl/intent-relayer-public.ts
6
5
  var IntentRelayerPublic = class {
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_intent_signer_nep413 = require('./intent-signer-nep413.cjs');
3
3
  let __scure_base = require("@scure/base");
4
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
5
4
 
6
5
  //#region src/intents/intent-signer-impl/intent-signer-near-keypair.ts
7
6
  var IntentSignerNearKeypair = class extends require_intent_signer_nep413.IntentSignerNEP413 {
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_nep413 = require('../../lib/nep413.cjs');
3
3
  let __scure_base = require("@scure/base");
4
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
5
4
 
6
5
  //#region src/intents/intent-signer-impl/intent-signer-nep413.ts
7
6
  var IntentSignerNEP413 = class {
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/intents/intent-signer-impl/intent-signer-viem.ts
6
5
  var IntentSignerViem = class {
@@ -1,8 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
  let __scure_base = require("@scure/base");
5
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
6
4
  let valibot = require("valibot");
7
5
  valibot = require_rolldown_runtime.__toESM(valibot);
8
6
 
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/lib/array.ts
6
5
  function zip(arr1, arr2) {
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/lib/caip2.ts
6
5
  /**
@@ -2,7 +2,6 @@ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_caip2 = require('./caip2.cjs');
3
3
  const require_object = require('./object.cjs');
4
4
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
6
5
 
7
6
  //#region src/lib/configure-rpc-config.ts
8
7
  function configureEvmRpcUrls(defaultRpcUrls, userRpcUrls, supportedChains) {
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_apis = require('./tokensUsdPricesHttpClient/apis.cjs');
3
3
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
5
4
 
6
5
  //#region src/lib/estimate-fee.ts
7
6
  /**
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  let borsher = require("borsher");
3
- borsher = require_rolldown_runtime.__toESM(borsher);
4
3
 
5
4
  //#region src/lib/nep413.ts
6
5
  const nep413PayloadSchema = borsher.BorshSchema.Struct({
@@ -1,7 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_errors = require('../classes/errors.cjs');
3
3
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
5
4
 
6
5
  //#region src/lib/parse-defuse-asset-id.ts
7
6
  function parseDefuseAssetId(assetId) {
@@ -1,6 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
3
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
4
3
 
5
4
  //#region src/lib/tokensUsdPricesHttpClient/apis.ts
6
5
  async function tokens(config) {
@@ -1,17 +1,11 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
2
  const require_caip2 = require('./caip2.cjs');
3
3
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
5
4
  let viem = require("viem");
6
- viem = require_rolldown_runtime.__toESM(viem);
7
5
  let __noble_hashes_sha2 = require("@noble/hashes/sha2");
8
- __noble_hashes_sha2 = require_rolldown_runtime.__toESM(__noble_hashes_sha2);
9
6
  let __scure_base = require("@scure/base");
10
- __scure_base = require_rolldown_runtime.__toESM(__scure_base);
11
7
  let __solana_web3_js = require("@solana/web3.js");
12
- __solana_web3_js = require_rolldown_runtime.__toESM(__solana_web3_js);
13
8
  let ripple_address_codec = require("ripple-address-codec");
14
- ripple_address_codec = require_rolldown_runtime.__toESM(ripple_address_codec);
15
9
 
16
10
  //#region src/lib/validateAddress.ts
17
11
  function validateAddress(address, blockchain) {
package/dist/src/sdk.cjs CHANGED
@@ -20,11 +20,8 @@ const require_route_config = require('./lib/route-config.cjs');
20
20
  const require_salt_manager = require('./intents/salt-manager.cjs');
21
21
  const require_intent_payload_builder = require('./intents/intent-payload-builder.cjs');
22
22
  let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
23
- __defuse_protocol_internal_utils = require_rolldown_runtime.__toESM(__defuse_protocol_internal_utils);
24
23
  let __hot_labs_omni_sdk = require("@hot-labs/omni-sdk");
25
- __hot_labs_omni_sdk = require_rolldown_runtime.__toESM(__hot_labs_omni_sdk);
26
24
  let viem = require("viem");
27
- viem = require_rolldown_runtime.__toESM(viem);
28
25
  let valibot = require("valibot");
29
26
  valibot = require_rolldown_runtime.__toESM(valibot);
30
27
 
@@ -283,7 +283,7 @@ interface Bridge {
283
283
  routeConfig?: RouteConfig;
284
284
  logger?: ILogger;
285
285
  }): Promise<void>;
286
- estimateWithdrawalFee<T extends Pick<WithdrawalParams, "assetId" | "destinationAddress" | "routeConfig">>(args: {
286
+ estimateWithdrawalFee<T extends Pick<WithdrawalParams, "assetId" | "destinationAddress" | "routeConfig" | "amount">>(args: {
287
287
  withdrawalParams: T;
288
288
  quoteOptions?: QuoteOptions;
289
289
  logger?: ILogger;
@@ -283,7 +283,7 @@ interface Bridge {
283
283
  routeConfig?: RouteConfig;
284
284
  logger?: ILogger;
285
285
  }): Promise<void>;
286
- estimateWithdrawalFee<T extends Pick<WithdrawalParams, "assetId" | "destinationAddress" | "routeConfig">>(args: {
286
+ estimateWithdrawalFee<T extends Pick<WithdrawalParams, "assetId" | "destinationAddress" | "routeConfig" | "amount">>(args: {
287
287
  withdrawalParams: T;
288
288
  quoteOptions?: QuoteOptions;
289
289
  logger?: ILogger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defuse-protocol/intents-sdk",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -34,12 +34,12 @@
34
34
  "borsher": "^4.0.0",
35
35
  "lru-cache": "^11",
36
36
  "near-api-js": "^4.0.0 || ^5.0.0",
37
- "omni-bridge-sdk": "0.18.0",
37
+ "omni-bridge-sdk": "0.22.3",
38
38
  "ripple-address-codec": "^5.0.0",
39
39
  "valibot": "^1.0.0",
40
40
  "viem": "^2.0.0",
41
- "@defuse-protocol/contract-types": "0.4.1",
42
- "@defuse-protocol/internal-utils": "0.19.4"
41
+ "@defuse-protocol/contract-types": "0.4.2",
42
+ "@defuse-protocol/internal-utils": "0.19.5"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsdown": "0.15.5",