@defuse-protocol/intents-sdk 0.39.1 → 0.40.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 +0 -1
- 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 +0 -19
- package/dist/src/bridges/omni-bridge/error.d.cts +1 -11
- package/dist/src/bridges/omni-bridge/error.d.ts +1 -11
- package/dist/src/bridges/omni-bridge/error.js +1 -19
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +4 -6
- package/dist/src/bridges/omni-bridge/omni-bridge.js +5 -7
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,6 @@ exports.IntentsNearOmniAvailableBalanceTooLowError = require_error$2.IntentsNear
|
|
|
52
52
|
exports.IntentsSDK = require_sdk.IntentsSDK;
|
|
53
53
|
exports.InvalidFeeValueError = require_error$2.InvalidFeeValueError;
|
|
54
54
|
exports.MinWithdrawalAmountError = require_errors.MinWithdrawalAmountError;
|
|
55
|
-
exports.OmniTokenNormalisationCheckError = require_error$2.OmniTokenNormalisationCheckError;
|
|
56
55
|
exports.OmniTransferDestinationChainHashNotFoundError = require_error$2.OmniTransferDestinationChainHashNotFoundError;
|
|
57
56
|
exports.OmniTransferNotFoundError = require_error$2.OmniTransferNotFoundError;
|
|
58
57
|
exports.OmniWithdrawalApiFeeRequestTimeoutError = require_error$2.OmniWithdrawalApiFeeRequestTimeoutError;
|
package/dist/index.d.cts
CHANGED
|
@@ -13,7 +13,7 @@ import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute,
|
|
|
13
13
|
import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
|
|
14
14
|
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.cjs";
|
|
15
15
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
16
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType,
|
|
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
18
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
19
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, 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,
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute,
|
|
|
13
13
|
import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
|
|
14
14
|
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.js";
|
|
15
15
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
16
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType,
|
|
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
18
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RetryOptions, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
19
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, type HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, type HotWithdrawalPendingErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, 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,
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Chains } from "./src/lib/caip2.js";
|
|
|
4
4
|
import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
|
|
5
5
|
import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
|
|
6
6
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./src/bridges/hot-bridge/error.js";
|
|
7
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError,
|
|
7
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
|
|
8
8
|
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
9
9
|
import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.js";
|
|
10
10
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
@@ -13,4 +13,4 @@ import { IntentsSDK } from "./src/sdk.js";
|
|
|
13
13
|
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
|
|
14
14
|
import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RpcRequestError, TimeoutError } from "@defuse-protocol/internal-utils";
|
|
15
15
|
|
|
16
|
-
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError,
|
|
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 };
|
|
@@ -40,24 +40,6 @@ var InvalidFeeValueError = class extends __defuse_protocol_internal_utils.BaseEr
|
|
|
40
40
|
this.token = token;
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
var OmniTokenNormalisationCheckError = class extends __defuse_protocol_internal_utils.BaseError {
|
|
44
|
-
constructor(tokenIn, destinationToken, minAmount, fee) {
|
|
45
|
-
super(`Transfer too small — normalizes to 0.`, {
|
|
46
|
-
metaMessages: [
|
|
47
|
-
`TokenIn: ${tokenIn}`,
|
|
48
|
-
`DestinationToken: ${destinationToken}`,
|
|
49
|
-
`MinAmount: ${minAmount}`,
|
|
50
|
-
`fee: ${fee}`
|
|
51
|
-
],
|
|
52
|
-
name: "OmniTokenNormalisationCheckError",
|
|
53
|
-
details: `Transfer amount sent to relayer is too small - would result in 0 after decimal normalisation. Minimum transferable amount if feeInclusive=false is >= ${minAmount}. Minimum transferable amount if feeInclusive=true is >= ${minAmount + fee}.`
|
|
54
|
-
});
|
|
55
|
-
this.tokenIn = tokenIn;
|
|
56
|
-
this.destinationToken = destinationToken;
|
|
57
|
-
this.minAmount = minAmount;
|
|
58
|
-
this.fee = fee;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
43
|
var IntentsNearOmniAvailableBalanceTooLowError = class extends __defuse_protocol_internal_utils.BaseError {
|
|
62
44
|
constructor(balance) {
|
|
63
45
|
super(`Omni storage balance of intents contract is too low to complete this transaction safely.`, {
|
|
@@ -87,7 +69,6 @@ var InsufficientUtxoForOmniBridgeWithdrawalError = class extends __defuse_protoc
|
|
|
87
69
|
exports.InsufficientUtxoForOmniBridgeWithdrawalError = InsufficientUtxoForOmniBridgeWithdrawalError;
|
|
88
70
|
exports.IntentsNearOmniAvailableBalanceTooLowError = IntentsNearOmniAvailableBalanceTooLowError;
|
|
89
71
|
exports.InvalidFeeValueError = InvalidFeeValueError;
|
|
90
|
-
exports.OmniTokenNormalisationCheckError = OmniTokenNormalisationCheckError;
|
|
91
72
|
exports.OmniTransferDestinationChainHashNotFoundError = OmniTransferDestinationChainHashNotFoundError;
|
|
92
73
|
exports.OmniTransferNotFoundError = OmniTransferNotFoundError;
|
|
93
74
|
exports.OmniWithdrawalApiFeeRequestTimeoutError = OmniWithdrawalApiFeeRequestTimeoutError;
|
|
@@ -32,16 +32,6 @@ declare class InvalidFeeValueError extends BaseError {
|
|
|
32
32
|
token: string;
|
|
33
33
|
constructor(token: string, value: unknown);
|
|
34
34
|
}
|
|
35
|
-
type OmniTokenNormalisationCheckErrorType = OmniTokenNormalisationCheckError & {
|
|
36
|
-
name: "OmniTokenNormalisationCheckError";
|
|
37
|
-
};
|
|
38
|
-
declare class OmniTokenNormalisationCheckError extends BaseError {
|
|
39
|
-
tokenIn: string;
|
|
40
|
-
destinationToken: string;
|
|
41
|
-
minAmount: bigint;
|
|
42
|
-
fee: bigint;
|
|
43
|
-
constructor(tokenIn: string, destinationToken: string, minAmount: bigint, fee: bigint);
|
|
44
|
-
}
|
|
45
35
|
type IntentsNearOmniAvailableBalanceTooLowErrorType = IntentsNearOmniAvailableBalanceTooLowError & {
|
|
46
36
|
name: "IntentsNearOmniAvailableBalanceTooLowError";
|
|
47
37
|
};
|
|
@@ -63,4 +53,4 @@ declare class InsufficientUtxoForOmniBridgeWithdrawalError extends BaseError {
|
|
|
63
53
|
constructor(destinationChain: Chain);
|
|
64
54
|
}
|
|
65
55
|
//#endregion
|
|
66
|
-
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType,
|
|
56
|
+
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
@@ -32,16 +32,6 @@ declare class InvalidFeeValueError extends BaseError {
|
|
|
32
32
|
token: string;
|
|
33
33
|
constructor(token: string, value: unknown);
|
|
34
34
|
}
|
|
35
|
-
type OmniTokenNormalisationCheckErrorType = OmniTokenNormalisationCheckError & {
|
|
36
|
-
name: "OmniTokenNormalisationCheckError";
|
|
37
|
-
};
|
|
38
|
-
declare class OmniTokenNormalisationCheckError extends BaseError {
|
|
39
|
-
tokenIn: string;
|
|
40
|
-
destinationToken: string;
|
|
41
|
-
minAmount: bigint;
|
|
42
|
-
fee: bigint;
|
|
43
|
-
constructor(tokenIn: string, destinationToken: string, minAmount: bigint, fee: bigint);
|
|
44
|
-
}
|
|
45
35
|
type IntentsNearOmniAvailableBalanceTooLowErrorType = IntentsNearOmniAvailableBalanceTooLowError & {
|
|
46
36
|
name: "IntentsNearOmniAvailableBalanceTooLowError";
|
|
47
37
|
};
|
|
@@ -63,4 +53,4 @@ declare class InsufficientUtxoForOmniBridgeWithdrawalError extends BaseError {
|
|
|
63
53
|
constructor(destinationChain: Chain);
|
|
64
54
|
}
|
|
65
55
|
//#endregion
|
|
66
|
-
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType,
|
|
56
|
+
export { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType };
|
|
@@ -39,24 +39,6 @@ var InvalidFeeValueError = class extends BaseError {
|
|
|
39
39
|
this.token = token;
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
var OmniTokenNormalisationCheckError = class extends BaseError {
|
|
43
|
-
constructor(tokenIn, destinationToken, minAmount, fee) {
|
|
44
|
-
super(`Transfer too small — normalizes to 0.`, {
|
|
45
|
-
metaMessages: [
|
|
46
|
-
`TokenIn: ${tokenIn}`,
|
|
47
|
-
`DestinationToken: ${destinationToken}`,
|
|
48
|
-
`MinAmount: ${minAmount}`,
|
|
49
|
-
`fee: ${fee}`
|
|
50
|
-
],
|
|
51
|
-
name: "OmniTokenNormalisationCheckError",
|
|
52
|
-
details: `Transfer amount sent to relayer is too small - would result in 0 after decimal normalisation. Minimum transferable amount if feeInclusive=false is >= ${minAmount}. Minimum transferable amount if feeInclusive=true is >= ${minAmount + fee}.`
|
|
53
|
-
});
|
|
54
|
-
this.tokenIn = tokenIn;
|
|
55
|
-
this.destinationToken = destinationToken;
|
|
56
|
-
this.minAmount = minAmount;
|
|
57
|
-
this.fee = fee;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
42
|
var IntentsNearOmniAvailableBalanceTooLowError = class extends BaseError {
|
|
61
43
|
constructor(balance) {
|
|
62
44
|
super(`Omni storage balance of intents contract is too low to complete this transaction safely.`, {
|
|
@@ -83,4 +65,4 @@ var InsufficientUtxoForOmniBridgeWithdrawalError = class extends BaseError {
|
|
|
83
65
|
};
|
|
84
66
|
|
|
85
67
|
//#endregion
|
|
86
|
-
export { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError,
|
|
68
|
+
export { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError };
|
|
@@ -156,10 +156,8 @@ 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
|
-
|
|
160
|
-
|
|
161
|
-
throw new require_error.OmniTokenNormalisationCheckError(args.assetId, destTokenAddress, minAmount, args.feeEstimation.amount);
|
|
162
|
-
}
|
|
159
|
+
const actualAmountWithFee = args.amount + args.feeEstimation.amount;
|
|
160
|
+
if ((0, omni_bridge_sdk.verifyTransferAmount)(actualAmountWithFee, args.feeEstimation.amount, decimals.origin_decimals, decimals.decimals) === false) throw new require_errors.MinWithdrawalAmountError((0, omni_bridge_sdk.getMinimumTransferableAmount)(decimals.origin_decimals, decimals.decimals), actualAmountWithFee, args.assetId);
|
|
163
161
|
const storageBalance = await require_omni_bridge_utils.getAccountOmniStorageBalance(this.nearProvider, __defuse_protocol_internal_utils.configsByEnvironment[this.env].contractID);
|
|
164
162
|
const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
|
|
165
163
|
if (intentsNearStorageBalance <= require_omni_bridge_constants.MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new require_error.IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
|
|
@@ -180,8 +178,8 @@ var OmniBridge = class {
|
|
|
180
178
|
const utxoProtocolFee = require_estimate_fee.getUnderlyingFee(args.feeEstimation, require_route_enum.RouteEnum.OmniBridge, "utxoProtocolFee");
|
|
181
179
|
(0, __defuse_protocol_internal_utils.assert)(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
|
|
182
180
|
(0, __defuse_protocol_internal_utils.assert)(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
|
|
183
|
-
const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
184
|
-
if (actualAmountWithFee < minAmount) throw new require_errors.MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
|
|
181
|
+
const actualAmountWithFee$1 = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
182
|
+
if (actualAmountWithFee$1 < minAmount) throw new require_errors.MinWithdrawalAmountError(minAmount, actualAmountWithFee$1, args.assetId);
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
185
|
async estimateWithdrawalFee(args) {
|
|
@@ -4,7 +4,7 @@ import { InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError,
|
|
|
4
4
|
import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
|
|
5
5
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
6
6
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
7
|
-
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError,
|
|
7
|
+
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, 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, isUtxoChain, validateOmniToken } from "./omni-bridge-utils.js";
|
|
10
10
|
import { RETRY_CONFIGS, assert, configsByEnvironment, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "@defuse-protocol/internal-utils";
|
|
@@ -154,10 +154,8 @@ 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
|
-
|
|
158
|
-
|
|
159
|
-
throw new OmniTokenNormalisationCheckError(args.assetId, destTokenAddress, minAmount, args.feeEstimation.amount);
|
|
160
|
-
}
|
|
157
|
+
const actualAmountWithFee = args.amount + args.feeEstimation.amount;
|
|
158
|
+
if (verifyTransferAmount(actualAmountWithFee, args.feeEstimation.amount, decimals.origin_decimals, decimals.decimals) === false) throw new MinWithdrawalAmountError(getMinimumTransferableAmount(decimals.origin_decimals, decimals.decimals), actualAmountWithFee, args.assetId);
|
|
161
159
|
const storageBalance = await getAccountOmniStorageBalance(this.nearProvider, configsByEnvironment[this.env].contractID);
|
|
162
160
|
const intentsNearStorageBalance = storageBalance === null ? 0n : BigInt(storageBalance.available);
|
|
163
161
|
if (intentsNearStorageBalance <= MIN_ALLOWED_STORAGE_BALANCE_FOR_INTENTS_NEAR) throw new IntentsNearOmniAvailableBalanceTooLowError(intentsNearStorageBalance.toString());
|
|
@@ -178,8 +176,8 @@ var OmniBridge = class {
|
|
|
178
176
|
const utxoProtocolFee = getUnderlyingFee(args.feeEstimation, RouteEnum.OmniBridge, "utxoProtocolFee");
|
|
179
177
|
assert(utxoMaxGasFee !== void 0 && utxoMaxGasFee > 0n, `Invalid Omni Bridge utxo max gas fee: expected > 0, got ${utxoMaxGasFee}`);
|
|
180
178
|
assert(utxoProtocolFee !== void 0 && utxoProtocolFee > 0n, `Invalid Omni Bridge utxo protocol fee: expected > 0, got ${utxoProtocolFee}`);
|
|
181
|
-
const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
182
|
-
if (actualAmountWithFee < minAmount) throw new MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
|
|
179
|
+
const actualAmountWithFee$1 = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
180
|
+
if (actualAmountWithFee$1 < minAmount) throw new MinWithdrawalAmountError(minAmount, actualAmountWithFee$1, args.assetId);
|
|
183
181
|
}
|
|
184
182
|
}
|
|
185
183
|
async estimateWithdrawalFee(args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defuse-protocol/intents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"valibot": "^1.0.0",
|
|
40
40
|
"viem": "^2.0.0",
|
|
41
41
|
"@defuse-protocol/contract-types": "0.4.3",
|
|
42
|
-
"@defuse-protocol/internal-utils": "0.
|
|
42
|
+
"@defuse-protocol/internal-utils": "0.20.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsdown": "0.15.5",
|