@defuse-protocol/intents-sdk 0.41.1 → 0.43.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 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 };
@@ -9,7 +9,8 @@ const HotBridgeChains = [
9
9
  require_caip2.Chains.Avalanche,
10
10
  require_caip2.Chains.Monad,
11
11
  require_caip2.Chains.Stellar,
12
- require_caip2.Chains.LayerX
12
+ require_caip2.Chains.LayerX,
13
+ require_caip2.Chains.Adi
13
14
  ];
14
15
  const HotBridgeEVMChains = HotBridgeChains.filter((a) => a.startsWith("eip155:"));
15
16
 
@@ -1,6 +1,6 @@
1
1
  //#region src/bridges/hot-bridge/hot-bridge-chains.d.ts
2
2
  type HotBridgeChain = (typeof HotBridgeChains)[number];
3
3
  type HotBridgeEVMChain = Extract<HotBridgeChain, `eip155:${string}`>;
4
- declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:143" | "eip155:196" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
4
+ declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:143" | "eip155:196" | "eip155:36900" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
5
5
  //#endregion
6
6
  export { HotBridgeEVMChain };
@@ -1,6 +1,6 @@
1
1
  //#region src/bridges/hot-bridge/hot-bridge-chains.d.ts
2
2
  type HotBridgeChain = (typeof HotBridgeChains)[number];
3
3
  type HotBridgeEVMChain = Extract<HotBridgeChain, `eip155:${string}`>;
4
- declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:143" | "eip155:196" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
4
+ declare const HotBridgeChains: ("eip155:10" | "eip155:56" | "eip155:137" | "eip155:143" | "eip155:196" | "eip155:36900" | "eip155:43114" | "tvm:-239" | "stellar:pubnet")[];
5
5
  //#endregion
6
6
  export { HotBridgeEVMChain };
@@ -9,7 +9,8 @@ const HotBridgeChains = [
9
9
  Chains.Avalanche,
10
10
  Chains.Monad,
11
11
  Chains.Stellar,
12
- Chains.LayerX
12
+ Chains.LayerX,
13
+ Chains.Adi
13
14
  ];
14
15
  const HotBridgeEVMChains = HotBridgeChains.filter((a) => a.startsWith("eip155:"));
15
16
 
@@ -6,6 +6,7 @@ let __hot_labs_omni_sdk = require("@hot-labs/omni-sdk");
6
6
 
7
7
  //#region src/bridges/hot-bridge/hot-bridge-utils.ts
8
8
  const MONAD_MAINNET_NETWORK_ID = 143;
9
+ const ADI_NETWORK_ID = 36900;
9
10
  const nativeTokenMapping = {
10
11
  [require_caip2.Chains.BNB]: "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
11
12
  [require_caip2.Chains.Polygon]: "nep245:v2_1.omni.hot.tg:137_11111111111111111111",
@@ -14,7 +15,8 @@ const nativeTokenMapping = {
14
15
  [require_caip2.Chains.Optimism]: "nep245:v2_1.omni.hot.tg:10_11111111111111111111",
15
16
  [require_caip2.Chains.Avalanche]: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
16
17
  [require_caip2.Chains.Stellar]: "nep245:v2_1.omni.hot.tg:1100_111bzQBB5v7AhLyPMDwS8uJgQV24KaAPXtwyVWu2KXbbfQU6NXRCz",
17
- [require_caip2.Chains.LayerX]: "nep245:v2_1.omni.hot.tg:196_11111111111111111111"
18
+ [require_caip2.Chains.LayerX]: "nep245:v2_1.omni.hot.tg:196_11111111111111111111",
19
+ [require_caip2.Chains.Adi]: "nep245:v2_1.omni.hot.tg:36900_11111111111111111111"
18
20
  };
19
21
  const caip2NetworkIdMapping = {
20
22
  [require_caip2.Chains.BNB]: __hot_labs_omni_sdk.Network.Bnb,
@@ -24,7 +26,8 @@ const caip2NetworkIdMapping = {
24
26
  [require_caip2.Chains.Optimism]: __hot_labs_omni_sdk.Network.Optimism,
25
27
  [require_caip2.Chains.Avalanche]: __hot_labs_omni_sdk.Network.Avalanche,
26
28
  [require_caip2.Chains.Stellar]: __hot_labs_omni_sdk.Network.Stellar,
27
- [require_caip2.Chains.LayerX]: __hot_labs_omni_sdk.Network.Xlayer
29
+ [require_caip2.Chains.LayerX]: __hot_labs_omni_sdk.Network.Xlayer,
30
+ [require_caip2.Chains.Adi]: ADI_NETWORK_ID
28
31
  };
29
32
  const networkIdCAIP2Mapping = Object.fromEntries(Object.entries(caip2NetworkIdMapping).map(([k, v]) => [v, k]));
30
33
  function getFeeAssetIdForChain(caip2) {
@@ -5,6 +5,7 @@ import { Network } from "@hot-labs/omni-sdk";
5
5
 
6
6
  //#region src/bridges/hot-bridge/hot-bridge-utils.ts
7
7
  const MONAD_MAINNET_NETWORK_ID = 143;
8
+ const ADI_NETWORK_ID = 36900;
8
9
  const nativeTokenMapping = {
9
10
  [Chains.BNB]: "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
10
11
  [Chains.Polygon]: "nep245:v2_1.omni.hot.tg:137_11111111111111111111",
@@ -13,7 +14,8 @@ const nativeTokenMapping = {
13
14
  [Chains.Optimism]: "nep245:v2_1.omni.hot.tg:10_11111111111111111111",
14
15
  [Chains.Avalanche]: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
15
16
  [Chains.Stellar]: "nep245:v2_1.omni.hot.tg:1100_111bzQBB5v7AhLyPMDwS8uJgQV24KaAPXtwyVWu2KXbbfQU6NXRCz",
16
- [Chains.LayerX]: "nep245:v2_1.omni.hot.tg:196_11111111111111111111"
17
+ [Chains.LayerX]: "nep245:v2_1.omni.hot.tg:196_11111111111111111111",
18
+ [Chains.Adi]: "nep245:v2_1.omni.hot.tg:36900_11111111111111111111"
17
19
  };
18
20
  const caip2NetworkIdMapping = {
19
21
  [Chains.BNB]: Network.Bnb,
@@ -23,7 +25,8 @@ const caip2NetworkIdMapping = {
23
25
  [Chains.Optimism]: Network.Optimism,
24
26
  [Chains.Avalanche]: Network.Avalanche,
25
27
  [Chains.Stellar]: Network.Stellar,
26
- [Chains.LayerX]: Network.Xlayer
28
+ [Chains.LayerX]: Network.Xlayer,
29
+ [Chains.Adi]: ADI_NETWORK_ID
27
30
  };
28
31
  const networkIdCAIP2Mapping = Object.fromEntries(Object.entries(caip2NetworkIdMapping).map(([k, v]) => [v, k]));
29
32
  function getFeeAssetIdForChain(caip2) {
@@ -17,7 +17,7 @@ function createWithdrawIntentPrimitive(params) {
17
17
  };
18
18
  }
19
19
  function createWithdrawMemo({ receiverAddress, xrpMemo }) {
20
- const memo = ["WITHDRAW_TO", receiverAddress];
20
+ const memo = ["WITHDRAW_TO", receiverAddress.toLowerCase().startsWith("bitcoincash:") ? receiverAddress.slice(12) : receiverAddress];
21
21
  if (xrpMemo != null && xrpMemo !== "") memo.push(xrpMemo);
22
22
  return memo.join(":");
23
23
  }
@@ -26,6 +26,7 @@ const caip2Mapping = {
26
26
  [require_caip2.Chains.Base]: "eth:8453",
27
27
  [require_caip2.Chains.Arbitrum]: "eth:42161",
28
28
  [require_caip2.Chains.Bitcoin]: "btc:mainnet",
29
+ [require_caip2.Chains.BitcoinCash]: "bch:mainnet",
29
30
  [require_caip2.Chains.Solana]: "sol:mainnet",
30
31
  [require_caip2.Chains.Dogecoin]: "doge:mainnet",
31
32
  [require_caip2.Chains.XRPL]: "xrp:mainnet",
@@ -36,7 +37,8 @@ const caip2Mapping = {
36
37
  [require_caip2.Chains.Sui]: "sui:mainnet",
37
38
  [require_caip2.Chains.Aptos]: "aptos:mainnet",
38
39
  [require_caip2.Chains.Cardano]: "cardano:mainnet",
39
- [require_caip2.Chains.Litecoin]: "ltc:mainnet"
40
+ [require_caip2.Chains.Litecoin]: "ltc:mainnet",
41
+ [require_caip2.Chains.Starknet]: "starknet:mainnet"
40
42
  };
41
43
  function toPoaNetwork(caip2) {
42
44
  if (caip2Mapping[caip2] == null) throw new Error(`Unsupported POA Bridge chain = ${caip2}`);
@@ -47,6 +49,7 @@ const tokenPrefixMapping = {
47
49
  base: require_caip2.Chains.Base,
48
50
  arb: require_caip2.Chains.Arbitrum,
49
51
  btc: require_caip2.Chains.Bitcoin,
52
+ bch: require_caip2.Chains.BitcoinCash,
50
53
  sol: require_caip2.Chains.Solana,
51
54
  doge: require_caip2.Chains.Dogecoin,
52
55
  xrp: require_caip2.Chains.XRPL,
@@ -57,7 +60,8 @@ const tokenPrefixMapping = {
57
60
  sui: require_caip2.Chains.Sui,
58
61
  aptos: require_caip2.Chains.Aptos,
59
62
  cardano: require_caip2.Chains.Cardano,
60
- ltc: require_caip2.Chains.Litecoin
63
+ ltc: require_caip2.Chains.Litecoin,
64
+ starknet: require_caip2.Chains.Starknet
61
65
  };
62
66
  function contractIdToCaip2(contractId) {
63
67
  for (const [prefix, caip2] of Object.entries(tokenPrefixMapping)) if (contractId.startsWith(`${prefix}.`) || contractId.startsWith(`${prefix}-`)) return caip2;
@@ -16,7 +16,7 @@ function createWithdrawIntentPrimitive(params) {
16
16
  };
17
17
  }
18
18
  function createWithdrawMemo({ receiverAddress, xrpMemo }) {
19
- const memo = ["WITHDRAW_TO", receiverAddress];
19
+ const memo = ["WITHDRAW_TO", receiverAddress.toLowerCase().startsWith("bitcoincash:") ? receiverAddress.slice(12) : receiverAddress];
20
20
  if (xrpMemo != null && xrpMemo !== "") memo.push(xrpMemo);
21
21
  return memo.join(":");
22
22
  }
@@ -25,6 +25,7 @@ const caip2Mapping = {
25
25
  [Chains.Base]: "eth:8453",
26
26
  [Chains.Arbitrum]: "eth:42161",
27
27
  [Chains.Bitcoin]: "btc:mainnet",
28
+ [Chains.BitcoinCash]: "bch:mainnet",
28
29
  [Chains.Solana]: "sol:mainnet",
29
30
  [Chains.Dogecoin]: "doge:mainnet",
30
31
  [Chains.XRPL]: "xrp:mainnet",
@@ -35,7 +36,8 @@ const caip2Mapping = {
35
36
  [Chains.Sui]: "sui:mainnet",
36
37
  [Chains.Aptos]: "aptos:mainnet",
37
38
  [Chains.Cardano]: "cardano:mainnet",
38
- [Chains.Litecoin]: "ltc:mainnet"
39
+ [Chains.Litecoin]: "ltc:mainnet",
40
+ [Chains.Starknet]: "starknet:mainnet"
39
41
  };
40
42
  function toPoaNetwork(caip2) {
41
43
  if (caip2Mapping[caip2] == null) throw new Error(`Unsupported POA Bridge chain = ${caip2}`);
@@ -46,6 +48,7 @@ const tokenPrefixMapping = {
46
48
  base: Chains.Base,
47
49
  arb: Chains.Arbitrum,
48
50
  btc: Chains.Bitcoin,
51
+ bch: Chains.BitcoinCash,
49
52
  sol: Chains.Solana,
50
53
  doge: Chains.Dogecoin,
51
54
  xrp: Chains.XRPL,
@@ -56,7 +59,8 @@ const tokenPrefixMapping = {
56
59
  sui: Chains.Sui,
57
60
  aptos: Chains.Aptos,
58
61
  cardano: Chains.Cardano,
59
- ltc: Chains.Litecoin
62
+ ltc: Chains.Litecoin,
63
+ starknet: Chains.Starknet
60
64
  };
61
65
  function contractIdToCaip2(contractId) {
62
66
  for (const [prefix, caip2] of Object.entries(tokenPrefixMapping)) if (contractId.startsWith(`${prefix}.`) || contractId.startsWith(`${prefix}-`)) return caip2;
@@ -10,7 +10,8 @@ const PUBLIC_EVM_RPC_URLS = {
10
10
  [require_caip2.Chains.Monad]: ["https://rpc.monad.xyz"],
11
11
  [require_caip2.Chains.Optimism]: ["https://optimism-rpc.publicnode.com"],
12
12
  [require_caip2.Chains.Avalanche]: ["https://avalanche-c-chain-rpc.publicnode.com"],
13
- [require_caip2.Chains.LayerX]: ["https://rpc.xlayer.tech"]
13
+ [require_caip2.Chains.LayerX]: ["https://rpc.xlayer.tech"],
14
+ [require_caip2.Chains.Adi]: ["https://rpc.adifoundation.ai"]
14
15
  };
15
16
  const PUBLIC_STELLAR_RPC_URLS = {
16
17
  soroban: ["https://mainnet.sorobanrpc.com"],
@@ -10,7 +10,8 @@ const PUBLIC_EVM_RPC_URLS = {
10
10
  [Chains.Monad]: ["https://rpc.monad.xyz"],
11
11
  [Chains.Optimism]: ["https://optimism-rpc.publicnode.com"],
12
12
  [Chains.Avalanche]: ["https://avalanche-c-chain-rpc.publicnode.com"],
13
- [Chains.LayerX]: ["https://rpc.xlayer.tech"]
13
+ [Chains.LayerX]: ["https://rpc.xlayer.tech"],
14
+ [Chains.Adi]: ["https://rpc.adifoundation.ai"]
14
15
  };
15
16
  const PUBLIC_STELLAR_RPC_URLS = {
16
17
  soroban: ["https://mainnet.sorobanrpc.com"],
@@ -7,6 +7,7 @@ let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils"
7
7
  */
8
8
  const Chains = {
9
9
  Bitcoin: "bip122:000000000019d6689c085ae165831e93",
10
+ BitcoinCash: "bip122:000000000000000000651ef99cb9fcbe",
10
11
  Zcash: "bip122:00040fe8ec8471911baa1db1266ea15d",
11
12
  Dogecoin: "bip122:1a91e3dace36e2be3bf030a65679fe82",
12
13
  Litecoin: "bip122:12a765e31ffd4059bada1e25190f6e98",
@@ -17,6 +18,7 @@ const Chains = {
17
18
  Polygon: "eip155:137",
18
19
  Monad: "eip155:143",
19
20
  LayerX: "eip155:196",
21
+ Adi: "eip155:36900",
20
22
  Base: "eip155:8453",
21
23
  Arbitrum: "eip155:42161",
22
24
  Avalanche: "eip155:43114",
@@ -29,7 +31,8 @@ const Chains = {
29
31
  Sui: "sui:mainnet",
30
32
  Aptos: "aptos:mainnet",
31
33
  Stellar: "stellar:pubnet",
32
- Cardano: "cip34:1-764824073"
34
+ Cardano: "cip34:1-764824073",
35
+ Starknet: "starknet:SN_MAIN"
33
36
  };
34
37
  function getEIP155ChainId(chain) {
35
38
  (0, __defuse_protocol_internal_utils.assert)(chain.startsWith("eip155:"), "Chain is not an EIP-155 chain");
@@ -4,6 +4,7 @@
4
4
  */
5
5
  declare const Chains: {
6
6
  readonly Bitcoin: "bip122:000000000019d6689c085ae165831e93";
7
+ readonly BitcoinCash: "bip122:000000000000000000651ef99cb9fcbe";
7
8
  readonly Zcash: "bip122:00040fe8ec8471911baa1db1266ea15d";
8
9
  readonly Dogecoin: "bip122:1a91e3dace36e2be3bf030a65679fe82";
9
10
  readonly Litecoin: "bip122:12a765e31ffd4059bada1e25190f6e98";
@@ -14,6 +15,7 @@ declare const Chains: {
14
15
  readonly Polygon: "eip155:137";
15
16
  readonly Monad: "eip155:143";
16
17
  readonly LayerX: "eip155:196";
18
+ readonly Adi: "eip155:36900";
17
19
  readonly Base: "eip155:8453";
18
20
  readonly Arbitrum: "eip155:42161";
19
21
  readonly Avalanche: "eip155:43114";
@@ -27,6 +29,7 @@ declare const Chains: {
27
29
  readonly Aptos: "aptos:mainnet";
28
30
  readonly Stellar: "stellar:pubnet";
29
31
  readonly Cardano: "cip34:1-764824073";
32
+ readonly Starknet: "starknet:SN_MAIN";
30
33
  };
31
34
  type Chain = (typeof Chains)[keyof typeof Chains];
32
35
  //#endregion
@@ -4,6 +4,7 @@
4
4
  */
5
5
  declare const Chains: {
6
6
  readonly Bitcoin: "bip122:000000000019d6689c085ae165831e93";
7
+ readonly BitcoinCash: "bip122:000000000000000000651ef99cb9fcbe";
7
8
  readonly Zcash: "bip122:00040fe8ec8471911baa1db1266ea15d";
8
9
  readonly Dogecoin: "bip122:1a91e3dace36e2be3bf030a65679fe82";
9
10
  readonly Litecoin: "bip122:12a765e31ffd4059bada1e25190f6e98";
@@ -14,6 +15,7 @@ declare const Chains: {
14
15
  readonly Polygon: "eip155:137";
15
16
  readonly Monad: "eip155:143";
16
17
  readonly LayerX: "eip155:196";
18
+ readonly Adi: "eip155:36900";
17
19
  readonly Base: "eip155:8453";
18
20
  readonly Arbitrum: "eip155:42161";
19
21
  readonly Avalanche: "eip155:43114";
@@ -27,6 +29,7 @@ declare const Chains: {
27
29
  readonly Aptos: "aptos:mainnet";
28
30
  readonly Stellar: "stellar:pubnet";
29
31
  readonly Cardano: "cip34:1-764824073";
32
+ readonly Starknet: "starknet:SN_MAIN";
30
33
  };
31
34
  type Chain = (typeof Chains)[keyof typeof Chains];
32
35
  //#endregion
@@ -6,6 +6,7 @@ import { assert } from "@defuse-protocol/internal-utils";
6
6
  */
7
7
  const Chains = {
8
8
  Bitcoin: "bip122:000000000019d6689c085ae165831e93",
9
+ BitcoinCash: "bip122:000000000000000000651ef99cb9fcbe",
9
10
  Zcash: "bip122:00040fe8ec8471911baa1db1266ea15d",
10
11
  Dogecoin: "bip122:1a91e3dace36e2be3bf030a65679fe82",
11
12
  Litecoin: "bip122:12a765e31ffd4059bada1e25190f6e98",
@@ -16,6 +17,7 @@ const Chains = {
16
17
  Polygon: "eip155:137",
17
18
  Monad: "eip155:143",
18
19
  LayerX: "eip155:196",
20
+ Adi: "eip155:36900",
19
21
  Base: "eip155:8453",
20
22
  Arbitrum: "eip155:42161",
21
23
  Avalanche: "eip155:43114",
@@ -28,7 +30,8 @@ const Chains = {
28
30
  Sui: "sui:mainnet",
29
31
  Aptos: "aptos:mainnet",
30
32
  Stellar: "stellar:pubnet",
31
- Cardano: "cip34:1-764824073"
33
+ Cardano: "cip34:1-764824073",
34
+ Starknet: "starknet:SN_MAIN"
32
35
  };
33
36
  function getEIP155ChainId(chain) {
34
37
  assert(chain.startsWith("eip155:"), "Chain is not an EIP-155 chain");
@@ -8,10 +8,18 @@ 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);
14
21
  case require_caip2.Chains.Bitcoin: return validateBtcAddress(address);
22
+ case require_caip2.Chains.BitcoinCash: return validateBchAddress(address);
15
23
  case require_caip2.Chains.Solana: return validateSolAddress(address);
16
24
  case require_caip2.Chains.Dogecoin: return validateDogeAddress(address);
17
25
  case require_caip2.Chains.Litecoin: return validateLitecoinAddress(address);
@@ -23,6 +31,7 @@ function validateAddress(address, blockchain) {
23
31
  case require_caip2.Chains.Stellar: return validateStellarAddress(address);
24
32
  case require_caip2.Chains.Aptos: return validateAptosAddress(address);
25
33
  case require_caip2.Chains.Cardano: return validateCardanoAddress(address);
34
+ case require_caip2.Chains.Starknet: return validateStarknetAddress(address);
26
35
  case require_caip2.Chains.Ethereum:
27
36
  case require_caip2.Chains.Optimism:
28
37
  case require_caip2.Chains.BNB:
@@ -30,6 +39,7 @@ function validateAddress(address, blockchain) {
30
39
  case require_caip2.Chains.Polygon:
31
40
  case require_caip2.Chains.Monad:
32
41
  case require_caip2.Chains.LayerX:
42
+ case require_caip2.Chains.Adi:
33
43
  case require_caip2.Chains.Base:
34
44
  case require_caip2.Chains.Arbitrum:
35
45
  case require_caip2.Chains.Avalanche:
@@ -43,6 +53,62 @@ function validateEthAddress(address) {
43
53
  function validateBtcAddress(address) {
44
54
  return /^1[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address) || /^3[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address) || /^bc1[02-9ac-hj-np-z]{11,87}$/.test(address) || /^bc1p[02-9ac-hj-np-z]{42,87}$/.test(address);
45
55
  }
56
+ /**
57
+ * Validates Bitcoin Cash addresses
58
+ * Supports:
59
+ * - Legacy addresses (1... for P2PKH, 3... for P2SH) - shared with Bitcoin
60
+ * - CashAddr format (bitcoincash:q... or q... for P2PKH, bitcoincash:p... or p... for P2SH)
61
+ *
62
+ * CashAddr checksum implementation based on:
63
+ * @see https://github.com/ealmansi/cashaddrjs (MIT License)
64
+ * @see https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md
65
+ */
66
+ function validateBchAddress(address) {
67
+ if (/^1[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address) || /^3[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address)) return true;
68
+ return validateBchCashAddr(address);
69
+ }
70
+ /**
71
+ * Validates Bitcoin Cash CashAddr format
72
+ * CashAddr uses a modified Bech32 encoding with polymod checksum
73
+ */
74
+ function validateBchCashAddr(address) {
75
+ let normalized = address.toLowerCase();
76
+ if (!normalized.includes(":")) normalized = `bitcoincash:${normalized}`;
77
+ if (!normalized.startsWith("bitcoincash:")) return false;
78
+ const payload = normalized.slice(12);
79
+ if (!payload.startsWith("q") && !payload.startsWith("p")) return false;
80
+ const CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
81
+ for (const char of payload) if (!CHARSET.includes(char)) return false;
82
+ if (payload.length !== 42 && payload.length !== 61) return false;
83
+ return verifyBchChecksum(normalized);
84
+ }
85
+ function verifyBchChecksum(address) {
86
+ const CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
87
+ const colonIndex = address.indexOf(":");
88
+ const prefix = address.slice(0, colonIndex);
89
+ const payload = address.slice(colonIndex + 1);
90
+ const prefixData = [];
91
+ for (const char of prefix) prefixData.push(char.charCodeAt(0) & 31);
92
+ prefixData.push(0);
93
+ const payloadData = [];
94
+ for (const char of payload) {
95
+ const idx = CHARSET.indexOf(char);
96
+ if (idx === -1) return false;
97
+ payloadData.push(idx);
98
+ }
99
+ const values = [...prefixData, ...payloadData];
100
+ let c = 1n;
101
+ for (const d of values) {
102
+ const c0 = c >> 35n;
103
+ c = (c & 34359738367n) << 5n ^ BigInt(d);
104
+ if (c0 & 1n) c ^= 656907472481n;
105
+ if (c0 & 2n) c ^= 522768456162n;
106
+ if (c0 & 4n) c ^= 1044723512260n;
107
+ if (c0 & 8n) c ^= 748107326120n;
108
+ if (c0 & 16n) c ^= 130178868336n;
109
+ }
110
+ return (c ^ 1n) === 0n;
111
+ }
46
112
  function validateSolAddress(address) {
47
113
  try {
48
114
  return __solana_web3_js.PublicKey.isOnCurve(address);
@@ -137,6 +203,14 @@ function validateCardanoAddress(address) {
137
203
  return false;
138
204
  }
139
205
  }
206
+ /**
207
+ * Validates Starknet addresses
208
+ * Starknet addresses are felt252 (252-bit field elements) represented as
209
+ * hex strings with 0x prefix (up to 64 hex characters)
210
+ */
211
+ function validateStarknetAddress(address) {
212
+ return /^0x[a-fA-F0-9]{1,64}$/.test(address);
213
+ }
140
214
  function validateLitecoinAddress(address) {
141
215
  const first = address[0];
142
216
  if (first === "L") return validateLitecoinBase58Address(address, 48);
@@ -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,10 +7,18 @@ 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);
13
20
  case Chains.Bitcoin: return validateBtcAddress(address);
21
+ case Chains.BitcoinCash: return validateBchAddress(address);
14
22
  case Chains.Solana: return validateSolAddress(address);
15
23
  case Chains.Dogecoin: return validateDogeAddress(address);
16
24
  case Chains.Litecoin: return validateLitecoinAddress(address);
@@ -22,6 +30,7 @@ function validateAddress(address, blockchain) {
22
30
  case Chains.Stellar: return validateStellarAddress(address);
23
31
  case Chains.Aptos: return validateAptosAddress(address);
24
32
  case Chains.Cardano: return validateCardanoAddress(address);
33
+ case Chains.Starknet: return validateStarknetAddress(address);
25
34
  case Chains.Ethereum:
26
35
  case Chains.Optimism:
27
36
  case Chains.BNB:
@@ -29,6 +38,7 @@ function validateAddress(address, blockchain) {
29
38
  case Chains.Polygon:
30
39
  case Chains.Monad:
31
40
  case Chains.LayerX:
41
+ case Chains.Adi:
32
42
  case Chains.Base:
33
43
  case Chains.Arbitrum:
34
44
  case Chains.Avalanche:
@@ -42,6 +52,62 @@ function validateEthAddress(address) {
42
52
  function validateBtcAddress(address) {
43
53
  return /^1[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address) || /^3[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address) || /^bc1[02-9ac-hj-np-z]{11,87}$/.test(address) || /^bc1p[02-9ac-hj-np-z]{42,87}$/.test(address);
44
54
  }
55
+ /**
56
+ * Validates Bitcoin Cash addresses
57
+ * Supports:
58
+ * - Legacy addresses (1... for P2PKH, 3... for P2SH) - shared with Bitcoin
59
+ * - CashAddr format (bitcoincash:q... or q... for P2PKH, bitcoincash:p... or p... for P2SH)
60
+ *
61
+ * CashAddr checksum implementation based on:
62
+ * @see https://github.com/ealmansi/cashaddrjs (MIT License)
63
+ * @see https://github.com/bitcoincashorg/bitcoincash.org/blob/master/spec/cashaddr.md
64
+ */
65
+ function validateBchAddress(address) {
66
+ if (/^1[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address) || /^3[1-9A-HJ-NP-Za-km-z]{25,34}$/.test(address)) return true;
67
+ return validateBchCashAddr(address);
68
+ }
69
+ /**
70
+ * Validates Bitcoin Cash CashAddr format
71
+ * CashAddr uses a modified Bech32 encoding with polymod checksum
72
+ */
73
+ function validateBchCashAddr(address) {
74
+ let normalized = address.toLowerCase();
75
+ if (!normalized.includes(":")) normalized = `bitcoincash:${normalized}`;
76
+ if (!normalized.startsWith("bitcoincash:")) return false;
77
+ const payload = normalized.slice(12);
78
+ if (!payload.startsWith("q") && !payload.startsWith("p")) return false;
79
+ const CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
80
+ for (const char of payload) if (!CHARSET.includes(char)) return false;
81
+ if (payload.length !== 42 && payload.length !== 61) return false;
82
+ return verifyBchChecksum(normalized);
83
+ }
84
+ function verifyBchChecksum(address) {
85
+ const CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
86
+ const colonIndex = address.indexOf(":");
87
+ const prefix = address.slice(0, colonIndex);
88
+ const payload = address.slice(colonIndex + 1);
89
+ const prefixData = [];
90
+ for (const char of prefix) prefixData.push(char.charCodeAt(0) & 31);
91
+ prefixData.push(0);
92
+ const payloadData = [];
93
+ for (const char of payload) {
94
+ const idx = CHARSET.indexOf(char);
95
+ if (idx === -1) return false;
96
+ payloadData.push(idx);
97
+ }
98
+ const values = [...prefixData, ...payloadData];
99
+ let c = 1n;
100
+ for (const d of values) {
101
+ const c0 = c >> 35n;
102
+ c = (c & 34359738367n) << 5n ^ BigInt(d);
103
+ if (c0 & 1n) c ^= 656907472481n;
104
+ if (c0 & 2n) c ^= 522768456162n;
105
+ if (c0 & 4n) c ^= 1044723512260n;
106
+ if (c0 & 8n) c ^= 748107326120n;
107
+ if (c0 & 16n) c ^= 130178868336n;
108
+ }
109
+ return (c ^ 1n) === 0n;
110
+ }
45
111
  function validateSolAddress(address) {
46
112
  try {
47
113
  return PublicKey.isOnCurve(address);
@@ -136,6 +202,14 @@ function validateCardanoAddress(address) {
136
202
  return false;
137
203
  }
138
204
  }
205
+ /**
206
+ * Validates Starknet addresses
207
+ * Starknet addresses are felt252 (252-bit field elements) represented as
208
+ * hex strings with 0x prefix (up to 64 hex characters)
209
+ */
210
+ function validateStarknetAddress(address) {
211
+ return /^0x[a-fA-F0-9]{1,64}$/.test(address);
212
+ }
139
213
  function validateLitecoinAddress(address) {
140
214
  const first = address[0];
141
215
  if (first === "L") return validateLitecoinBase58Address(address, 48);
package/package.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "name": "@defuse-protocol/intents-sdk",
3
- "version": "0.41.1",
3
+ "version": "0.43.0",
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",
@@ -39,7 +48,7 @@
39
48
  "valibot": "^1.0.0",
40
49
  "viem": "^2.0.0",
41
50
  "@defuse-protocol/contract-types": "0.4.3",
42
- "@defuse-protocol/internal-utils": "0.20.0"
51
+ "@defuse-protocol/internal-utils": "0.21.0"
43
52
  },
44
53
  "devDependencies": {
45
54
  "tsdown": "0.15.5",