@defuse-protocol/intents-sdk 0.42.0 → 0.43.1
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 +3 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.cjs +8 -4
- package/dist/src/bridges/hot-bridge/hot-bridge.js +8 -4
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +2 -2
- package/dist/src/bridges/omni-bridge/omni-bridge.js +2 -2
- package/dist/src/lib/validateAddress.cjs +7 -0
- package/dist/src/lib/validateAddress.d.cts +14 -0
- package/dist/src/lib/validateAddress.d.ts +14 -0
- package/dist/src/lib/validateAddress.js +7 -0
- package/dist/src/shared-types.d.cts +2 -0
- package/dist/src/shared-types.d.ts +2 -0
- package/package.json +11 -2
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
|
2
2
|
const require_route_enum = require('./src/constants/route-enum.cjs');
|
|
3
3
|
const require_errors = require('./src/classes/errors.cjs');
|
|
4
4
|
const require_caip2 = require('./src/lib/caip2.cjs');
|
|
5
|
+
const require_validateAddress = require('./src/lib/validateAddress.cjs');
|
|
5
6
|
const require_bridge_name_enum = require('./src/constants/bridge-name-enum.cjs');
|
|
6
7
|
const require_error = require('./src/bridges/direct-bridge/error.cjs');
|
|
7
8
|
const require_error$1 = require('./src/bridges/hot-bridge/error.cjs');
|
|
@@ -118,4 +119,5 @@ exports.createInternalTransferRoute = require_route_config_factory.createInterna
|
|
|
118
119
|
exports.createNearWithdrawalRoute = require_route_config_factory.createNearWithdrawalRoute;
|
|
119
120
|
exports.createOmniBridgeRoute = require_route_config_factory.createOmniBridgeRoute;
|
|
120
121
|
exports.createPoaBridgeRoute = require_route_config_factory.createPoaBridgeRoute;
|
|
121
|
-
exports.createVirtualChainRoute = require_route_config_factory.createVirtualChainRoute;
|
|
122
|
+
exports.createVirtualChainRoute = require_route_config_factory.createVirtualChainRoute;
|
|
123
|
+
exports.validateAddressFormat = require_validateAddress.validateAddress;
|
package/dist/index.d.cts
CHANGED
|
@@ -15,5 +15,6 @@ import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNear
|
|
|
15
15
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
16
16
|
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, 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
|
+
import { validateAddress } from "./src/lib/validateAddress.cjs";
|
|
18
19
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
19
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, 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 };
|
|
20
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, 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, validateAddress as validateAddressFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,5 +15,6 @@ import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNear
|
|
|
15
15
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
16
16
|
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, 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
|
+
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
18
19
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
19
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, 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 };
|
|
20
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type OmniBridgeRouteConfig, 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, validateAddress as validateAddressFormat };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RouteEnum } from "./src/constants/route-enum.js";
|
|
2
2
|
import { FeeExceedsAmountError, MinWithdrawalAmountError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "./src/classes/errors.js";
|
|
3
3
|
import { Chains } from "./src/lib/caip2.js";
|
|
4
|
+
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
4
5
|
import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
|
|
5
6
|
import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
|
|
6
7
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./src/bridges/hot-bridge/error.js";
|
|
@@ -13,4 +14,4 @@ import { IntentsSDK } from "./src/sdk.js";
|
|
|
13
14
|
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
|
|
14
15
|
import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RpcRequestError, TimeoutError } from "@defuse-protocol/internal-utils";
|
|
15
16
|
|
|
16
|
-
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, 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 };
|
|
17
|
+
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, 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, validateAddress as validateAddressFormat };
|
|
@@ -53,6 +53,7 @@ var HotBridge = class {
|
|
|
53
53
|
if (args.withdrawalParams.destinationMemo != null && args.withdrawalParams.destinationMemo !== "") throw new require_errors.UnsupportedDestinationMemoError(assetInfo.blockchain, args.withdrawalParams.assetId);
|
|
54
54
|
const intents = [];
|
|
55
55
|
const feeAmount = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.HotBridge, "relayerFee");
|
|
56
|
+
const blockNumber = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.HotBridge, "blockNumber");
|
|
56
57
|
if (args.feeEstimation.quote !== null) intents.push({
|
|
57
58
|
intent: "token_diff",
|
|
58
59
|
diff: {
|
|
@@ -66,11 +67,11 @@ var HotBridge = class {
|
|
|
66
67
|
const intent = await this.hotSdk.buildGaslessWithdrawIntent({
|
|
67
68
|
feeToken: "native",
|
|
68
69
|
feeAmount,
|
|
70
|
+
blockNumber,
|
|
69
71
|
chain: require_hot_bridge_utils.toHotNetworkId(assetInfo.blockchain),
|
|
70
72
|
token: isNative ? "native" : assetInfo.address,
|
|
71
73
|
amount,
|
|
72
|
-
receiver: args.withdrawalParams.destinationAddress
|
|
73
|
-
intentAccount: ""
|
|
74
|
+
receiver: args.withdrawalParams.destinationAddress
|
|
74
75
|
});
|
|
75
76
|
(0, __defuse_protocol_internal_utils.assert)(intent.amounts[0] === amount.toString(), "Amount is not correct");
|
|
76
77
|
if (intent.amounts.length === 2) (0, __defuse_protocol_internal_utils.assert)(intent.amounts[1] === feeAmount.toString(), "Amount is not correct");
|
|
@@ -96,7 +97,7 @@ var HotBridge = class {
|
|
|
96
97
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
97
98
|
(0, __defuse_protocol_internal_utils.assert)(assetInfo != null, "Asset is not supported");
|
|
98
99
|
require_hot_bridge_utils.hotBlockchainInvariant(assetInfo.blockchain);
|
|
99
|
-
const { gasPrice: feeAmount } = await (0, __defuse_protocol_internal_utils.withTimeout)(() => this.hotSdk.getGaslessWithdrawFee({
|
|
100
|
+
const { gasPrice: feeAmount, blockNumber } = await (0, __defuse_protocol_internal_utils.withTimeout)(() => this.hotSdk.getGaslessWithdrawFee({
|
|
100
101
|
chain: require_hot_bridge_utils.toHotNetworkId(assetInfo.blockchain),
|
|
101
102
|
token: "native" in assetInfo ? "native" : assetInfo.address,
|
|
102
103
|
receiver: args.withdrawalParams.destinationAddress
|
|
@@ -117,7 +118,10 @@ var HotBridge = class {
|
|
|
117
118
|
return {
|
|
118
119
|
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
119
120
|
quote: feeQuote,
|
|
120
|
-
underlyingFees: { [require_route_enum.RouteEnum.HotBridge]: {
|
|
121
|
+
underlyingFees: { [require_route_enum.RouteEnum.HotBridge]: {
|
|
122
|
+
relayerFee: feeAmount,
|
|
123
|
+
blockNumber
|
|
124
|
+
} }
|
|
121
125
|
};
|
|
122
126
|
}
|
|
123
127
|
async waitForWithdrawalCompletion(args) {
|
|
@@ -52,6 +52,7 @@ var HotBridge$1 = class {
|
|
|
52
52
|
if (args.withdrawalParams.destinationMemo != null && args.withdrawalParams.destinationMemo !== "") throw new UnsupportedDestinationMemoError(assetInfo.blockchain, args.withdrawalParams.assetId);
|
|
53
53
|
const intents = [];
|
|
54
54
|
const feeAmount = getUnderlyingFee(args.feeEstimation, RouteEnum.HotBridge, "relayerFee");
|
|
55
|
+
const blockNumber = getUnderlyingFee(args.feeEstimation, RouteEnum.HotBridge, "blockNumber");
|
|
55
56
|
if (args.feeEstimation.quote !== null) intents.push({
|
|
56
57
|
intent: "token_diff",
|
|
57
58
|
diff: {
|
|
@@ -65,11 +66,11 @@ var HotBridge$1 = class {
|
|
|
65
66
|
const intent = await this.hotSdk.buildGaslessWithdrawIntent({
|
|
66
67
|
feeToken: "native",
|
|
67
68
|
feeAmount,
|
|
69
|
+
blockNumber,
|
|
68
70
|
chain: toHotNetworkId(assetInfo.blockchain),
|
|
69
71
|
token: isNative ? "native" : assetInfo.address,
|
|
70
72
|
amount,
|
|
71
|
-
receiver: args.withdrawalParams.destinationAddress
|
|
72
|
-
intentAccount: ""
|
|
73
|
+
receiver: args.withdrawalParams.destinationAddress
|
|
73
74
|
});
|
|
74
75
|
assert(intent.amounts[0] === amount.toString(), "Amount is not correct");
|
|
75
76
|
if (intent.amounts.length === 2) assert(intent.amounts[1] === feeAmount.toString(), "Amount is not correct");
|
|
@@ -95,7 +96,7 @@ var HotBridge$1 = class {
|
|
|
95
96
|
const assetInfo = this.parseAssetId(args.withdrawalParams.assetId);
|
|
96
97
|
assert(assetInfo != null, "Asset is not supported");
|
|
97
98
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
98
|
-
const { gasPrice: feeAmount } = await withTimeout(() => this.hotSdk.getGaslessWithdrawFee({
|
|
99
|
+
const { gasPrice: feeAmount, blockNumber } = await withTimeout(() => this.hotSdk.getGaslessWithdrawFee({
|
|
99
100
|
chain: toHotNetworkId(assetInfo.blockchain),
|
|
100
101
|
token: "native" in assetInfo ? "native" : assetInfo.address,
|
|
101
102
|
receiver: args.withdrawalParams.destinationAddress
|
|
@@ -116,7 +117,10 @@ var HotBridge$1 = class {
|
|
|
116
117
|
return {
|
|
117
118
|
amount: feeQuote ? BigInt(feeQuote.amount_in) : feeAmount,
|
|
118
119
|
quote: feeQuote,
|
|
119
|
-
underlyingFees: { [RouteEnum.HotBridge]: {
|
|
120
|
+
underlyingFees: { [RouteEnum.HotBridge]: {
|
|
121
|
+
relayerFee: feeAmount,
|
|
122
|
+
blockNumber
|
|
123
|
+
} }
|
|
120
124
|
};
|
|
121
125
|
}
|
|
122
126
|
async waitForWithdrawalCompletion(args) {
|
|
@@ -145,7 +145,7 @@ var OmniBridge = class {
|
|
|
145
145
|
return Promise.resolve(intents);
|
|
146
146
|
}
|
|
147
147
|
async validateWithdrawal(args) {
|
|
148
|
-
(0, __defuse_protocol_internal_utils.assert)(args.feeEstimation.amount > 0n, `
|
|
148
|
+
(0, __defuse_protocol_internal_utils.assert)(args.feeEstimation.amount > 0n, `Invalid Omni Bridge fee: expected > 0, got ${args.feeEstimation.amount}`);
|
|
149
149
|
const assetInfo = this.makeAssetInfo(args.assetId, args.routeConfig);
|
|
150
150
|
(0, __defuse_protocol_internal_utils.assert)(assetInfo !== null, `Asset ${args.assetId} is not supported by Omni Bridge`);
|
|
151
151
|
if (require_validateAddress.validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
@@ -156,7 +156,7 @@ var OmniBridge = class {
|
|
|
156
156
|
const decimals = await this.getCachedTokenDecimals(destTokenAddress);
|
|
157
157
|
(0, __defuse_protocol_internal_utils.assert)(decimals !== null, `Failed to retrieve token decimals for address ${destTokenAddress} via OmniBridge contract.
|
|
158
158
|
Ensure the token is supported and the address is correct.`);
|
|
159
|
-
if ((0, omni_bridge_sdk.verifyTransferAmount)(args.amount
|
|
159
|
+
if ((0, omni_bridge_sdk.verifyTransferAmount)(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new require_errors.MinWithdrawalAmountError((0, omni_bridge_sdk.getMinimumTransferableAmount)(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
|
|
160
160
|
const storageBalance = await require_omni_bridge_utils.getAccountOmniStorageBalance(this.nearProvider, __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID);
|
|
161
161
|
const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
|
|
162
162
|
if (intentsNearStorageBalance <= require_omni_bridge_constants.MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new require_error.IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
|
|
@@ -143,7 +143,7 @@ var OmniBridge = class {
|
|
|
143
143
|
return Promise.resolve(intents);
|
|
144
144
|
}
|
|
145
145
|
async validateWithdrawal(args) {
|
|
146
|
-
assert(args.feeEstimation.amount > 0n, `
|
|
146
|
+
assert(args.feeEstimation.amount > 0n, `Invalid Omni Bridge fee: expected > 0, got ${args.feeEstimation.amount}`);
|
|
147
147
|
const assetInfo = this.makeAssetInfo(args.assetId, args.routeConfig);
|
|
148
148
|
assert(assetInfo !== null, `Asset ${args.assetId} is not supported by Omni Bridge`);
|
|
149
149
|
if (validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
@@ -154,7 +154,7 @@ var OmniBridge = class {
|
|
|
154
154
|
const decimals = await this.getCachedTokenDecimals(destTokenAddress);
|
|
155
155
|
assert(decimals !== null, `Failed to retrieve token decimals for address ${destTokenAddress} via OmniBridge contract.
|
|
156
156
|
Ensure the token is supported and the address is correct.`);
|
|
157
|
-
if (verifyTransferAmount(args.amount
|
|
157
|
+
if (verifyTransferAmount(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new MinWithdrawalAmountError(getMinimumTransferableAmount(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
|
|
158
158
|
const storageBalance = await getAccountOmniStorageBalance(this.nearProvider, configsByEnvironment[this.env].contractID);
|
|
159
159
|
const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
|
|
160
160
|
if (intentsNearStorageBalance <= MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
|
|
@@ -8,6 +8,13 @@ let __solana_web3_js = require("@solana/web3.js");
|
|
|
8
8
|
let ripple_address_codec = require("ripple-address-codec");
|
|
9
9
|
|
|
10
10
|
//#region src/lib/validateAddress.ts
|
|
11
|
+
/**
|
|
12
|
+
* Validates that an address matches the expected format for a given blockchain.
|
|
13
|
+
*
|
|
14
|
+
* Note: This validates address FORMAT only. Specific bridges may have
|
|
15
|
+
* additional requirements (e.g., supported address types, memo requirements).
|
|
16
|
+
* A valid format does not guarantee a bridge will accept the address.
|
|
17
|
+
*/
|
|
11
18
|
function validateAddress(address, blockchain) {
|
|
12
19
|
switch (blockchain) {
|
|
13
20
|
case require_caip2.Chains.Near: return __defuse_protocol_internal_utils.utils.validateNearAddress(address);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chain } from "./caip2.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/validateAddress.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Validates that an address matches the expected format for a given blockchain.
|
|
7
|
+
*
|
|
8
|
+
* Note: This validates address FORMAT only. Specific bridges may have
|
|
9
|
+
* additional requirements (e.g., supported address types, memo requirements).
|
|
10
|
+
* A valid format does not guarantee a bridge will accept the address.
|
|
11
|
+
*/
|
|
12
|
+
declare function validateAddress(address: string, blockchain: Chain): boolean;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { validateAddress };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Chain } from "./caip2.js";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/validateAddress.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Validates that an address matches the expected format for a given blockchain.
|
|
7
|
+
*
|
|
8
|
+
* Note: This validates address FORMAT only. Specific bridges may have
|
|
9
|
+
* additional requirements (e.g., supported address types, memo requirements).
|
|
10
|
+
* A valid format does not guarantee a bridge will accept the address.
|
|
11
|
+
*/
|
|
12
|
+
declare function validateAddress(address: string, blockchain: Chain): boolean;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { validateAddress };
|
|
@@ -7,6 +7,13 @@ import { PublicKey } from "@solana/web3.js";
|
|
|
7
7
|
import { isValidClassicAddress, isValidXAddress } from "ripple-address-codec";
|
|
8
8
|
|
|
9
9
|
//#region src/lib/validateAddress.ts
|
|
10
|
+
/**
|
|
11
|
+
* Validates that an address matches the expected format for a given blockchain.
|
|
12
|
+
*
|
|
13
|
+
* Note: This validates address FORMAT only. Specific bridges may have
|
|
14
|
+
* additional requirements (e.g., supported address types, memo requirements).
|
|
15
|
+
* A valid format does not guarantee a bridge will accept the address.
|
|
16
|
+
*/
|
|
10
17
|
function validateAddress(address, blockchain) {
|
|
11
18
|
switch (blockchain) {
|
|
12
19
|
case Chains.Near: return utils.validateNearAddress(address);
|
|
@@ -219,6 +219,8 @@ interface RouteFeeStructures {
|
|
|
219
219
|
[RouteEnum.HotBridge]: {
|
|
220
220
|
/** Relayer fee for processing the withdrawal on destination chain, taken in base token of destination chain. */
|
|
221
221
|
relayerFee: bigint;
|
|
222
|
+
/** Block number at the time of fee estimation, required for building gasless withdraw intent. */
|
|
223
|
+
blockNumber: bigint;
|
|
222
224
|
};
|
|
223
225
|
[RouteEnum.PoaBridge]: {
|
|
224
226
|
/** Relayer fee for POA bridge transfers, taken in transferred token. */
|
|
@@ -219,6 +219,8 @@ interface RouteFeeStructures {
|
|
|
219
219
|
[RouteEnum.HotBridge]: {
|
|
220
220
|
/** Relayer fee for processing the withdrawal on destination chain, taken in base token of destination chain. */
|
|
221
221
|
relayerFee: bigint;
|
|
222
|
+
/** Block number at the time of fee estimation, required for building gasless withdraw intent. */
|
|
223
|
+
blockNumber: bigint;
|
|
222
224
|
};
|
|
223
225
|
[RouteEnum.PoaBridge]: {
|
|
224
226
|
/** Relayer fee for POA bridge transfers, taken in transferred token. */
|
package/package.json
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defuse-protocol/intents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/defuse-protocol/sdk-monorepo.git",
|
|
9
|
+
"directory": "packages/intents-sdk"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/defuse-protocol/sdk-monorepo/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/defuse-protocol/sdk-monorepo/tree/main/packages/intents-sdk#readme",
|
|
6
15
|
"sideEffects": false,
|
|
7
16
|
"main": "./dist/index.cjs",
|
|
8
17
|
"module": "./dist/index.js",
|
|
@@ -22,7 +31,7 @@
|
|
|
22
31
|
"typescript": "^5"
|
|
23
32
|
},
|
|
24
33
|
"dependencies": {
|
|
25
|
-
"@hot-labs/omni-sdk": "2.
|
|
34
|
+
"@hot-labs/omni-sdk": "2.24.0",
|
|
26
35
|
"@isaacs/ttlcache": "^1.0.0",
|
|
27
36
|
"@lifeomic/attempt": "^3.0.0",
|
|
28
37
|
"@near-js/accounts": "^2.0.1",
|