@defuse-protocol/intents-sdk 0.45.2 → 0.46.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 (38) hide show
  1. package/dist/index.d.cts +2 -2
  2. package/dist/index.d.ts +2 -2
  3. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +3 -3
  4. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.js +3 -3
  5. package/dist/src/bridges/direct-bridge/direct-bridge.cjs +3 -3
  6. package/dist/src/bridges/direct-bridge/direct-bridge.js +3 -3
  7. package/dist/src/bridges/hot-bridge/hot-bridge.cjs +13 -9
  8. package/dist/src/bridges/hot-bridge/hot-bridge.js +13 -9
  9. package/dist/src/bridges/omni-bridge/omni-bridge.cjs +7 -7
  10. package/dist/src/bridges/omni-bridge/omni-bridge.js +8 -8
  11. package/dist/src/bridges/poa-bridge/poa-bridge.cjs +11 -6
  12. package/dist/src/bridges/poa-bridge/poa-bridge.js +12 -7
  13. package/dist/src/core/withdrawal-watcher.d.ts +1 -0
  14. package/dist/src/intents/intent-executer-impl/intent-executer.cjs +8 -4
  15. package/dist/src/intents/intent-executer-impl/intent-executer.d.cts +1 -1
  16. package/dist/src/intents/intent-executer-impl/intent-executer.d.ts +5 -1
  17. package/dist/src/intents/intent-executer-impl/intent-executer.js +8 -3
  18. package/dist/src/intents/intent-payload-builder.cjs +5 -5
  19. package/dist/src/intents/intent-payload-builder.d.cts +4 -4
  20. package/dist/src/intents/intent-payload-builder.d.ts +4 -4
  21. package/dist/src/intents/intent-payload-builder.js +6 -6
  22. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.cjs +5 -5
  23. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.js +6 -6
  24. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.d.ts +1 -0
  25. package/dist/src/intents/interfaces/intent-executer.d.ts +2 -0
  26. package/dist/src/intents/salt-manager.cjs +2 -2
  27. package/dist/src/intents/salt-manager.js +3 -3
  28. package/dist/src/lib/estimate-fee.cjs +4 -4
  29. package/dist/src/lib/estimate-fee.js +5 -5
  30. package/dist/src/lib/tokensUsdPricesHttpClient/apis.cjs +1 -1
  31. package/dist/src/lib/tokensUsdPricesHttpClient/apis.js +2 -2
  32. package/dist/src/sdk.cjs +18 -12
  33. package/dist/src/sdk.d.cts +35 -4
  34. package/dist/src/sdk.d.ts +35 -4
  35. package/dist/src/sdk.js +19 -13
  36. package/dist/src/shared-types.d.cts +7 -0
  37. package/dist/src/shared-types.d.ts +7 -0
  38. package/package.json +4 -4
package/dist/index.d.cts CHANGED
@@ -18,5 +18,5 @@ import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeo
18
18
  import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
19
19
  import { computeIntentHash } from "./src/intents/intent-hash.cjs";
20
20
  import { validateAddress } from "./src/lib/validateAddress.cjs";
21
- 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";
22
- 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, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, 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, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, 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, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
21
+ import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, 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";
22
+ export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, 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, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, 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, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
package/dist/index.d.ts CHANGED
@@ -18,5 +18,5 @@ import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeo
18
18
  import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
19
19
  import { computeIntentHash } from "./src/intents/intent-hash.js";
20
20
  import { validateAddress } from "./src/lib/validateAddress.js";
21
- 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";
22
- 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, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, 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, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, 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, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
21
+ import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, 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";
22
+ export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, 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, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, 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, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
@@ -11,9 +11,9 @@ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils")
11
11
 
12
12
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
13
13
  var AuroraEngineBridge = class {
14
- constructor({ env, nearProvider, solverRelayApiKey }) {
14
+ constructor({ envConfig, nearProvider, solverRelayApiKey }) {
15
15
  this.route = require_route_enum.RouteEnum.VirtualChain;
16
- this.env = env;
16
+ this.envConfig = envConfig;
17
17
  this.nearProvider = nearProvider;
18
18
  this.solverRelayApiKey = solverRelayApiKey;
19
19
  }
@@ -81,7 +81,7 @@ var AuroraEngineBridge = class {
81
81
  feeAssetId,
82
82
  tokenAssetId: args.withdrawalParams.assetId,
83
83
  logger: args.logger,
84
- env: this.env,
84
+ envConfig: this.envConfig,
85
85
  quoteOptions: args.quoteOptions,
86
86
  solverRelayApiKey: this.solverRelayApiKey
87
87
  });
@@ -10,9 +10,9 @@ import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, ut
10
10
 
11
11
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
12
12
  var AuroraEngineBridge = class {
13
- constructor({ env, nearProvider, solverRelayApiKey }) {
13
+ constructor({ envConfig, nearProvider, solverRelayApiKey }) {
14
14
  this.route = RouteEnum.VirtualChain;
15
- this.env = env;
15
+ this.envConfig = envConfig;
16
16
  this.nearProvider = nearProvider;
17
17
  this.solverRelayApiKey = solverRelayApiKey;
18
18
  }
@@ -80,7 +80,7 @@ var AuroraEngineBridge = class {
80
80
  feeAssetId,
81
81
  tokenAssetId: args.withdrawalParams.assetId,
82
82
  logger: args.logger,
83
- env: this.env,
83
+ envConfig: this.envConfig,
84
84
  quoteOptions: args.quoteOptions,
85
85
  solverRelayApiKey: this.solverRelayApiKey
86
86
  });
@@ -14,7 +14,7 @@ let lru_cache = require("lru-cache");
14
14
 
15
15
  //#region src/bridges/direct-bridge/direct-bridge.ts
16
16
  var DirectBridge = class {
17
- constructor({ env, nearProvider, solverRelayApiKey }) {
17
+ constructor({ envConfig, nearProvider, solverRelayApiKey }) {
18
18
  this.route = require_route_enum.RouteEnum.NearWithdrawal;
19
19
  this.storageDepositCache = new lru_cache.LRUCache({
20
20
  max: 100,
@@ -24,7 +24,7 @@ var DirectBridge = class {
24
24
  max: 100,
25
25
  ttl: 36e5
26
26
  });
27
- this.env = env;
27
+ this.envConfig = envConfig;
28
28
  this.nearProvider = nearProvider;
29
29
  this.solverRelayApiKey = solverRelayApiKey;
30
30
  }
@@ -97,7 +97,7 @@ var DirectBridge = class {
97
97
  feeAssetId,
98
98
  tokenAssetId: args.withdrawalParams.assetId,
99
99
  logger: args.logger,
100
- env: this.env,
100
+ envConfig: this.envConfig,
101
101
  quoteOptions: args.quoteOptions,
102
102
  solverRelayApiKey: this.solverRelayApiKey
103
103
  });
@@ -13,7 +13,7 @@ import { LRUCache } from "lru-cache";
13
13
 
14
14
  //#region src/bridges/direct-bridge/direct-bridge.ts
15
15
  var DirectBridge = class {
16
- constructor({ env, nearProvider, solverRelayApiKey }) {
16
+ constructor({ envConfig, nearProvider, solverRelayApiKey }) {
17
17
  this.route = RouteEnum.NearWithdrawal;
18
18
  this.storageDepositCache = new LRUCache({
19
19
  max: 100,
@@ -23,7 +23,7 @@ var DirectBridge = class {
23
23
  max: 100,
24
24
  ttl: 36e5
25
25
  });
26
- this.env = env;
26
+ this.envConfig = envConfig;
27
27
  this.nearProvider = nearProvider;
28
28
  this.solverRelayApiKey = solverRelayApiKey;
29
29
  }
@@ -96,7 +96,7 @@ var DirectBridge = class {
96
96
  feeAssetId,
97
97
  tokenAssetId: args.withdrawalParams.assetId,
98
98
  logger: args.logger,
99
- env: this.env,
99
+ envConfig: this.envConfig,
100
100
  quoteOptions: args.quoteOptions,
101
101
  solverRelayApiKey: this.solverRelayApiKey
102
102
  });
@@ -15,9 +15,9 @@ let _hot_labs_omni_sdk = require("@hot-labs/omni-sdk");
15
15
 
16
16
  //#region src/bridges/hot-bridge/hot-bridge.ts
17
17
  var HotBridge = class {
18
- constructor({ env, hotSdk, solverRelayApiKey }) {
18
+ constructor({ envConfig, hotSdk, solverRelayApiKey }) {
19
19
  this.route = require_route_enum.RouteEnum.HotBridge;
20
- this.env = env;
20
+ this.envConfig = envConfig;
21
21
  this.hotSdk = hotSdk;
22
22
  this.solverRelayApiKey = solverRelayApiKey;
23
23
  }
@@ -99,21 +99,25 @@ var HotBridge = class {
99
99
  const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
100
100
  (0, _defuse_protocol_internal_utils.assert)(assetInfo != null, "Asset is not supported");
101
101
  require_hot_bridge_utils.hotBlockchainInvariant(assetInfo.blockchain);
102
- const { gasPrice: feeAmount, blockNumber } = await (0, _defuse_protocol_internal_utils.withTimeout)(() => this.hotSdk.getGaslessWithdrawFee({
103
- chain: require_hot_bridge_utils.toHotNetworkId(assetInfo.blockchain),
104
- token: "native" in assetInfo ? "native" : assetInfo.address,
105
- receiver: args.withdrawalParams.destinationAddress
106
- }), {
102
+ const feeAssetId = require_hot_bridge_utils.getFeeAssetIdForChain(assetInfo.blockchain);
103
+ const { gasPrice: feeAmount, blockNumber } = await (0, _defuse_protocol_internal_utils.withTimeout)(async () => {
104
+ const result = await this.hotSdk.getGaslessWithdrawFee({
105
+ chain: require_hot_bridge_utils.toHotNetworkId(assetInfo.blockchain),
106
+ token: "native" in assetInfo ? "native" : assetInfo.address,
107
+ receiver: args.withdrawalParams.destinationAddress
108
+ });
109
+ if (assetInfo.blockchain === require_caip2.Chains.Plasma && args.withdrawalParams.assetId !== feeAssetId) result.gasPrice *= 20n;
110
+ return result;
111
+ }, {
107
112
  errorInstance: new require_error.HotWithdrawalApiFeeRequestTimeoutError(),
108
113
  timeout: typeof window !== "undefined" ? 1e4 : 3e3
109
114
  });
110
- const feeAssetId = require_hot_bridge_utils.getFeeAssetIdForChain(assetInfo.blockchain);
111
115
  const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await require_estimate_fee.getFeeQuote({
112
116
  feeAmount,
113
117
  feeAssetId,
114
118
  tokenAssetId: args.withdrawalParams.assetId,
115
119
  logger: args.logger,
116
- env: this.env,
120
+ envConfig: this.envConfig,
117
121
  quoteOptions: args.quoteOptions,
118
122
  solverRelayApiKey: this.solverRelayApiKey
119
123
  });
@@ -14,9 +14,9 @@ import { OMNI_HOT_V2, utils as utils$1 } from "@hot-labs/omni-sdk";
14
14
 
15
15
  //#region src/bridges/hot-bridge/hot-bridge.ts
16
16
  var HotBridge$1 = class {
17
- constructor({ env, hotSdk, solverRelayApiKey }) {
17
+ constructor({ envConfig, hotSdk, solverRelayApiKey }) {
18
18
  this.route = RouteEnum.HotBridge;
19
- this.env = env;
19
+ this.envConfig = envConfig;
20
20
  this.hotSdk = hotSdk;
21
21
  this.solverRelayApiKey = solverRelayApiKey;
22
22
  }
@@ -98,21 +98,25 @@ var HotBridge$1 = class {
98
98
  const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
99
99
  assert(assetInfo != null, "Asset is not supported");
100
100
  hotBlockchainInvariant(assetInfo.blockchain);
101
- const { gasPrice: feeAmount, blockNumber } = await withTimeout(() => this.hotSdk.getGaslessWithdrawFee({
102
- chain: toHotNetworkId(assetInfo.blockchain),
103
- token: "native" in assetInfo ? "native" : assetInfo.address,
104
- receiver: args.withdrawalParams.destinationAddress
105
- }), {
101
+ const feeAssetId = getFeeAssetIdForChain(assetInfo.blockchain);
102
+ const { gasPrice: feeAmount, blockNumber } = await withTimeout(async () => {
103
+ const result = await this.hotSdk.getGaslessWithdrawFee({
104
+ chain: toHotNetworkId(assetInfo.blockchain),
105
+ token: "native" in assetInfo ? "native" : assetInfo.address,
106
+ receiver: args.withdrawalParams.destinationAddress
107
+ });
108
+ if (assetInfo.blockchain === Chains.Plasma && args.withdrawalParams.assetId !== feeAssetId) result.gasPrice *= 20n;
109
+ return result;
110
+ }, {
106
111
  errorInstance: new HotWithdrawalApiFeeRequestTimeoutError(),
107
112
  timeout: typeof window !== "undefined" ? 1e4 : 3e3
108
113
  });
109
- const feeAssetId = getFeeAssetIdForChain(assetInfo.blockchain);
110
114
  const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await getFeeQuote({
111
115
  feeAmount,
112
116
  feeAssetId,
113
117
  tokenAssetId: args.withdrawalParams.assetId,
114
118
  logger: args.logger,
115
- env: this.env,
119
+ envConfig: this.envConfig,
116
120
  quoteOptions: args.quoteOptions,
117
121
  solverRelayApiKey: this.solverRelayApiKey
118
122
  });
@@ -17,7 +17,7 @@ let omni_bridge_sdk = require("omni-bridge-sdk");
17
17
 
18
18
  //#region src/bridges/omni-bridge/omni-bridge.ts
19
19
  var OmniBridge = class {
20
- constructor({ env, nearProvider, solverRelayApiKey, routeMigratedPoaTokensThroughOmniBridge }) {
20
+ constructor({ envConfig, nearProvider, solverRelayApiKey, routeMigratedPoaTokensThroughOmniBridge }) {
21
21
  this.route = require_route_enum.RouteEnum.OmniBridge;
22
22
  this.storageDepositCache = new lru_cache.LRUCache({
23
23
  max: 100,
@@ -25,7 +25,7 @@ var OmniBridge = class {
25
25
  });
26
26
  this.destinationChainAddressCache = new _isaacs_ttlcache.default({ ttl: 36e5 });
27
27
  this.tokenDecimalsCache = new _isaacs_ttlcache.default({ ttl: 36e5 });
28
- this.env = env;
28
+ this.envConfig = envConfig;
29
29
  this.nearProvider = nearProvider;
30
30
  this.omniBridgeAPI = new omni_bridge_sdk.OmniBridgeAPI();
31
31
  this.solverRelayApiKey = solverRelayApiKey;
@@ -140,7 +140,7 @@ var OmniBridge = class {
140
140
  destinationAddress: args.withdrawalParams.destinationAddress,
141
141
  amount,
142
142
  omniChainKind,
143
- intentsContract: _defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID,
143
+ intentsContract: this.envConfig.contractID,
144
144
  nativeFee: relayerFee,
145
145
  storageDepositAmount: require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "storageDepositFee"),
146
146
  utxoMaxGasFee
@@ -160,7 +160,7 @@ var OmniBridge = class {
160
160
  (0, _defuse_protocol_internal_utils.assert)(decimals !== null, `Failed to retrieve token decimals for address ${destTokenAddress} via OmniBridge contract.
161
161
  Ensure the token is supported and the address is correct.`);
162
162
  if ((0, omni_bridge_sdk.verifyTransferAmount)(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new require_errors.MinWithdrawalAmountError((0, omni_bridge_sdk.getMinimumTransferableAmount)(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
163
- const storageBalance = await require_omni_bridge_utils.getAccountOmniStorageBalance(this.nearProvider, _defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID);
163
+ const storageBalance = await require_omni_bridge_utils.getAccountOmniStorageBalance(this.nearProvider, this.envConfig.contractID);
164
164
  const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
165
165
  if (intentsNearStorageBalance <= require_omni_bridge_constants.MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new require_error.IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
166
166
  const utxoChainWithdrawal = require_omni_bridge_utils.isUtxoChain(omniChainKind);
@@ -169,7 +169,7 @@ var OmniBridge = class {
169
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
170
  }
171
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), {
172
+ const fee = await (0, _defuse_protocol_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, this.envConfig.contractID), (0, omni_bridge_sdk.omniAddress)(omniChainKind, args.destinationAddress), (0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, assetInfo.contractId), args.amount), {
173
173
  timeout: typeof window !== "undefined" ? 1e4 : 3e3,
174
174
  errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
175
175
  });
@@ -189,7 +189,7 @@ var OmniBridge = class {
189
189
  (0, _defuse_protocol_internal_utils.assert)(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
190
190
  const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
191
191
  (0, _defuse_protocol_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
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), {
192
+ const fee = await (0, _defuse_protocol_internal_utils.withTimeout)(() => this.omniBridgeAPI.getFee((0, omni_bridge_sdk.omniAddress)(omni_bridge_sdk.ChainKind.Near, this.envConfig.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), {
193
193
  timeout: typeof window !== "undefined" ? 1e4 : 3e3,
194
194
  errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
195
195
  });
@@ -218,7 +218,7 @@ var OmniBridge = class {
218
218
  feeAssetId: require_omni_bridge_constants.NEAR_NATIVE_ASSET_ID,
219
219
  tokenAssetId: args.withdrawalParams.assetId,
220
220
  logger: args.logger,
221
- env: this.env,
221
+ envConfig: this.envConfig,
222
222
  quoteOptions: args.quoteOptions,
223
223
  solverRelayApiKey: this.solverRelayApiKey
224
224
  });
@@ -8,14 +8,14 @@ import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableB
8
8
  import { MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
9
9
  import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "../../constants/poa-tokens-routable-through-omni-bridge.js";
10
10
  import { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, isUtxoChain, poaContractIdToChainKind, validateOmniToken } from "./omni-bridge-utils.js";
11
- import { assert, configsByEnvironment, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "@defuse-protocol/internal-utils";
11
+ import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "@defuse-protocol/internal-utils";
12
12
  import { LRUCache } from "lru-cache";
13
13
  import TTLCache from "@isaacs/ttlcache";
14
14
  import { ChainKind, OmniBridgeAPI, getChain, getMinimumTransferableAmount, isEvmChain, omniAddress, parseOriginChain, verifyTransferAmount } from "omni-bridge-sdk";
15
15
 
16
16
  //#region src/bridges/omni-bridge/omni-bridge.ts
17
17
  var OmniBridge = class {
18
- constructor({ env, nearProvider, solverRelayApiKey, routeMigratedPoaTokensThroughOmniBridge }) {
18
+ constructor({ envConfig, nearProvider, solverRelayApiKey, routeMigratedPoaTokensThroughOmniBridge }) {
19
19
  this.route = RouteEnum.OmniBridge;
20
20
  this.storageDepositCache = new LRUCache({
21
21
  max: 100,
@@ -23,7 +23,7 @@ var OmniBridge = class {
23
23
  });
24
24
  this.destinationChainAddressCache = new TTLCache({ ttl: 36e5 });
25
25
  this.tokenDecimalsCache = new TTLCache({ ttl: 36e5 });
26
- this.env = env;
26
+ this.envConfig = envConfig;
27
27
  this.nearProvider = nearProvider;
28
28
  this.omniBridgeAPI = new OmniBridgeAPI();
29
29
  this.solverRelayApiKey = solverRelayApiKey;
@@ -138,7 +138,7 @@ var OmniBridge = class {
138
138
  destinationAddress: args.withdrawalParams.destinationAddress,
139
139
  amount,
140
140
  omniChainKind,
141
- intentsContract: configsByEnvironment[this.env].contractID,
141
+ intentsContract: this.envConfig.contractID,
142
142
  nativeFee: relayerFee,
143
143
  storageDepositAmount: getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "storageDepositFee"),
144
144
  utxoMaxGasFee
@@ -158,7 +158,7 @@ var OmniBridge = class {
158
158
  assert(decimals !== null, `Failed to retrieve token decimals for address ${destTokenAddress} via OmniBridge contract.
159
159
  Ensure the token is supported and the address is correct.`);
160
160
  if (verifyTransferAmount(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new MinWithdrawalAmountError(getMinimumTransferableAmount(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
161
- const storageBalance = await getAccountOmniStorageBalance(this.nearProvider, configsByEnvironment[this.env].contractID);
161
+ const storageBalance = await getAccountOmniStorageBalance(this.nearProvider, this.envConfig.contractID);
162
162
  const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
163
163
  if (intentsNearStorageBalance <= MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
164
164
  const utxoChainWithdrawal = isUtxoChain(omniChainKind);
@@ -167,7 +167,7 @@ var OmniBridge = class {
167
167
  assert(getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "relayerFee") > 0n, `Invalid Omni Bridge relayer fee for non UTXO chain withdrawal: expected > 0, got ${relayerFee}`);
168
168
  }
169
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), {
170
+ const fee = await withTimeout(() => this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, this.envConfig.contractID), omniAddress(omniChainKind, args.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId), args.amount), {
171
171
  timeout: typeof window !== "undefined" ? 1e4 : 3e3,
172
172
  errorInstance: new OmniWithdrawalApiFeeRequestTimeoutError()
173
173
  });
@@ -187,7 +187,7 @@ var OmniBridge = class {
187
187
  assert(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
188
188
  const omniChainKind = caip2ToChainKind(assetInfo.blockchain);
189
189
  assert(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
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), {
190
+ const fee = await withTimeout(() => this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, this.envConfig.contractID), omniAddress(omniChainKind, args.withdrawalParams.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId), args.withdrawalParams.amount), {
191
191
  timeout: typeof window !== "undefined" ? 1e4 : 3e3,
192
192
  errorInstance: new OmniWithdrawalApiFeeRequestTimeoutError()
193
193
  });
@@ -216,7 +216,7 @@ var OmniBridge = class {
216
216
  feeAssetId: NEAR_NATIVE_ASSET_ID,
217
217
  tokenAssetId: args.withdrawalParams.assetId,
218
218
  logger: args.logger,
219
- env: this.env,
219
+ envConfig: this.envConfig,
220
220
  quoteOptions: args.quoteOptions,
221
221
  solverRelayApiKey: this.solverRelayApiKey
222
222
  });
@@ -13,12 +13,16 @@ _isaacs_ttlcache = require_rolldown_runtime.__toESM(_isaacs_ttlcache);
13
13
 
14
14
  //#region src/bridges/poa-bridge/poa-bridge.ts
15
15
  var PoaBridge = class {
16
- constructor({ env, routeMigratedPoaTokensThroughOmniBridge }) {
16
+ constructor({ envConfig, routeMigratedPoaTokensThroughOmniBridge }) {
17
17
  this.route = require_route_enum.RouteEnum.PoaBridge;
18
18
  this.supportedTokensCache = new _isaacs_ttlcache.default({ ttl: 30 * 1e3 });
19
- this.env = env;
19
+ this.envConfig = envConfig;
20
20
  this.routeMigratedPoaTokensThroughOmniBridge = routeMigratedPoaTokensThroughOmniBridge ?? false;
21
21
  }
22
+ getPoaBridgeBaseURL() {
23
+ if (!this.envConfig.poaBridgeBaseURL) throw new Error("POA Bridge is not available in this environment: poaBridgeBaseURL is not configured");
24
+ return this.envConfig.poaBridgeBaseURL;
25
+ }
22
26
  is(routeConfig) {
23
27
  return routeConfig.route === require_route_enum.RouteEnum.PoaBridge;
24
28
  }
@@ -31,8 +35,9 @@ var PoaBridge = class {
31
35
  return isValid;
32
36
  }
33
37
  parseAssetId(assetId) {
38
+ if (!this.envConfig.poaTokenFactoryContractID) return null;
34
39
  const parsed = require_parse_defuse_asset_id.parseDefuseAssetId(assetId);
35
- if (!parsed.contractId.endsWith(`.${_defuse_protocol_internal_utils.configsByEnvironment[this.env].poaTokenFactoryContractID}`)) return null;
40
+ if (!parsed.contractId.endsWith(`.${this.envConfig.poaTokenFactoryContractID}`)) return null;
36
41
  let blockchain;
37
42
  try {
38
43
  blockchain = require_poa_bridge_utils.contractIdToCaip2(parsed.contractId);
@@ -80,7 +85,7 @@ var PoaBridge = class {
80
85
  address: args.withdrawalParams.destinationAddress,
81
86
  chain: require_poa_bridge_utils.toPoaNetwork(assetInfo.blockchain)
82
87
  }, {
83
- baseURL: _defuse_protocol_internal_utils.configsByEnvironment[this.env].poaBridgeBaseURL,
88
+ baseURL: this.getPoaBridgeBaseURL(),
84
89
  logger: args.logger
85
90
  });
86
91
  const relayerFee = BigInt(estimation.withdrawalFee);
@@ -118,7 +123,7 @@ var PoaBridge = class {
118
123
  const startTime = Date.now();
119
124
  while (true) try {
120
125
  return await _defuse_protocol_internal_utils.poaBridge.httpClient.getWithdrawalStatus({ withdrawal_hash: args.tx.hash }, {
121
- baseURL: _defuse_protocol_internal_utils.configsByEnvironment[this.env].poaBridgeBaseURL,
126
+ baseURL: this.getPoaBridgeBaseURL(),
122
127
  logger: args.logger
123
128
  });
124
129
  } catch (err) {
@@ -137,7 +142,7 @@ var PoaBridge = class {
137
142
  const cached = this.supportedTokensCache.get(cacheKey);
138
143
  if (cached != null) return cached;
139
144
  const data = await _defuse_protocol_internal_utils.poaBridge.httpClient.getSupportedTokens({ chains }, {
140
- baseURL: _defuse_protocol_internal_utils.configsByEnvironment[this.env].poaBridgeBaseURL,
145
+ baseURL: this.getPoaBridgeBaseURL(),
141
146
  logger
142
147
  });
143
148
  this.supportedTokensCache.set(cacheKey, data);
@@ -6,17 +6,21 @@ import { validateAddress } from "../../lib/validateAddress.js";
6
6
  import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
7
7
  import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "../../constants/poa-tokens-routable-through-omni-bridge.js";
8
8
  import { contractIdToCaip2, createWithdrawIntentPrimitive, toPoaNetwork } from "./poa-bridge-utils.js";
9
- import { RpcRequestError, assert, configsByEnvironment, poaBridge, utils } from "@defuse-protocol/internal-utils";
9
+ import { RpcRequestError, assert, poaBridge, utils } from "@defuse-protocol/internal-utils";
10
10
  import TTLCache from "@isaacs/ttlcache";
11
11
 
12
12
  //#region src/bridges/poa-bridge/poa-bridge.ts
13
13
  var PoaBridge = class {
14
- constructor({ env, routeMigratedPoaTokensThroughOmniBridge }) {
14
+ constructor({ envConfig, routeMigratedPoaTokensThroughOmniBridge }) {
15
15
  this.route = RouteEnum.PoaBridge;
16
16
  this.supportedTokensCache = new TTLCache({ ttl: 30 * 1e3 });
17
- this.env = env;
17
+ this.envConfig = envConfig;
18
18
  this.routeMigratedPoaTokensThroughOmniBridge = routeMigratedPoaTokensThroughOmniBridge ?? false;
19
19
  }
20
+ getPoaBridgeBaseURL() {
21
+ if (!this.envConfig.poaBridgeBaseURL) throw new Error("POA Bridge is not available in this environment: poaBridgeBaseURL is not configured");
22
+ return this.envConfig.poaBridgeBaseURL;
23
+ }
20
24
  is(routeConfig) {
21
25
  return routeConfig.route === RouteEnum.PoaBridge;
22
26
  }
@@ -29,8 +33,9 @@ var PoaBridge = class {
29
33
  return isValid;
30
34
  }
31
35
  parseAssetId(assetId) {
36
+ if (!this.envConfig.poaTokenFactoryContractID) return null;
32
37
  const parsed = parseDefuseAssetId(assetId);
33
- if (!parsed.contractId.endsWith(`.${configsByEnvironment[this.env].poaTokenFactoryContractID}`)) return null;
38
+ if (!parsed.contractId.endsWith(`.${this.envConfig.poaTokenFactoryContractID}`)) return null;
34
39
  let blockchain;
35
40
  try {
36
41
  blockchain = contractIdToCaip2(parsed.contractId);
@@ -78,7 +83,7 @@ var PoaBridge = class {
78
83
  address: args.withdrawalParams.destinationAddress,
79
84
  chain: toPoaNetwork(assetInfo.blockchain)
80
85
  }, {
81
- baseURL: configsByEnvironment[this.env].poaBridgeBaseURL,
86
+ baseURL: this.getPoaBridgeBaseURL(),
82
87
  logger: args.logger
83
88
  });
84
89
  const relayerFee = BigInt(estimation.withdrawalFee);
@@ -116,7 +121,7 @@ var PoaBridge = class {
116
121
  const startTime = Date.now();
117
122
  while (true) try {
118
123
  return await poaBridge.httpClient.getWithdrawalStatus({ withdrawal_hash: args.tx.hash }, {
119
- baseURL: configsByEnvironment[this.env].poaBridgeBaseURL,
124
+ baseURL: this.getPoaBridgeBaseURL(),
120
125
  logger: args.logger
121
126
  });
122
127
  } catch (err) {
@@ -135,7 +140,7 @@ var PoaBridge = class {
135
140
  const cached = this.supportedTokensCache.get(cacheKey);
136
141
  if (cached != null) return cached;
137
142
  const data = await poaBridge.httpClient.getSupportedTokens({ chains }, {
138
- baseURL: configsByEnvironment[this.env].poaBridgeBaseURL,
143
+ baseURL: this.getPoaBridgeBaseURL(),
139
144
  logger
140
145
  });
141
146
  this.supportedTokensCache.set(cacheKey, data);
@@ -1,3 +1,4 @@
1
+ import "../shared-types.js";
1
2
  import { BaseError, ILogger } from "@defuse-protocol/internal-utils";
2
3
 
3
4
  //#region src/core/withdrawal-watcher.d.ts
@@ -1,12 +1,10 @@
1
- const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
1
  const require_intent_hash = require('../intent-hash.cjs');
3
2
  const require_intent_payload_factory = require('../intent-payload-factory.cjs');
4
- let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
3
 
6
4
  //#region src/intents/intent-executer-impl/intent-executer.ts
7
5
  var IntentExecuter = class {
8
6
  constructor(args) {
9
- this.env = args.env;
7
+ this.envConfig = args.envConfig;
10
8
  this.logger = args.logger;
11
9
  this.intentPayloadFactory = args.intentPayloadFactory;
12
10
  this.intentRelayer = args.intentRelayer;
@@ -14,7 +12,7 @@ var IntentExecuter = class {
14
12
  this.onBeforePublishIntent = args.onBeforePublishIntent;
15
13
  }
16
14
  async signAndSendIntent({ relayParams: relayParamsFactory, salt, signedIntents, ...intentParams }) {
17
- const verifyingContract = _defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID;
15
+ const verifyingContract = this.envConfig.contractID;
18
16
  let intentPayload = require_intent_payload_factory.defaultIntentPayloadFactory(salt, {
19
17
  verifying_contract: verifyingContract,
20
18
  ...intentParams
@@ -50,6 +48,12 @@ var IntentExecuter = class {
50
48
  signal: ctx?.signal
51
49
  });
52
50
  }
51
+ async sendSignedIntents(params) {
52
+ return { tickets: await this.intentRelayer.publishIntents({
53
+ multiPayloads: params.multiPayloads,
54
+ quoteHashes: params.quoteHashes ?? []
55
+ }, { logger: this.logger }) };
56
+ }
53
57
  };
54
58
  async function mergeIntentPayloads(defaultPayload, intentPayloadFactory, salt) {
55
59
  const customPayload = await intentPayloadFactory(defaultPayload);
@@ -1,5 +1,5 @@
1
1
  import { IntentHash, IntentPayload, MultiPayload, RelayParamsDefault } from "../shared-types.cjs";
2
- import { ILogger, NearIntentsEnv } from "@defuse-protocol/internal-utils";
2
+ import { EnvConfig, ILogger } from "@defuse-protocol/internal-utils";
3
3
 
4
4
  //#region src/intents/intent-executer-impl/intent-executer.d.ts
5
5
 
@@ -1,5 +1,9 @@
1
+ import "../expirable-nonce.js";
1
2
  import { IntentHash, IntentPayload, MultiPayload, RelayParamsDefault } from "../shared-types.js";
2
- import { ILogger, NearIntentsEnv } from "@defuse-protocol/internal-utils";
3
+ import "../interfaces/intent-executer.js";
4
+ import "../../shared-types.js";
5
+ import "../interfaces/intent-relayer.js";
6
+ import { EnvConfig, ILogger } from "@defuse-protocol/internal-utils";
3
7
 
4
8
  //#region src/intents/intent-executer-impl/intent-executer.d.ts
5
9
 
@@ -1,11 +1,10 @@
1
1
  import { computeIntentHash } from "../intent-hash.js";
2
2
  import { defaultIntentPayloadFactory } from "../intent-payload-factory.js";
3
- import { configsByEnvironment } from "@defuse-protocol/internal-utils";
4
3
 
5
4
  //#region src/intents/intent-executer-impl/intent-executer.ts
6
5
  var IntentExecuter = class {
7
6
  constructor(args) {
8
- this.env = args.env;
7
+ this.envConfig = args.envConfig;
9
8
  this.logger = args.logger;
10
9
  this.intentPayloadFactory = args.intentPayloadFactory;
11
10
  this.intentRelayer = args.intentRelayer;
@@ -13,7 +12,7 @@ var IntentExecuter = class {
13
12
  this.onBeforePublishIntent = args.onBeforePublishIntent;
14
13
  }
15
14
  async signAndSendIntent({ relayParams: relayParamsFactory, salt, signedIntents, ...intentParams }) {
16
- const verifyingContract = configsByEnvironment[this.env].contractID;
15
+ const verifyingContract = this.envConfig.contractID;
17
16
  let intentPayload = defaultIntentPayloadFactory(salt, {
18
17
  verifying_contract: verifyingContract,
19
18
  ...intentParams
@@ -49,6 +48,12 @@ var IntentExecuter = class {
49
48
  signal: ctx?.signal
50
49
  });
51
50
  }
51
+ async sendSignedIntents(params) {
52
+ return { tickets: await this.intentRelayer.publishIntents({
53
+ multiPayloads: params.multiPayloads,
54
+ quoteHashes: params.quoteHashes ?? []
55
+ }, { logger: this.logger }) };
56
+ }
52
57
  };
53
58
  async function mergeIntentPayloads(defaultPayload, intentPayloadFactory, salt) {
54
59
  const customPayload = await intentPayloadFactory(defaultPayload);
@@ -31,9 +31,9 @@ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils")
31
31
  var IntentPayloadBuilder = class IntentPayloadBuilder {
32
32
  constructor(config) {
33
33
  this.intents = [];
34
- this.env = config.env;
34
+ this.envConfig = config.envConfig;
35
35
  this.saltManager = config.saltManager;
36
- this.verifyingContract = _defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID;
36
+ this.verifyingContract = this.envConfig.contractID;
37
37
  }
38
38
  /**
39
39
  * Set the signer ID (address or account that will sign the intent).
@@ -122,7 +122,7 @@ var IntentPayloadBuilder = class IntentPayloadBuilder {
122
122
  this.deadline = void 0;
123
123
  this.intents = [];
124
124
  this.customNonce = void 0;
125
- this.verifyingContract = _defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID;
125
+ this.verifyingContract = this.envConfig.contractID;
126
126
  return this;
127
127
  }
128
128
  /**
@@ -176,7 +176,7 @@ var IntentPayloadBuilder = class IntentPayloadBuilder {
176
176
  */
177
177
  clone() {
178
178
  const builder = new IntentPayloadBuilder({
179
- env: this.env,
179
+ envConfig: this.envConfig,
180
180
  saltManager: this.saltManager
181
181
  });
182
182
  builder.verifyingContract = this.verifyingContract;
@@ -194,7 +194,7 @@ var IntentPayloadBuilder = class IntentPayloadBuilder {
194
194
  */
195
195
  getState() {
196
196
  return {
197
- env: this.env,
197
+ envConfig: this.envConfig,
198
198
  verifyingContract: this.verifyingContract,
199
199
  signerId: this.signerId,
200
200
  deadline: this.deadline,