@defuse-protocol/intents-sdk 0.33.2 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/src/bridges/hot-bridge/error.cjs +6 -0
- package/dist/src/bridges/hot-bridge/error.d.cts +7 -1
- package/dist/src/bridges/hot-bridge/error.d.ts +7 -1
- package/dist/src/bridges/hot-bridge/error.js +6 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.cjs +1 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.d.cts +1 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.d.ts +1 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-chains.js +1 -0
- package/dist/src/bridges/hot-bridge/hot-bridge-utils.cjs +5 -1
- package/dist/src/bridges/hot-bridge/hot-bridge-utils.js +5 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.cjs +4 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.js +6 -3
- package/dist/src/bridges/omni-bridge/error.cjs +6 -0
- package/dist/src/bridges/omni-bridge/error.d.cts +7 -1
- package/dist/src/bridges/omni-bridge/error.d.ts +7 -1
- package/dist/src/bridges/omni-bridge/error.js +6 -1
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +4 -1
- package/dist/src/bridges/omni-bridge/omni-bridge.js +6 -3
- package/dist/src/constants/public-rpc-urls.cjs +1 -0
- package/dist/src/constants/public-rpc-urls.js +1 -0
- package/dist/src/lib/caip2.cjs +1 -0
- package/dist/src/lib/caip2.d.cts +1 -0
- package/dist/src/lib/caip2.d.ts +1 -0
- package/dist/src/lib/caip2.js +1 -0
- package/dist/src/lib/validateAddress.cjs +1 -0
- package/dist/src/lib/validateAddress.js +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ exports.Chains = require_caip2.Chains;
|
|
|
32
32
|
exports.DestinationExplicitNearAccountDoesntExistError = require_error.DestinationExplicitNearAccountDoesntExistError;
|
|
33
33
|
exports.FailedToFetchFeeError = require_error$2.FailedToFetchFeeError;
|
|
34
34
|
exports.FeeExceedsAmountError = require_errors.FeeExceedsAmountError;
|
|
35
|
+
exports.HotWithdrawalApiFeeRequestTimeoutError = require_error$1.HotWithdrawalApiFeeRequestTimeoutError;
|
|
35
36
|
exports.HotWithdrawalCancelledError = require_error$1.HotWithdrawalCancelledError;
|
|
36
37
|
exports.HotWithdrawalNotFoundError = require_error$1.HotWithdrawalNotFoundError;
|
|
37
38
|
exports.HotWithdrawalPendingError = require_error$1.HotWithdrawalPendingError;
|
|
@@ -54,6 +55,7 @@ exports.MinWithdrawalAmountError = require_errors.MinWithdrawalAmountError;
|
|
|
54
55
|
exports.OmniTokenNormalisationCheckError = require_error$2.OmniTokenNormalisationCheckError;
|
|
55
56
|
exports.OmniTransferDestinationChainHashNotFoundError = require_error$2.OmniTransferDestinationChainHashNotFoundError;
|
|
56
57
|
exports.OmniTransferNotFoundError = require_error$2.OmniTransferNotFoundError;
|
|
58
|
+
exports.OmniWithdrawalApiFeeRequestTimeoutError = require_error$2.OmniWithdrawalApiFeeRequestTimeoutError;
|
|
57
59
|
Object.defineProperty(exports, 'PoaWithdrawalInvariantError', {
|
|
58
60
|
enumerable: true,
|
|
59
61
|
get: function () {
|
package/dist/index.d.cts
CHANGED
|
@@ -12,8 +12,8 @@ import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSi
|
|
|
12
12
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.cjs";
|
|
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
|
-
import { HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
16
|
-
import { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
|
|
15
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
16
|
+
import { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, 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, FailedToFetchFeeError, type FailedToFetchFeeErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, 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, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniTokenNormalisationCheckError, type OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, type OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, type OmniTransferNotFoundErrorType, 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, FailedToFetchFeeError, type FailedToFetchFeeErrorType, 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, 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
|
@@ -12,8 +12,8 @@ import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSi
|
|
|
12
12
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
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
|
-
import { HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
16
|
-
import { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
|
|
15
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
16
|
+
import { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, 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, FailedToFetchFeeError, type FailedToFetchFeeErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, 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, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, OmniTokenNormalisationCheckError, type OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, type OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, type OmniTransferNotFoundErrorType, 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, FailedToFetchFeeError, type FailedToFetchFeeErrorType, 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, 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
|
@@ -3,8 +3,8 @@ import { FeeExceedsAmountError, MinWithdrawalAmountError, TrustlineNotFoundError
|
|
|
3
3
|
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
|
-
import { HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./src/bridges/hot-bridge/error.js";
|
|
7
|
-
import { FailedToFetchFeeError, IntentsNearOmniAvailableBalanceTooLowError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
|
|
6
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./src/bridges/hot-bridge/error.js";
|
|
7
|
+
import { FailedToFetchFeeError, IntentsNearOmniAvailableBalanceTooLowError, 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, FailedToFetchFeeError, FeeExceedsAmountError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, MinWithdrawalAmountError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, 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, FailedToFetchFeeError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, 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 };
|
|
@@ -33,8 +33,14 @@ var HotWithdrawalCancelledError = class extends __defuse_protocol_internal_utils
|
|
|
33
33
|
this.index = index;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
var HotWithdrawalApiFeeRequestTimeoutError = class extends __defuse_protocol_internal_utils.BaseError {
|
|
37
|
+
constructor() {
|
|
38
|
+
super("Hot bridge withdrawal fee request timed out.", { name: "HotWithdrawalApiFeeRequestTimeoutError" });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
36
41
|
|
|
37
42
|
//#endregion
|
|
43
|
+
exports.HotWithdrawalApiFeeRequestTimeoutError = HotWithdrawalApiFeeRequestTimeoutError;
|
|
38
44
|
exports.HotWithdrawalCancelledError = HotWithdrawalCancelledError;
|
|
39
45
|
exports.HotWithdrawalNotFoundError = HotWithdrawalNotFoundError;
|
|
40
46
|
exports.HotWithdrawalPendingError = HotWithdrawalPendingError;
|
|
@@ -25,5 +25,11 @@ declare class HotWithdrawalCancelledError extends BaseError {
|
|
|
25
25
|
index: number;
|
|
26
26
|
constructor(txHash: string, index: number);
|
|
27
27
|
}
|
|
28
|
+
type HotWithdrawalApiFeeRequestTimeoutErrorType = HotWithdrawalApiFeeRequestTimeoutError & {
|
|
29
|
+
name: "HotWithdrawalApiFeeRequestTimeoutError";
|
|
30
|
+
};
|
|
31
|
+
declare class HotWithdrawalApiFeeRequestTimeoutError extends BaseError {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
28
34
|
//#endregion
|
|
29
|
-
export { HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType };
|
|
35
|
+
export { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType };
|
|
@@ -25,5 +25,11 @@ declare class HotWithdrawalCancelledError extends BaseError {
|
|
|
25
25
|
index: number;
|
|
26
26
|
constructor(txHash: string, index: number);
|
|
27
27
|
}
|
|
28
|
+
type HotWithdrawalApiFeeRequestTimeoutErrorType = HotWithdrawalApiFeeRequestTimeoutError & {
|
|
29
|
+
name: "HotWithdrawalApiFeeRequestTimeoutError";
|
|
30
|
+
};
|
|
31
|
+
declare class HotWithdrawalApiFeeRequestTimeoutError extends BaseError {
|
|
32
|
+
constructor();
|
|
33
|
+
}
|
|
28
34
|
//#endregion
|
|
29
|
-
export { HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType };
|
|
35
|
+
export { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType };
|
|
@@ -31,6 +31,11 @@ var HotWithdrawalCancelledError = class extends BaseError {
|
|
|
31
31
|
this.index = index;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
+
var HotWithdrawalApiFeeRequestTimeoutError = class extends BaseError {
|
|
35
|
+
constructor() {
|
|
36
|
+
super("Hot bridge withdrawal fee request timed out.", { name: "HotWithdrawalApiFeeRequestTimeoutError" });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
34
39
|
|
|
35
40
|
//#endregion
|
|
36
|
-
export { HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError };
|
|
41
|
+
export { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/bridges/hot-bridge/hot-bridge-chains.d.ts
|
|
2
2
|
type HotBridgeChain = (typeof HotBridgeChains)[number];
|
|
3
3
|
type HotBridgeEVMChain = Extract<HotBridgeChain, `eip155:${string}`>;
|
|
4
|
-
declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:196" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
|
|
4
|
+
declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:143" | "eip155:196" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
|
|
5
5
|
//#endregion
|
|
6
6
|
export { HotBridgeEVMChain };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/bridges/hot-bridge/hot-bridge-chains.d.ts
|
|
2
2
|
type HotBridgeChain = (typeof HotBridgeChains)[number];
|
|
3
3
|
type HotBridgeEVMChain = Extract<HotBridgeChain, `eip155:${string}`>;
|
|
4
|
-
declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:196" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
|
|
4
|
+
declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:143" | "eip155:196" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
|
|
5
5
|
//#endregion
|
|
6
6
|
export { HotBridgeEVMChain };
|
|
@@ -7,9 +7,11 @@ let __hot_labs_omni_sdk = require("@hot-labs/omni-sdk");
|
|
|
7
7
|
__hot_labs_omni_sdk = require_rolldown_runtime.__toESM(__hot_labs_omni_sdk);
|
|
8
8
|
|
|
9
9
|
//#region src/bridges/hot-bridge/hot-bridge-utils.ts
|
|
10
|
+
const MONAD_MAINNET_NETWORK_ID = 143;
|
|
10
11
|
const nativeTokenMapping = {
|
|
11
12
|
[require_caip2.Chains.BNB]: "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
|
|
12
13
|
[require_caip2.Chains.Polygon]: "nep245:v2_1.omni.hot.tg:137_11111111111111111111",
|
|
14
|
+
[require_caip2.Chains.Monad]: "nep245:v2_1.omni.hot.tg:143_11111111111111111111",
|
|
13
15
|
[require_caip2.Chains.TON]: "nep245:v2_1.omni.hot.tg:1117_",
|
|
14
16
|
[require_caip2.Chains.Optimism]: "nep245:v2_1.omni.hot.tg:10_11111111111111111111",
|
|
15
17
|
[require_caip2.Chains.Avalanche]: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
|
|
@@ -19,6 +21,7 @@ const nativeTokenMapping = {
|
|
|
19
21
|
const caip2NetworkIdMapping = {
|
|
20
22
|
[require_caip2.Chains.BNB]: __hot_labs_omni_sdk.Network.Bnb,
|
|
21
23
|
[require_caip2.Chains.Polygon]: __hot_labs_omni_sdk.Network.Polygon,
|
|
24
|
+
[require_caip2.Chains.Monad]: MONAD_MAINNET_NETWORK_ID,
|
|
22
25
|
[require_caip2.Chains.TON]: __hot_labs_omni_sdk.Network.Ton,
|
|
23
26
|
[require_caip2.Chains.Optimism]: __hot_labs_omni_sdk.Network.Optimism,
|
|
24
27
|
[require_caip2.Chains.Avalanche]: __hot_labs_omni_sdk.Network.Avalanche,
|
|
@@ -34,7 +37,8 @@ function toHotNetworkId(caip2) {
|
|
|
34
37
|
return caip2NetworkIdMapping[caip2];
|
|
35
38
|
}
|
|
36
39
|
function hotNetworkIdToCAIP2(network) {
|
|
37
|
-
|
|
40
|
+
const mappedChain = networkIdCAIP2Mapping[network];
|
|
41
|
+
if (mappedChain != null) return mappedChain;
|
|
38
42
|
throw new Error(`Unsupported HOT Bridge chain = ${network}`);
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
@@ -4,9 +4,11 @@ import { assert } from "@defuse-protocol/internal-utils";
|
|
|
4
4
|
import { Network } from "@hot-labs/omni-sdk";
|
|
5
5
|
|
|
6
6
|
//#region src/bridges/hot-bridge/hot-bridge-utils.ts
|
|
7
|
+
const MONAD_MAINNET_NETWORK_ID = 143;
|
|
7
8
|
const nativeTokenMapping = {
|
|
8
9
|
[Chains.BNB]: "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
|
|
9
10
|
[Chains.Polygon]: "nep245:v2_1.omni.hot.tg:137_11111111111111111111",
|
|
11
|
+
[Chains.Monad]: "nep245:v2_1.omni.hot.tg:143_11111111111111111111",
|
|
10
12
|
[Chains.TON]: "nep245:v2_1.omni.hot.tg:1117_",
|
|
11
13
|
[Chains.Optimism]: "nep245:v2_1.omni.hot.tg:10_11111111111111111111",
|
|
12
14
|
[Chains.Avalanche]: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
|
|
@@ -16,6 +18,7 @@ const nativeTokenMapping = {
|
|
|
16
18
|
const caip2NetworkIdMapping = {
|
|
17
19
|
[Chains.BNB]: Network.Bnb,
|
|
18
20
|
[Chains.Polygon]: Network.Polygon,
|
|
21
|
+
[Chains.Monad]: MONAD_MAINNET_NETWORK_ID,
|
|
19
22
|
[Chains.TON]: Network.Ton,
|
|
20
23
|
[Chains.Optimism]: Network.Optimism,
|
|
21
24
|
[Chains.Avalanche]: Network.Avalanche,
|
|
@@ -31,7 +34,8 @@ function toHotNetworkId(caip2) {
|
|
|
31
34
|
return caip2NetworkIdMapping[caip2];
|
|
32
35
|
}
|
|
33
36
|
function hotNetworkIdToCAIP2(network) {
|
|
34
|
-
|
|
37
|
+
const mappedChain = networkIdCAIP2Mapping[network];
|
|
38
|
+
if (mappedChain != null) return mappedChain;
|
|
35
39
|
throw new Error(`Unsupported HOT Bridge chain = ${network}`);
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
@@ -103,10 +103,13 @@ var HotBridge = class {
|
|
|
103
103
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
104
104
|
(0, __defuse_protocol_internal_utils.assert)(assetInfo != null, "Asset is not supported");
|
|
105
105
|
require_hot_bridge_utils.hotBlockchainInvariant(assetInfo.blockchain);
|
|
106
|
-
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee({
|
|
106
|
+
const { gasPrice: feeAmount } = await (0, __defuse_protocol_internal_utils.withTimeout)(() => this.hotSdk.getGaslessWithdrawFee({
|
|
107
107
|
chain: require_hot_bridge_utils.toHotNetworkId(assetInfo.blockchain),
|
|
108
108
|
token: "native" in assetInfo ? "native" : assetInfo.address,
|
|
109
109
|
receiver: args.withdrawalParams.destinationAddress
|
|
110
|
+
}), {
|
|
111
|
+
errorInstance: new require_error.HotWithdrawalApiFeeRequestTimeoutError(),
|
|
112
|
+
timeout: typeof window !== "undefined" ? 1e4 : 3e3
|
|
110
113
|
});
|
|
111
114
|
const feeAssetId = require_hot_bridge_utils.getFeeAssetIdForChain(assetInfo.blockchain);
|
|
112
115
|
const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await require_estimate_fee.getFeeQuote({
|
|
@@ -5,11 +5,11 @@ import { getFeeQuote } from "../../lib/estimate-fee.js";
|
|
|
5
5
|
import { Chains } from "../../lib/caip2.js";
|
|
6
6
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
7
7
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
8
|
-
import { HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./error.js";
|
|
8
|
+
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./error.js";
|
|
9
9
|
import { HotWithdrawStatus } from "./hot-bridge-constants.js";
|
|
10
10
|
import { formatTxHash, getFeeAssetIdForChain, hotBlockchainInvariant, hotNetworkIdToCAIP2, toHotNetworkId } from "./hot-bridge-utils.js";
|
|
11
11
|
import isHex from "../../lib/hex.js";
|
|
12
|
-
import { RETRY_CONFIGS, assert } from "@defuse-protocol/internal-utils";
|
|
12
|
+
import { RETRY_CONFIGS, assert, withTimeout } from "@defuse-protocol/internal-utils";
|
|
13
13
|
import { OMNI_HOT_V2, utils as utils$1 } from "@hot-labs/omni-sdk";
|
|
14
14
|
import { retry } from "@lifeomic/attempt";
|
|
15
15
|
|
|
@@ -99,10 +99,13 @@ var HotBridge$1 = class {
|
|
|
99
99
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
100
100
|
assert(assetInfo != null, "Asset is not supported");
|
|
101
101
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
102
|
-
const { gasPrice: feeAmount } = await this.hotSdk.getGaslessWithdrawFee({
|
|
102
|
+
const { gasPrice: feeAmount } = await withTimeout(() => this.hotSdk.getGaslessWithdrawFee({
|
|
103
103
|
chain: toHotNetworkId(assetInfo.blockchain),
|
|
104
104
|
token: "native" in assetInfo ? "native" : assetInfo.address,
|
|
105
105
|
receiver: args.withdrawalParams.destinationAddress
|
|
106
|
+
}), {
|
|
107
|
+
errorInstance: new HotWithdrawalApiFeeRequestTimeoutError(),
|
|
108
|
+
timeout: typeof window !== "undefined" ? 1e4 : 3e3
|
|
106
109
|
});
|
|
107
110
|
const feeAssetId = getFeeAssetIdForChain(assetInfo.blockchain);
|
|
108
111
|
const feeQuote = args.withdrawalParams.assetId === feeAssetId || feeAmount === 0n ? null : await getFeeQuote({
|
|
@@ -69,6 +69,11 @@ var IntentsNearOmniAvailableBalanceTooLowError = class extends __defuse_protocol
|
|
|
69
69
|
this.balance = balance;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
var OmniWithdrawalApiFeeRequestTimeoutError = class extends __defuse_protocol_internal_utils.BaseError {
|
|
73
|
+
constructor() {
|
|
74
|
+
super("Omni bridge withdrawal fee request timed out.", { name: "OmniWithdrawalApiFeeRequestTimeoutError" });
|
|
75
|
+
}
|
|
76
|
+
};
|
|
72
77
|
|
|
73
78
|
//#endregion
|
|
74
79
|
exports.FailedToFetchFeeError = FailedToFetchFeeError;
|
|
@@ -76,4 +81,5 @@ exports.IntentsNearOmniAvailableBalanceTooLowError = IntentsNearOmniAvailableBal
|
|
|
76
81
|
exports.OmniTokenNormalisationCheckError = OmniTokenNormalisationCheckError;
|
|
77
82
|
exports.OmniTransferDestinationChainHashNotFoundError = OmniTransferDestinationChainHashNotFoundError;
|
|
78
83
|
exports.OmniTransferNotFoundError = OmniTransferNotFoundError;
|
|
84
|
+
exports.OmniWithdrawalApiFeeRequestTimeoutError = OmniWithdrawalApiFeeRequestTimeoutError;
|
|
79
85
|
exports.TokenNotFoundInDestinationChainError = TokenNotFoundInDestinationChainError;
|
|
@@ -49,5 +49,11 @@ declare class IntentsNearOmniAvailableBalanceTooLowError extends BaseError {
|
|
|
49
49
|
balance: string;
|
|
50
50
|
constructor(balance: string);
|
|
51
51
|
}
|
|
52
|
+
type OmniWithdrawalApiFeeRequestTimeoutErrorType = OmniWithdrawalApiFeeRequestTimeoutError & {
|
|
53
|
+
name: "OmniWithdrawalApiFeeRequestTimeoutError";
|
|
54
|
+
};
|
|
55
|
+
declare class OmniWithdrawalApiFeeRequestTimeoutError extends BaseError {
|
|
56
|
+
constructor();
|
|
57
|
+
}
|
|
52
58
|
//#endregion
|
|
53
|
-
export { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
59
|
+
export { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
@@ -49,5 +49,11 @@ declare class IntentsNearOmniAvailableBalanceTooLowError extends BaseError {
|
|
|
49
49
|
balance: string;
|
|
50
50
|
constructor(balance: string);
|
|
51
51
|
}
|
|
52
|
+
type OmniWithdrawalApiFeeRequestTimeoutErrorType = OmniWithdrawalApiFeeRequestTimeoutError & {
|
|
53
|
+
name: "OmniWithdrawalApiFeeRequestTimeoutError";
|
|
54
|
+
};
|
|
55
|
+
declare class OmniWithdrawalApiFeeRequestTimeoutError extends BaseError {
|
|
56
|
+
constructor();
|
|
57
|
+
}
|
|
52
58
|
//#endregion
|
|
53
|
-
export { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
59
|
+
export { FailedToFetchFeeError, FailedToFetchFeeErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, OmniTokenNormalisationCheckError, OmniTokenNormalisationCheckErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
@@ -67,6 +67,11 @@ var IntentsNearOmniAvailableBalanceTooLowError = class extends BaseError {
|
|
|
67
67
|
this.balance = balance;
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
+
var OmniWithdrawalApiFeeRequestTimeoutError = class extends BaseError {
|
|
71
|
+
constructor() {
|
|
72
|
+
super("Omni bridge withdrawal fee request timed out.", { name: "OmniWithdrawalApiFeeRequestTimeoutError" });
|
|
73
|
+
}
|
|
74
|
+
};
|
|
70
75
|
|
|
71
76
|
//#endregion
|
|
72
|
-
export { FailedToFetchFeeError, IntentsNearOmniAvailableBalanceTooLowError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, TokenNotFoundInDestinationChainError };
|
|
77
|
+
export { FailedToFetchFeeError, IntentsNearOmniAvailableBalanceTooLowError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError };
|
|
@@ -152,7 +152,10 @@ var OmniBridge = class {
|
|
|
152
152
|
(0, __defuse_protocol_internal_utils.assert)(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
|
|
153
153
|
const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
|
|
154
154
|
(0, __defuse_protocol_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
155
|
-
const fee = await 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))
|
|
155
|
+
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)), {
|
|
156
|
+
timeout: typeof window !== "undefined" ? 1e4 : 3e3,
|
|
157
|
+
errorInstance: new require_error.OmniWithdrawalApiFeeRequestTimeoutError()
|
|
158
|
+
});
|
|
156
159
|
if (fee.native_token_fee === null) throw new require_error.FailedToFetchFeeError(args.withdrawalParams.assetId);
|
|
157
160
|
const [minStorageBalance, currentStorageBalance] = await this.getCachedStorageDepositValue(assetInfo.contractId);
|
|
158
161
|
const totalAmountToQuote = fee.native_token_fee + (minStorageBalance > currentStorageBalance ? minStorageBalance - currentStorageBalance : 0n);
|
|
@@ -4,10 +4,10 @@ import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
|
|
|
4
4
|
import { getFeeQuote } from "../../lib/estimate-fee.js";
|
|
5
5
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
6
6
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
7
|
-
import { FailedToFetchFeeError, IntentsNearOmniAvailableBalanceTooLowError, OmniTokenNormalisationCheckError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, TokenNotFoundInDestinationChainError } from "./error.js";
|
|
7
|
+
import { FailedToFetchFeeError, IntentsNearOmniAvailableBalanceTooLowError, 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
9
|
import { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, validateOmniToken } from "./omni-bridge-utils.js";
|
|
10
|
-
import { RETRY_CONFIGS, assert, configsByEnvironment, getNearNep141MinStorageBalance, getNearNep141StorageBalance } from "@defuse-protocol/internal-utils";
|
|
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";
|
|
13
13
|
import TTLCache from "@isaacs/ttlcache";
|
|
@@ -146,7 +146,10 @@ var OmniBridge = class {
|
|
|
146
146
|
assert(assetInfo !== null, `Asset ${args.withdrawalParams.assetId} is not supported by Omni Bridge`);
|
|
147
147
|
const omniChainKind = caip2ToChainKind(assetInfo.blockchain);
|
|
148
148
|
assert(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
149
|
-
const fee = await this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, configsByEnvironment[this.env].contractID), omniAddress(omniChainKind, args.withdrawalParams.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId))
|
|
149
|
+
const fee = await withTimeout(() => this.omniBridgeAPI.getFee(omniAddress(ChainKind.Near, configsByEnvironment[this.env].contractID), omniAddress(omniChainKind, args.withdrawalParams.destinationAddress), omniAddress(ChainKind.Near, assetInfo.contractId)), {
|
|
150
|
+
timeout: typeof window !== "undefined" ? 1e4 : 3e3,
|
|
151
|
+
errorInstance: new OmniWithdrawalApiFeeRequestTimeoutError()
|
|
152
|
+
});
|
|
150
153
|
if (fee.native_token_fee === null) throw new FailedToFetchFeeError(args.withdrawalParams.assetId);
|
|
151
154
|
const [minStorageBalance, currentStorageBalance] = await this.getCachedStorageDepositValue(assetInfo.contractId);
|
|
152
155
|
const totalAmountToQuote = fee.native_token_fee + (minStorageBalance > currentStorageBalance ? minStorageBalance - currentStorageBalance : 0n);
|
|
@@ -7,6 +7,7 @@ const require_caip2 = require('../lib/caip2.cjs');
|
|
|
7
7
|
const PUBLIC_EVM_RPC_URLS = {
|
|
8
8
|
[require_caip2.Chains.BNB]: ["https://bsc-rpc.publicnode.com"],
|
|
9
9
|
[require_caip2.Chains.Polygon]: ["https://polygon-bor-rpc.publicnode.com"],
|
|
10
|
+
[require_caip2.Chains.Monad]: ["https://rpc.monad.xyz"],
|
|
10
11
|
[require_caip2.Chains.Optimism]: ["https://optimism-rpc.publicnode.com"],
|
|
11
12
|
[require_caip2.Chains.Avalanche]: ["https://avalanche-c-chain-rpc.publicnode.com"],
|
|
12
13
|
[require_caip2.Chains.LayerX]: ["https://rpc.xlayer.tech"]
|
|
@@ -7,6 +7,7 @@ import { Chains } from "../lib/caip2.js";
|
|
|
7
7
|
const PUBLIC_EVM_RPC_URLS = {
|
|
8
8
|
[Chains.BNB]: ["https://bsc-rpc.publicnode.com"],
|
|
9
9
|
[Chains.Polygon]: ["https://polygon-bor-rpc.publicnode.com"],
|
|
10
|
+
[Chains.Monad]: ["https://rpc.monad.xyz"],
|
|
10
11
|
[Chains.Optimism]: ["https://optimism-rpc.publicnode.com"],
|
|
11
12
|
[Chains.Avalanche]: ["https://avalanche-c-chain-rpc.publicnode.com"],
|
|
12
13
|
[Chains.LayerX]: ["https://rpc.xlayer.tech"]
|
package/dist/src/lib/caip2.cjs
CHANGED
package/dist/src/lib/caip2.d.cts
CHANGED
package/dist/src/lib/caip2.d.ts
CHANGED
package/dist/src/lib/caip2.js
CHANGED
|
@@ -34,6 +34,7 @@ function validateAddress(address, blockchain) {
|
|
|
34
34
|
case require_caip2.Chains.BNB:
|
|
35
35
|
case require_caip2.Chains.Gnosis:
|
|
36
36
|
case require_caip2.Chains.Polygon:
|
|
37
|
+
case require_caip2.Chains.Monad:
|
|
37
38
|
case require_caip2.Chains.LayerX:
|
|
38
39
|
case require_caip2.Chains.Base:
|
|
39
40
|
case require_caip2.Chains.Arbitrum:
|