@defuse-protocol/intents-sdk 0.87.0 → 0.88.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 +1 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/src/bridges/omni-bridge/error.cjs +12 -1
- package/dist/src/bridges/omni-bridge/error.d.cts +9 -1
- package/dist/src/bridges/omni-bridge/error.d.ts +9 -1
- package/dist/src/bridges/omni-bridge/error.js +11 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.cjs +8 -0
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.js +8 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +2 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +2 -1
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +12 -3
- package/dist/src/bridges/omni-bridge/omni-bridge.js +14 -5
- package/dist/src/bridges/omni-bridge/omni-withdraw-params.cjs +2 -1
- package/dist/src/bridges/omni-bridge/omni-withdraw-params.d.cts +1 -0
- package/dist/src/bridges/omni-bridge/omni-withdraw-params.d.ts +1 -0
- package/dist/src/bridges/omni-bridge/omni-withdraw-params.js +3 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -113,6 +113,7 @@ Object.defineProperty(exports, 'TimeoutError', {
|
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
exports.TokenNotFoundInDestinationChainError = require_error$2.TokenNotFoundInDestinationChainError;
|
|
116
|
+
exports.TokenNotLinkedToHyperCoreError = require_error$2.TokenNotLinkedToHyperCoreError;
|
|
116
117
|
exports.TrustlineNotFoundError = require_errors.TrustlineNotFoundError;
|
|
117
118
|
exports.UnsupportedAssetIdError = require_errors.UnsupportedAssetIdError;
|
|
118
119
|
exports.UnsupportedDestinationMemoError = require_errors.UnsupportedDestinationMemoError;
|
package/dist/index.d.cts
CHANGED
|
@@ -17,9 +17,9 @@ import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError,
|
|
|
17
17
|
import { DestinationAddressMatchesTokenAddressError, DestinationAddressMatchesTokenAddressErrorType, FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
|
|
18
18
|
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.cjs";
|
|
19
19
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
20
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
|
|
20
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType, TokenNotLinkedToHyperCoreError, TokenNotLinkedToHyperCoreErrorType } from "./src/bridges/omni-bridge/error.cjs";
|
|
21
21
|
import { XrplDepositAuthEnabledError, XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, XrplDestinationTagRequiredErrorType } from "./src/bridges/poa-bridge/errors.cjs";
|
|
22
22
|
import { computeIntentHash } from "./src/intents/intent-hash.cjs";
|
|
23
23
|
import { validateAddress } from "./src/lib/validateAddress.cjs";
|
|
24
24
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RelayPublishRejectedError, RelayPublishRejectedErrorType, RelayPublishResultUnknownError, RelayPublishResultUnknownErrorType, RetryOptions, RpcEndpoint, RpcEndpointConfig, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
25
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationAddressMatchesTokenAddressError, type DestinationAddressMatchesTokenAddressErrorType, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, 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 Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, type QuoteOptions, RelayPublishError, type RelayPublishErrorType, RelayPublishRejectedError, type RelayPublishRejectedErrorType, RelayPublishResultUnknownError, type RelayPublishResultUnknownErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, type RpcEndpoint, type RpcEndpointConfig, 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, XrplDepositAuthEnabledError, type XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, type XrplDestinationTagRequiredErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
|
25
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationAddressMatchesTokenAddressError, type DestinationAddressMatchesTokenAddressErrorType, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, 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 Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, type QuoteOptions, RelayPublishError, type RelayPublishErrorType, RelayPublishRejectedError, type RelayPublishRejectedErrorType, RelayPublishResultUnknownError, type RelayPublishResultUnknownErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, type RpcEndpoint, type RpcEndpointConfig, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TokenNotLinkedToHyperCoreError, type TokenNotLinkedToHyperCoreErrorType, 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, XrplDepositAuthEnabledError, type XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, type XrplDestinationTagRequiredErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,9 +17,9 @@ import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError,
|
|
|
17
17
|
import { DestinationAddressMatchesTokenAddressError, DestinationAddressMatchesTokenAddressErrorType, FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
|
|
18
18
|
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.js";
|
|
19
19
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
20
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
|
|
20
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType, TokenNotLinkedToHyperCoreError, TokenNotLinkedToHyperCoreErrorType } from "./src/bridges/omni-bridge/error.js";
|
|
21
21
|
import { XrplDepositAuthEnabledError, XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, XrplDestinationTagRequiredErrorType } from "./src/bridges/poa-bridge/errors.js";
|
|
22
22
|
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
23
23
|
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
24
24
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RelayPublishRejectedError, RelayPublishRejectedErrorType, RelayPublishResultUnknownError, RelayPublishResultUnknownErrorType, RetryOptions, RpcEndpoint, RpcEndpointConfig, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
25
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationAddressMatchesTokenAddressError, type DestinationAddressMatchesTokenAddressErrorType, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, 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 Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, type QuoteOptions, RelayPublishError, type RelayPublishErrorType, RelayPublishRejectedError, type RelayPublishRejectedErrorType, RelayPublishResultUnknownError, type RelayPublishResultUnknownErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, type RpcEndpoint, type RpcEndpointConfig, 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, XrplDepositAuthEnabledError, type XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, type XrplDestinationTagRequiredErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
|
25
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationAddressMatchesTokenAddressError, type DestinationAddressMatchesTokenAddressErrorType, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, 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 Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, type QuoteOptions, RelayPublishError, type RelayPublishErrorType, RelayPublishRejectedError, type RelayPublishRejectedErrorType, RelayPublishResultUnknownError, type RelayPublishResultUnknownErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, type RpcEndpoint, type RpcEndpointConfig, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TokenNotLinkedToHyperCoreError, type TokenNotLinkedToHyperCoreErrorType, 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, XrplDepositAuthEnabledError, type XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, type XrplDestinationTagRequiredErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { validateAddress } from "./src/lib/validateAddress.js";
|
|
|
5
5
|
import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
|
|
6
6
|
import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
|
|
7
7
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError } from "./src/bridges/hot-bridge/error.js";
|
|
8
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
|
|
8
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError, TokenNotLinkedToHyperCoreError } from "./src/bridges/omni-bridge/error.js";
|
|
9
9
|
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "./src/constants/poa-tokens-migrated-to-omni-bridge.js";
|
|
10
10
|
import { XrplDepositAuthEnabledError, XrplDestinationTagRequiredError } from "./src/bridges/poa-bridge/errors.js";
|
|
11
11
|
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
@@ -17,4 +17,4 @@ import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSi
|
|
|
17
17
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
18
18
|
import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RelayPublishRejectedError, RelayPublishResultUnknownError, RpcRequestError, TimeoutError } from "@defuse-protocol/internal-utils";
|
|
19
19
|
|
|
20
|
-
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationAddressMatchesTokenAddressError, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniWithdrawalApiFeeRequestTimeoutError, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RelayPublishRejectedError, RelayPublishResultUnknownError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, WithdrawalFailedError, WithdrawalWatchError, XrplDepositAuthEnabledError, XrplDestinationTagRequiredError, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
|
20
|
+
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationAddressMatchesTokenAddressError, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniWithdrawalApiFeeRequestTimeoutError, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RelayPublishRejectedError, RelayPublishResultUnknownError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TokenNotLinkedToHyperCoreError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, WithdrawalFailedError, WithdrawalWatchError, XrplDepositAuthEnabledError, XrplDestinationTagRequiredError, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
|
@@ -45,10 +45,21 @@ var InsufficientUtxoForOmniBridgeWithdrawalError = class extends _defuse_protoco
|
|
|
45
45
|
this.destinationChain = destinationChain;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var TokenNotLinkedToHyperCoreError = class extends _defuse_protocol_internal_utils.BaseError {
|
|
49
|
+
constructor(token, evmTokenAddress) {
|
|
50
|
+
super(`The token ${token} is not linked to a HyperCore spot token`, {
|
|
51
|
+
metaMessages: [`Token: ${token}`, `HyperEVM token address: ${evmTokenAddress}`],
|
|
52
|
+
name: "TokenNotLinkedToHyperCoreError"
|
|
53
|
+
});
|
|
54
|
+
this.token = token;
|
|
55
|
+
this.evmTokenAddress = evmTokenAddress;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
48
58
|
|
|
49
59
|
//#endregion
|
|
50
60
|
exports.InsufficientUtxoForOmniBridgeWithdrawalError = InsufficientUtxoForOmniBridgeWithdrawalError;
|
|
51
61
|
exports.IntentsNearOmniAvailableBalanceTooLowError = IntentsNearOmniAvailableBalanceTooLowError;
|
|
52
62
|
exports.InvalidFeeValueError = InvalidFeeValueError;
|
|
53
63
|
exports.OmniWithdrawalApiFeeRequestTimeoutError = OmniWithdrawalApiFeeRequestTimeoutError;
|
|
54
|
-
exports.TokenNotFoundInDestinationChainError = TokenNotFoundInDestinationChainError;
|
|
64
|
+
exports.TokenNotFoundInDestinationChainError = TokenNotFoundInDestinationChainError;
|
|
65
|
+
exports.TokenNotLinkedToHyperCoreError = TokenNotLinkedToHyperCoreError;
|
|
@@ -37,5 +37,13 @@ declare class InsufficientUtxoForOmniBridgeWithdrawalError extends BaseError {
|
|
|
37
37
|
destinationChain: Chain;
|
|
38
38
|
constructor(destinationChain: Chain);
|
|
39
39
|
}
|
|
40
|
+
type TokenNotLinkedToHyperCoreErrorType = TokenNotLinkedToHyperCoreError & {
|
|
41
|
+
name: "TokenNotLinkedToHyperCoreError";
|
|
42
|
+
};
|
|
43
|
+
declare class TokenNotLinkedToHyperCoreError extends BaseError {
|
|
44
|
+
token: string;
|
|
45
|
+
evmTokenAddress: string;
|
|
46
|
+
constructor(token: string, evmTokenAddress: string);
|
|
47
|
+
}
|
|
40
48
|
//#endregion
|
|
41
|
-
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
49
|
+
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType, TokenNotLinkedToHyperCoreError, TokenNotLinkedToHyperCoreErrorType };
|
|
@@ -37,5 +37,13 @@ declare class InsufficientUtxoForOmniBridgeWithdrawalError extends BaseError {
|
|
|
37
37
|
destinationChain: Chain;
|
|
38
38
|
constructor(destinationChain: Chain);
|
|
39
39
|
}
|
|
40
|
+
type TokenNotLinkedToHyperCoreErrorType = TokenNotLinkedToHyperCoreError & {
|
|
41
|
+
name: "TokenNotLinkedToHyperCoreError";
|
|
42
|
+
};
|
|
43
|
+
declare class TokenNotLinkedToHyperCoreError extends BaseError {
|
|
44
|
+
token: string;
|
|
45
|
+
evmTokenAddress: string;
|
|
46
|
+
constructor(token: string, evmTokenAddress: string);
|
|
47
|
+
}
|
|
40
48
|
//#endregion
|
|
41
|
-
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
49
|
+
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType, TokenNotLinkedToHyperCoreError, TokenNotLinkedToHyperCoreErrorType };
|
|
@@ -44,6 +44,16 @@ var InsufficientUtxoForOmniBridgeWithdrawalError = class extends BaseError {
|
|
|
44
44
|
this.destinationChain = destinationChain;
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
+
var TokenNotLinkedToHyperCoreError = class extends BaseError {
|
|
48
|
+
constructor(token, evmTokenAddress) {
|
|
49
|
+
super(`The token ${token} is not linked to a HyperCore spot token`, {
|
|
50
|
+
metaMessages: [`Token: ${token}`, `HyperEVM token address: ${evmTokenAddress}`],
|
|
51
|
+
name: "TokenNotLinkedToHyperCoreError"
|
|
52
|
+
});
|
|
53
|
+
this.token = token;
|
|
54
|
+
this.evmTokenAddress = evmTokenAddress;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
47
57
|
|
|
48
58
|
//#endregion
|
|
49
|
-
export { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError };
|
|
59
|
+
export { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError, TokenNotLinkedToHyperCoreError };
|
|
@@ -7,10 +7,18 @@ const SOL_OMNI_CONTRACT_ID = "sol.omft.near";
|
|
|
7
7
|
const MIN_AMOUNT_SOL_OMNI_WITHDRAWAL = 890880n;
|
|
8
8
|
const MIN_GAS_AMOUNT = "37400000000000";
|
|
9
9
|
const INTENTS_STORAGE_BALANCE_CACHE_KEY = "INTENTS_STORAGE_BALANCE";
|
|
10
|
+
/**
|
|
11
|
+
* Decimals for a withdrawal that lands on HyperCore, by asset id.
|
|
12
|
+
*/
|
|
13
|
+
const HYPERCORE_WITHDRAWAL_DECIMALS = { "nep141:wrap.near": {
|
|
14
|
+
decimals: 8,
|
|
15
|
+
origin_decimals: 24
|
|
16
|
+
} };
|
|
10
17
|
const FEE_SUBSIDIZED_TOKENS = ["nep141:lsd-usdt.rhealab.near"];
|
|
11
18
|
|
|
12
19
|
//#endregion
|
|
13
20
|
exports.FEE_SUBSIDIZED_TOKENS = FEE_SUBSIDIZED_TOKENS;
|
|
21
|
+
exports.HYPERCORE_WITHDRAWAL_DECIMALS = HYPERCORE_WITHDRAWAL_DECIMALS;
|
|
14
22
|
exports.INTENTS_STORAGE_BALANCE_CACHE_KEY = INTENTS_STORAGE_BALANCE_CACHE_KEY;
|
|
15
23
|
exports.MIN_AMOUNT_SOL_OMNI_WITHDRAWAL = MIN_AMOUNT_SOL_OMNI_WITHDRAWAL;
|
|
16
24
|
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
@@ -6,7 +6,14 @@ const SOL_OMNI_CONTRACT_ID = "sol.omft.near";
|
|
|
6
6
|
const MIN_AMOUNT_SOL_OMNI_WITHDRAWAL = 890880n;
|
|
7
7
|
const MIN_GAS_AMOUNT = "37400000000000";
|
|
8
8
|
const INTENTS_STORAGE_BALANCE_CACHE_KEY = "INTENTS_STORAGE_BALANCE";
|
|
9
|
+
/**
|
|
10
|
+
* Decimals for a withdrawal that lands on HyperCore, by asset id.
|
|
11
|
+
*/
|
|
12
|
+
const HYPERCORE_WITHDRAWAL_DECIMALS = { "nep141:wrap.near": {
|
|
13
|
+
decimals: 8,
|
|
14
|
+
origin_decimals: 24
|
|
15
|
+
} };
|
|
9
16
|
const FEE_SUBSIDIZED_TOKENS = ["nep141:lsd-usdt.rhealab.near"];
|
|
10
17
|
|
|
11
18
|
//#endregion
|
|
12
|
-
export { FEE_SUBSIDIZED_TOKENS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, MIN_GAS_AMOUNT, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT, SOL_OMNI_CONTRACT_ID };
|
|
19
|
+
export { FEE_SUBSIDIZED_TOKENS, HYPERCORE_WITHDRAWAL_DECIMALS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, MIN_GAS_AMOUNT, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT, SOL_OMNI_CONTRACT_ID };
|
|
@@ -59,7 +59,8 @@ const CHAIN_MAPPINGS = [
|
|
|
59
59
|
[require_caip2.Chains.Polygon, _omni_bridge_core.ChainKind.Pol],
|
|
60
60
|
[require_caip2.Chains.Aptos, _omni_bridge_core.ChainKind.Aptos],
|
|
61
61
|
[require_caip2.Chains.HyperEvm, _omni_bridge_core.ChainKind.HlEvm],
|
|
62
|
-
[require_caip2.Chains.Zcash, _omni_bridge_core.ChainKind.Zcash]
|
|
62
|
+
[require_caip2.Chains.Zcash, _omni_bridge_core.ChainKind.Zcash],
|
|
63
|
+
[require_caip2.Chains.HyperCore, _omni_bridge_core.ChainKind.HlEvm]
|
|
63
64
|
];
|
|
64
65
|
function chainKindToCaip2(network) {
|
|
65
66
|
return CHAIN_MAPPINGS.find(([_, kind]) => kind === network)?.[0] ?? null;
|
|
@@ -57,7 +57,8 @@ const CHAIN_MAPPINGS = [
|
|
|
57
57
|
[Chains.Polygon, ChainKind.Pol],
|
|
58
58
|
[Chains.Aptos, ChainKind.Aptos],
|
|
59
59
|
[Chains.HyperEvm, ChainKind.HlEvm],
|
|
60
|
-
[Chains.Zcash, ChainKind.Zcash]
|
|
60
|
+
[Chains.Zcash, ChainKind.Zcash],
|
|
61
|
+
[Chains.HyperCore, ChainKind.HlEvm]
|
|
61
62
|
];
|
|
62
63
|
function chainKindToCaip2(network) {
|
|
63
64
|
return CHAIN_MAPPINGS.find(([_, kind]) => kind === network)?.[0] ?? null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_errors = require('../../classes/errors.cjs');
|
|
3
3
|
const require_route_enum = require('../../constants/route-enum.cjs');
|
|
4
|
+
const require_caip2 = require('../../lib/caip2.cjs');
|
|
4
5
|
const require_estimate_fee = require('../../lib/estimate-fee.cjs');
|
|
5
6
|
const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.cjs');
|
|
6
7
|
const require_validateAddress = require('../../lib/validateAddress.cjs');
|
|
@@ -123,7 +124,8 @@ var OmniBridge = class {
|
|
|
123
124
|
actualAmount: args.withdrawalParams.amount,
|
|
124
125
|
omniChainKind,
|
|
125
126
|
intentsContract: this.envConfig.contractID,
|
|
126
|
-
feeEstimation: args.feeEstimation
|
|
127
|
+
feeEstimation: args.feeEstimation,
|
|
128
|
+
caip2Identifier: assetInfo.blockchain
|
|
127
129
|
})));
|
|
128
130
|
return Promise.resolve(intents);
|
|
129
131
|
}
|
|
@@ -140,7 +142,12 @@ var OmniBridge = class {
|
|
|
140
142
|
if (destTokenOmniAddress === null) throw new require_error.TokenNotFoundInDestinationChainError(args.assetId, assetInfo.blockchain);
|
|
141
143
|
const destTokenAddress = (0, _omni_bridge_core.getAddress)(destTokenOmniAddress);
|
|
142
144
|
if (require_compareAddresses.compareAddresses(destTokenAddress, args.destinationAddress, assetInfo.blockchain)) throw new require_errors.DestinationAddressMatchesTokenAddressError(destTokenAddress, args.assetId);
|
|
143
|
-
|
|
145
|
+
let decimals = null;
|
|
146
|
+
if (assetInfo.blockchain === require_caip2.Chains.HyperCore) {
|
|
147
|
+
const hyperCoreDecimals = require_omni_bridge_constants.HYPERCORE_WITHDRAWAL_DECIMALS[args.assetId];
|
|
148
|
+
if (!hyperCoreDecimals) throw new require_error.TokenNotLinkedToHyperCoreError(args.assetId, destTokenAddress);
|
|
149
|
+
decimals = hyperCoreDecimals;
|
|
150
|
+
} else decimals = await this.getCachedTokenDecimals(destTokenOmniAddress);
|
|
144
151
|
(0, _defuse_protocol_internal_utils.assert)(decimals !== null, `Failed to retrieve token decimals for address ${destTokenOmniAddress} via OmniBridge contract.
|
|
145
152
|
Ensure the token is supported and the address is correct.`);
|
|
146
153
|
if (!args.skipMinAmountValidation) {
|
|
@@ -240,7 +247,9 @@ var OmniBridge = class {
|
|
|
240
247
|
if (transfer == null || transfer.recipient == null) return { status: "pending" };
|
|
241
248
|
const destinationChain = (0, _omni_bridge_core.getChain)(transfer.recipient);
|
|
242
249
|
let txHash = null;
|
|
243
|
-
if ((0, _omni_bridge_core.isEvmChain)(destinationChain)
|
|
250
|
+
if ((0, _omni_bridge_core.isEvmChain)(destinationChain)) if (args.landingChain === require_caip2.Chains.HyperCore) txHash = transfer?.related_txs?.find((tx) => tx.kind === "hyper_core_fin")?.transaction_hash;
|
|
251
|
+
else txHash = transfer.finalised?.transaction_hash;
|
|
252
|
+
else if (destinationChain === _omni_bridge_core.ChainKind.Sol || destinationChain === _omni_bridge_core.ChainKind.Fogo || destinationChain === _omni_bridge_core.ChainKind.Strk || destinationChain === _omni_bridge_core.ChainKind.Aptos) txHash = transfer.finalised?.transaction_hash;
|
|
244
253
|
else if (require_src_bridges_omni_bridge_omni_withdraw_params.isUtxoChain(destinationChain)) txHash = typeof window !== "undefined" ? transfer.utxo_meta?.pending_sign_id : transfer.finalised?.transaction_hash;
|
|
245
254
|
else return {
|
|
246
255
|
status: "completed",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { DestinationAddressMatchesTokenAddressError, InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError, UnsupportedAssetIdError } from "../../classes/errors.js";
|
|
2
2
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
3
|
+
import { Chains } from "../../lib/caip2.js";
|
|
3
4
|
import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
|
|
4
5
|
import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
|
|
5
6
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
6
7
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
7
8
|
import { compareAddresses } from "../../lib/compareAddresses.js";
|
|
8
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./error.js";
|
|
9
|
-
import { FEE_SUBSIDIZED_TOKENS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT, SOL_OMNI_CONTRACT_ID } from "./omni-bridge-constants.js";
|
|
9
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError, TokenNotLinkedToHyperCoreError } from "./error.js";
|
|
10
|
+
import { FEE_SUBSIDIZED_TOKENS, HYPERCORE_WITHDRAWAL_DECIMALS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT, SOL_OMNI_CONTRACT_ID } from "./omni-bridge-constants.js";
|
|
10
11
|
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "../../constants/poa-tokens-migrated-to-omni-bridge.js";
|
|
11
12
|
import { chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, poaContractIdToChainKind, validateOmniToken } from "./omni-bridge-utils.js";
|
|
12
13
|
import { caip2ToChainKind, deriveOmniWithdrawIntentParams, isUtxoChain } from "./omni-withdraw-params.js";
|
|
@@ -121,7 +122,8 @@ var OmniBridge = class {
|
|
|
121
122
|
actualAmount: args.withdrawalParams.amount,
|
|
122
123
|
omniChainKind,
|
|
123
124
|
intentsContract: this.envConfig.contractID,
|
|
124
|
-
feeEstimation: args.feeEstimation
|
|
125
|
+
feeEstimation: args.feeEstimation,
|
|
126
|
+
caip2Identifier: assetInfo.blockchain
|
|
125
127
|
})));
|
|
126
128
|
return Promise.resolve(intents);
|
|
127
129
|
}
|
|
@@ -138,7 +140,12 @@ var OmniBridge = class {
|
|
|
138
140
|
if (destTokenOmniAddress === null) throw new TokenNotFoundInDestinationChainError(args.assetId, assetInfo.blockchain);
|
|
139
141
|
const destTokenAddress = getAddress(destTokenOmniAddress);
|
|
140
142
|
if (compareAddresses(destTokenAddress, args.destinationAddress, assetInfo.blockchain)) throw new DestinationAddressMatchesTokenAddressError(destTokenAddress, args.assetId);
|
|
141
|
-
|
|
143
|
+
let decimals = null;
|
|
144
|
+
if (assetInfo.blockchain === Chains.HyperCore) {
|
|
145
|
+
const hyperCoreDecimals = HYPERCORE_WITHDRAWAL_DECIMALS[args.assetId];
|
|
146
|
+
if (!hyperCoreDecimals) throw new TokenNotLinkedToHyperCoreError(args.assetId, destTokenAddress);
|
|
147
|
+
decimals = hyperCoreDecimals;
|
|
148
|
+
} else decimals = await this.getCachedTokenDecimals(destTokenOmniAddress);
|
|
142
149
|
assert(decimals !== null, `Failed to retrieve token decimals for address ${destTokenOmniAddress} via OmniBridge contract.
|
|
143
150
|
Ensure the token is supported and the address is correct.`);
|
|
144
151
|
if (!args.skipMinAmountValidation) {
|
|
@@ -238,7 +245,9 @@ var OmniBridge = class {
|
|
|
238
245
|
if (transfer == null || transfer.recipient == null) return { status: "pending" };
|
|
239
246
|
const destinationChain = getChain(transfer.recipient);
|
|
240
247
|
let txHash = null;
|
|
241
|
-
if (isEvmChain(destinationChain)
|
|
248
|
+
if (isEvmChain(destinationChain)) if (args.landingChain === Chains.HyperCore) txHash = transfer?.related_txs?.find((tx) => tx.kind === "hyper_core_fin")?.transaction_hash;
|
|
249
|
+
else txHash = transfer.finalised?.transaction_hash;
|
|
250
|
+
else if (destinationChain === ChainKind.Sol || destinationChain === ChainKind.Fogo || destinationChain === ChainKind.Strk || destinationChain === ChainKind.Aptos) txHash = transfer.finalised?.transaction_hash;
|
|
242
251
|
else if (isUtxoChain(destinationChain)) txHash = typeof window !== "undefined" ? transfer.utxo_meta?.pending_sign_id : transfer.finalised?.transaction_hash;
|
|
243
252
|
else return {
|
|
244
253
|
status: "completed",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_route_enum = require('../../constants/route-enum.cjs');
|
|
3
|
+
const require_caip2 = require('../../lib/caip2.cjs');
|
|
3
4
|
const require_estimate_fee = require('../../lib/estimate-fee.cjs');
|
|
4
5
|
const require_omni_bridge_utils = require('./omni-bridge-utils.cjs');
|
|
5
6
|
let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
|
|
@@ -33,7 +34,7 @@ function deriveOmniWithdrawIntentParams(params) {
|
|
|
33
34
|
(0, _defuse_protocol_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
|
|
34
35
|
amount += utxoMaxGasFee + utxoProtocolFee;
|
|
35
36
|
msg = JSON.stringify({ MaxGasFee: utxoMaxGasFee.toString() });
|
|
36
|
-
}
|
|
37
|
+
} else if (params.caip2Identifier === require_caip2.Chains.HyperCore) msg = _omni_bridge_core.HYPERLIQUID_MESSAGE;
|
|
37
38
|
const destinationAddress = params.omniChainKind === _omni_bridge_core.ChainKind.Btc && /^bc1/i.test(params.destinationAddress) ? params.destinationAddress.toLowerCase() : params.destinationAddress;
|
|
38
39
|
const recipient = (0, _omni_bridge_core.omniAddress)(params.omniChainKind, destinationAddress);
|
|
39
40
|
const externalId = params.externalId ?? crypto.randomUUID();
|
|
@@ -53,6 +53,7 @@ declare function deriveOmniWithdrawIntentParams(params: {
|
|
|
53
53
|
intentsContract: string;
|
|
54
54
|
feeEstimation: FeeEstimation;
|
|
55
55
|
externalId?: string;
|
|
56
|
+
caip2Identifier?: Chain;
|
|
56
57
|
}): OmniWithdrawIntentParams;
|
|
57
58
|
declare function caip2ToChainKind(network: Chain): ChainKind | null;
|
|
58
59
|
declare function isUtxoChain(network: ChainKind): boolean;
|
|
@@ -53,6 +53,7 @@ declare function deriveOmniWithdrawIntentParams(params: {
|
|
|
53
53
|
intentsContract: string;
|
|
54
54
|
feeEstimation: FeeEstimation;
|
|
55
55
|
externalId?: string;
|
|
56
|
+
caip2Identifier?: Chain;
|
|
56
57
|
}): OmniWithdrawIntentParams;
|
|
57
58
|
declare function caip2ToChainKind(network: Chain): ChainKind | null;
|
|
58
59
|
declare function isUtxoChain(network: ChainKind): boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
2
|
+
import { Chains } from "../../lib/caip2.js";
|
|
2
3
|
import { getUnderlyingFee } from "../../lib/estimate-fee.js";
|
|
3
4
|
import { CHAIN_MAPPINGS } from "./omni-bridge-utils.js";
|
|
4
5
|
import { assert, utils } from "@defuse-protocol/internal-utils";
|
|
5
|
-
import { ChainKind, omniAddress } from "@omni-bridge/core";
|
|
6
|
+
import { ChainKind, HYPERLIQUID_MESSAGE, omniAddress } from "@omni-bridge/core";
|
|
6
7
|
import { calculateStorageAccountId } from "@omni-bridge/near";
|
|
7
8
|
|
|
8
9
|
//#region src/bridges/omni-bridge/omni-withdraw-params.ts
|
|
@@ -32,7 +33,7 @@ function deriveOmniWithdrawIntentParams(params) {
|
|
|
32
33
|
assert(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
|
|
33
34
|
amount += utxoMaxGasFee + utxoProtocolFee;
|
|
34
35
|
msg = JSON.stringify({ MaxGasFee: utxoMaxGasFee.toString() });
|
|
35
|
-
}
|
|
36
|
+
} else if (params.caip2Identifier === Chains.HyperCore) msg = HYPERLIQUID_MESSAGE;
|
|
36
37
|
const destinationAddress = params.omniChainKind === ChainKind.Btc && /^bc1/i.test(params.destinationAddress) ? params.destinationAddress.toLowerCase() : params.destinationAddress;
|
|
37
38
|
const recipient = omniAddress(params.omniChainKind, destinationAddress);
|
|
38
39
|
const externalId = params.externalId ?? crypto.randomUUID();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defuse-protocol/intents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"@hot-labs/omni-sdk": "2.25.5",
|
|
49
49
|
"@isaacs/ttlcache": "^1.0.0",
|
|
50
50
|
"@lifeomic/attempt": "^3.0.0",
|
|
51
|
-
"@omni-bridge/core": "0.
|
|
52
|
-
"@omni-bridge/near": "0.
|
|
51
|
+
"@omni-bridge/core": "0.20.0",
|
|
52
|
+
"@omni-bridge/near": "0.20.0",
|
|
53
53
|
"@noble/hashes": "^1.7.1",
|
|
54
54
|
"@scure/base": "^1.0.0",
|
|
55
55
|
"borsher": "^4.0.0",
|