@defuse-protocol/intents-sdk 0.78.1 → 0.80.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/README.md +3 -45
- package/dist/index.cjs +3 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/src/bridges/direct-bridge/direct-bridge.cjs +3 -0
- package/dist/src/bridges/direct-bridge/direct-bridge.js +4 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.cjs +4 -1
- package/dist/src/bridges/hot-bridge/hot-bridge.js +5 -2
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.cjs +5 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-constants.js +3 -1
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +2 -2
- package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +2 -2
- package/dist/src/bridges/omni-bridge/omni-bridge.cjs +16 -15
- package/dist/src/bridges/omni-bridge/omni-bridge.js +19 -18
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +0 -6
- package/dist/src/bridges/poa-bridge/poa-bridge-utils.js +0 -6
- package/dist/src/bridges/poa-bridge/poa-bridge.cjs +6 -4
- package/dist/src/bridges/poa-bridge/poa-bridge.js +7 -5
- package/dist/src/classes/errors.cjs +11 -0
- package/dist/src/classes/errors.d.cts +9 -1
- package/dist/src/classes/errors.d.ts +9 -1
- package/dist/src/classes/errors.js +11 -1
- package/dist/src/constants/{poa-tokens-routable-through-omni-bridge.cjs → poa-tokens-migrated-to-omni-bridge.cjs} +9 -7
- package/dist/src/constants/poa-tokens-migrated-to-omni-bridge.d.cts +10 -0
- package/dist/src/constants/poa-tokens-migrated-to-omni-bridge.d.ts +10 -0
- package/dist/src/constants/{poa-tokens-routable-through-omni-bridge.js → poa-tokens-migrated-to-omni-bridge.js} +9 -7
- package/dist/src/lib/compareAddresses.cjs +116 -0
- package/dist/src/lib/compareAddresses.js +115 -0
- package/dist/src/lib/validateAddress.cjs +2 -0
- package/dist/src/lib/validateAddress.js +2 -0
- package/dist/src/sdk.cjs +1 -3
- package/dist/src/sdk.d.cts +0 -7
- package/dist/src/sdk.d.ts +0 -7
- package/dist/src/sdk.js +1 -3
- package/package.json +4 -4
- package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.cts +0 -12
- package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.ts +0 -12
package/README.md
CHANGED
|
@@ -279,6 +279,9 @@ The SDK automatically detects and supports multiple route types based on asset i
|
|
|
279
279
|
- **Supported Assets**: Fungible tokens (NEP-141) supported by omni bridge relayer.
|
|
280
280
|
- **Use Case**: multi-chain transfers for supported list of chains
|
|
281
281
|
- **Route Type**: `omni_bridge`
|
|
282
|
+
- **Note**: Some tokens originally issued via the PoA Bridge (`.omft.near`) have since migrated to the Omni Bridge.
|
|
283
|
+
The SDK tracks these in `POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE` and automatically routes them through Omni Bridge
|
|
284
|
+
instead of PoA Bridge.
|
|
282
285
|
|
|
283
286
|
##### Internal Transfer Route
|
|
284
287
|
|
|
@@ -363,51 +366,6 @@ const sdk = new IntentsSDK({
|
|
|
363
366
|
});
|
|
364
367
|
```
|
|
365
368
|
|
|
366
|
-
### Feature Flags
|
|
367
|
-
|
|
368
|
-
Configure optional SDK features through the `features` configuration:
|
|
369
|
-
|
|
370
|
-
#### Migrated PoA Token Routing
|
|
371
|
-
|
|
372
|
-
Will route migrated PoA tokens (ending with `*.omft.near`) through Omni Bridge instead of the legacy PoA Bridge, unless explicitly set to route them through PoA bridge with routeConfig. Enable this when working with POA tokens that have been migrated to the Omni infrastructure:
|
|
373
|
-
|
|
374
|
-
```typescript
|
|
375
|
-
const sdk = new IntentsSDK({
|
|
376
|
-
referral: 'your-referral-code',
|
|
377
|
-
features: {
|
|
378
|
-
routeMigratedPoaTokensThroughOmniBridge: true
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
// With this flag enabled, tokens like 'nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near' will route through Omni Bridge
|
|
383
|
-
const result = await sdk.processWithdrawal({
|
|
384
|
-
withdrawalParams: {
|
|
385
|
-
assetId: 'nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near', // Migrated PoA token
|
|
386
|
-
amount: 1000000n,
|
|
387
|
-
destinationAddress: '39hqXivfCPUSqmXAaX3eo4JcA5bGFXhhs26dmg585DGb',
|
|
388
|
-
feeInclusive: false
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
**When to enable:**
|
|
394
|
-
- Working with PoA tokens that have been migrated to Omni Bridge
|
|
395
|
-
- Explicitly want to route `*.omft.near` tokens through the Omni Bridge
|
|
396
|
-
- Default behavior (when disabled) routes these tokens through the PoA Bridge
|
|
397
|
-
|
|
398
|
-
**Allowlisted Tokens:**
|
|
399
|
-
|
|
400
|
-
Not all PoA tokens can be routed through Omni Bridge. The SDK exports `POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE` constant containing the tokens that support this routing:
|
|
401
|
-
|
|
402
|
-
```typescript
|
|
403
|
-
import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from '@defuse-protocol/intents-sdk';
|
|
404
|
-
|
|
405
|
-
console.log(POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE);
|
|
406
|
-
// { 'sol-...omft.near': ChainKind.Sol, ... }
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
The keys are token contract IDs and values are their `ChainKind`. Only tokens in this map will be routed through Omni Bridge when the feature flag is enabled. Other `*.omft.near` tokens will continue using the PoA Bridge.
|
|
410
|
-
|
|
411
369
|
### Other Intent Signers
|
|
412
370
|
|
|
413
371
|
The SDK supports multiple intent signing methods using factory functions:
|
package/dist/index.cjs
CHANGED
|
@@ -7,7 +7,7 @@ const require_bridge_name_enum = require('./src/constants/bridge-name-enum.cjs')
|
|
|
7
7
|
const require_error = require('./src/bridges/direct-bridge/error.cjs');
|
|
8
8
|
const require_error$1 = require('./src/bridges/hot-bridge/error.cjs');
|
|
9
9
|
const require_error$2 = require('./src/bridges/omni-bridge/error.cjs');
|
|
10
|
-
const
|
|
10
|
+
const require_poa_tokens_migrated_to_omni_bridge = require('./src/constants/poa-tokens-migrated-to-omni-bridge.cjs');
|
|
11
11
|
const require_errors$1 = require('./src/bridges/poa-bridge/errors.cjs');
|
|
12
12
|
const require_intent_hash = require('./src/intents/intent-hash.cjs');
|
|
13
13
|
const require_expirable_nonce = require('./src/intents/expirable-nonce.cjs');
|
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, 'BaseError', {
|
|
|
32
32
|
});
|
|
33
33
|
exports.BridgeNameEnum = require_bridge_name_enum.BridgeNameEnum;
|
|
34
34
|
exports.Chains = require_caip2.Chains;
|
|
35
|
+
exports.DestinationAddressMatchesTokenAddressError = require_errors.DestinationAddressMatchesTokenAddressError;
|
|
35
36
|
exports.DestinationExplicitNearAccountDoesntExistError = require_error.DestinationExplicitNearAccountDoesntExistError;
|
|
36
37
|
exports.FeeExceedsAmountError = require_errors.FeeExceedsAmountError;
|
|
37
38
|
exports.HotWithdrawalApiFeeRequestTimeoutError = require_error$1.HotWithdrawalApiFeeRequestTimeoutError;
|
|
@@ -55,7 +56,7 @@ exports.IntentsSDK = require_sdk.IntentsSDK;
|
|
|
55
56
|
exports.InvalidFeeValueError = require_error$2.InvalidFeeValueError;
|
|
56
57
|
exports.MinWithdrawalAmountError = require_errors.MinWithdrawalAmountError;
|
|
57
58
|
exports.OmniWithdrawalApiFeeRequestTimeoutError = require_error$2.OmniWithdrawalApiFeeRequestTimeoutError;
|
|
58
|
-
exports.
|
|
59
|
+
exports.POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE = require_poa_tokens_migrated_to_omni_bridge.POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE;
|
|
59
60
|
Object.defineProperty(exports, 'PoaWithdrawalInvariantError', {
|
|
60
61
|
enumerable: true,
|
|
61
62
|
get: function () {
|
package/dist/index.d.cts
CHANGED
|
@@ -12,9 +12,9 @@ import { Nep413RawPayload } from "./src/intents/intent-signer-impl/intent-signer
|
|
|
12
12
|
import { Erc191RawPayload } from "./src/intents/intent-signer-impl/intent-signer-viem.cjs";
|
|
13
13
|
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.cjs";
|
|
14
14
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.cjs";
|
|
15
|
-
import {
|
|
15
|
+
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "./src/constants/poa-tokens-migrated-to-omni-bridge.cjs";
|
|
16
16
|
import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType } from "./src/core/withdrawal-watcher.cjs";
|
|
17
|
-
import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
|
|
17
|
+
import { DestinationAddressMatchesTokenAddressError, DestinationAddressMatchesTokenAddressErrorType, FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
|
|
18
18
|
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.cjs";
|
|
19
19
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.cjs";
|
|
20
20
|
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
|
|
@@ -22,4 +22,4 @@ import { XrplDepositAuthEnabledError, XrplDepositAuthEnabledErrorType, XrplDesti
|
|
|
22
22
|
import { computeIntentHash } from "./src/intents/intent-hash.cjs";
|
|
23
23
|
import { validateAddress } from "./src/lib/validateAddress.cjs";
|
|
24
24
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RelayPublishRejectedError, RelayPublishRejectedErrorType, RelayPublishResultUnknownError, RelayPublishResultUnknownErrorType, RetryOptions, RpcEndpoint, RpcEndpointConfig, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
25
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook,
|
|
25
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationAddressMatchesTokenAddressError, type DestinationAddressMatchesTokenAddressErrorType, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, type QuoteOptions, RelayPublishError, type RelayPublishErrorType, RelayPublishRejectedError, type RelayPublishRejectedErrorType, RelayPublishResultUnknownError, type RelayPublishResultUnknownErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, type RpcEndpoint, type RpcEndpointConfig, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, XrplDepositAuthEnabledError, type XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, type XrplDestinationTagRequiredErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ import { Nep413RawPayload } from "./src/intents/intent-signer-impl/intent-signer
|
|
|
12
12
|
import { Erc191RawPayload } from "./src/intents/intent-signer-impl/intent-signer-viem.js";
|
|
13
13
|
import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
|
|
14
14
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
15
|
-
import {
|
|
15
|
+
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "./src/constants/poa-tokens-migrated-to-omni-bridge.js";
|
|
16
16
|
import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType } from "./src/core/withdrawal-watcher.js";
|
|
17
|
-
import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
|
|
17
|
+
import { DestinationAddressMatchesTokenAddressError, DestinationAddressMatchesTokenAddressErrorType, FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
|
|
18
18
|
import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.js";
|
|
19
19
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.js";
|
|
20
20
|
import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
|
|
@@ -22,4 +22,4 @@ import { XrplDepositAuthEnabledError, XrplDepositAuthEnabledErrorType, XrplDesti
|
|
|
22
22
|
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
23
23
|
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
24
24
|
import { AssertionError, AssertionErrorType, BaseError, BaseErrorType, EnvConfig, HttpRequestError, HttpRequestErrorType, ILogger, IntentSettlementError, IntentSettlementErrorType, NearIntentsEnv, PoaWithdrawalInvariantError, PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, PoaWithdrawalPendingErrorType, QuoteError, QuoteErrorType, RelayPublishError, RelayPublishErrorType, RelayPublishRejectedError, RelayPublishRejectedErrorType, RelayPublishResultUnknownError, RelayPublishResultUnknownErrorType, RetryOptions, RpcEndpoint, RpcEndpointConfig, RpcRequestError, RpcRequestErrorType, TimeoutError, TimeoutErrorType } from "@defuse-protocol/internal-utils";
|
|
25
|
-
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook,
|
|
25
|
+
export { AssertionError, type AssertionErrorType, BaseError, type BaseErrorType, type BatchWithdrawalResult, BridgeNameEnum, type BridgeNameEnumValues, type Chain, Chains, DestinationAddressMatchesTokenAddressError, type DestinationAddressMatchesTokenAddressErrorType, DestinationExplicitNearAccountDoesntExistError, type DestinationExplicitNearAccountDoesntExistErrorType, type EnvConfig, type Erc191RawPayload, type FeeEstimation, FeeExceedsAmountError, type FeeExceedsAmountErrorType, type HotBridgeRouteConfig, HotWithdrawalApiFeeRequestTimeoutError, type HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, type HotWithdrawalNotFoundErrorType, HttpRequestError, type HttpRequestErrorType, type IIntentSigner, type ILogger, InsufficientUtxoForOmniBridgeWithdrawalError, type InsufficientUtxoForOmniBridgeWithdrawalErrorType, type IntentPayload, IntentPayloadBuilder, type IntentPayloadFactory, type IntentPrimitive, type IntentPublishResult, type IntentRelayParamsFactory, IntentSettlementError, type IntentSettlementErrorType, type IntentSettlementStatus, IntentsNearOmniAvailableBalanceTooLowError, type IntentsNearOmniAvailableBalanceTooLowErrorType, IntentsSDK, type IntentsSDKConfig, type InternalTransferRouteConfig, InvalidFeeValueError, type InvalidFeeValueErrorType, MinWithdrawalAmountError, type MinWithdrawalAmountErrorType, type MultiPayload, type NearIntentsEnv, type NearTxInfo, type NearWithdrawalRouteConfig, type Nep413RawPayload, type OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, type ParsedAssetInfo, type PoaBridgeRouteConfig, PoaWithdrawalInvariantError, type PoaWithdrawalInvariantErrorType, PoaWithdrawalNotFoundError, type PoaWithdrawalNotFoundErrorType, PoaWithdrawalPendingError, type PoaWithdrawalPendingErrorType, type ProcessWithdrawalArgs, QuoteError, type QuoteErrorType, type QuoteOptions, RelayPublishError, type RelayPublishErrorType, RelayPublishRejectedError, type RelayPublishRejectedErrorType, RelayPublishResultUnknownError, type RelayPublishResultUnknownErrorType, type RetryOptions, type RouteConfig, RouteEnum, type RouteEnumValues, type RpcEndpoint, type RpcEndpointConfig, RpcRequestError, type RpcRequestErrorType, type SignAndSendArgs, type SignAndSendWithdrawalArgs, type SignedIntentsComposition, TimeoutError, type TimeoutErrorType, TokenNotFoundInDestinationChainError, type TokenNotFoundInDestinationChainErrorType, TrustlineNotFoundError, type TrustlineNotFoundErrorType, type TxInfo, type TxNoInfo, UnsupportedAssetIdError, type UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, type UnsupportedDestinationMemoErrorType, VersionedNonceBuilder, type VirtualChainRouteConfig, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, XrplDepositAuthEnabledError, type XrplDepositAuthEnabledErrorType, XrplDestinationTagRequiredError, type XrplDestinationTagRequiredErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeeExceedsAmountError, MinWithdrawalAmountError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "./src/classes/errors.js";
|
|
1
|
+
import { DestinationAddressMatchesTokenAddressError, FeeExceedsAmountError, MinWithdrawalAmountError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "./src/classes/errors.js";
|
|
2
2
|
import { RouteEnum } from "./src/constants/route-enum.js";
|
|
3
3
|
import { Chains } from "./src/lib/caip2.js";
|
|
4
4
|
import { validateAddress } from "./src/lib/validateAddress.js";
|
|
@@ -6,7 +6,7 @@ import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
|
|
|
6
6
|
import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
|
|
7
7
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError } from "./src/bridges/hot-bridge/error.js";
|
|
8
8
|
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
|
|
9
|
-
import {
|
|
9
|
+
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "./src/constants/poa-tokens-migrated-to-omni-bridge.js";
|
|
10
10
|
import { XrplDepositAuthEnabledError, XrplDestinationTagRequiredError } from "./src/bridges/poa-bridge/errors.js";
|
|
11
11
|
import { computeIntentHash } from "./src/intents/intent-hash.js";
|
|
12
12
|
import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.js";
|
|
@@ -17,4 +17,4 @@ import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSi
|
|
|
17
17
|
import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
|
|
18
18
|
import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RelayPublishRejectedError, RelayPublishResultUnknownError, RpcRequestError, TimeoutError } from "@defuse-protocol/internal-utils";
|
|
19
19
|
|
|
20
|
-
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniWithdrawalApiFeeRequestTimeoutError,
|
|
20
|
+
export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationAddressMatchesTokenAddressError, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniWithdrawalApiFeeRequestTimeoutError, POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RelayPublishRejectedError, RelayPublishResultUnknownError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, WithdrawalFailedError, WithdrawalWatchError, XrplDepositAuthEnabledError, XrplDestinationTagRequiredError, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
|
|
@@ -8,6 +8,7 @@ const require_validateAddress = require('../../lib/validateAddress.cjs');
|
|
|
8
8
|
const require_bridge_name_enum = require('../../constants/bridge-name-enum.cjs');
|
|
9
9
|
const require_direct_bridge_constants = require('./direct-bridge-constants.cjs');
|
|
10
10
|
const require_direct_bridge_utils = require('./direct-bridge-utils.cjs');
|
|
11
|
+
const require_compareAddresses = require('../../lib/compareAddresses.cjs');
|
|
11
12
|
const require_error = require('./error.cjs');
|
|
12
13
|
let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
|
|
13
14
|
let lru_cache = require("lru-cache");
|
|
@@ -73,6 +74,8 @@ var DirectBridge = class {
|
|
|
73
74
|
*/
|
|
74
75
|
async validateWithdrawal(args) {
|
|
75
76
|
if (require_validateAddress.validateAddress(args.destinationAddress, require_caip2.Chains.Near) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, require_caip2.Chains.Near);
|
|
77
|
+
const { contractId: tokenAccountId } = _defuse_protocol_internal_utils.utils.parseDefuseAssetId(args.assetId);
|
|
78
|
+
if (require_compareAddresses.compareAddresses(tokenAccountId, args.destinationAddress, require_caip2.Chains.Near)) throw new require_errors.DestinationAddressMatchesTokenAddressError(tokenAccountId, args.assetId);
|
|
76
79
|
if (_defuse_protocol_internal_utils.utils.isImplicitAccount(args.destinationAddress) === false && await this.getCachedAccountExistenceCheck(args.destinationAddress) === false) throw new require_error.DestinationExplicitNearAccountDoesntExistError(args.destinationAddress);
|
|
77
80
|
}
|
|
78
81
|
async estimateWithdrawalFee(args) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvalidDestinationAddressForWithdrawalError, UnsupportedAssetIdError } from "../../classes/errors.js";
|
|
1
|
+
import { DestinationAddressMatchesTokenAddressError, InvalidDestinationAddressForWithdrawalError, UnsupportedAssetIdError } from "../../classes/errors.js";
|
|
2
2
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
3
3
|
import { Chains } from "../../lib/caip2.js";
|
|
4
4
|
import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
|
|
@@ -7,6 +7,7 @@ import { validateAddress } from "../../lib/validateAddress.js";
|
|
|
7
7
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
8
8
|
import { NEAR_NATIVE_ASSET_ID } from "./direct-bridge-constants.js";
|
|
9
9
|
import { accountExistsInNEAR, createWithdrawIntentPrimitive, withdrawalParamsInvariant } from "./direct-bridge-utils.js";
|
|
10
|
+
import { compareAddresses } from "../../lib/compareAddresses.js";
|
|
10
11
|
import { DestinationExplicitNearAccountDoesntExistError } from "./error.js";
|
|
11
12
|
import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, utils } from "@defuse-protocol/internal-utils";
|
|
12
13
|
import { LRUCache } from "lru-cache";
|
|
@@ -72,6 +73,8 @@ var DirectBridge = class {
|
|
|
72
73
|
*/
|
|
73
74
|
async validateWithdrawal(args) {
|
|
74
75
|
if (validateAddress(args.destinationAddress, Chains.Near) === false) throw new InvalidDestinationAddressForWithdrawalError(args.destinationAddress, Chains.Near);
|
|
76
|
+
const { contractId: tokenAccountId } = utils.parseDefuseAssetId(args.assetId);
|
|
77
|
+
if (compareAddresses(tokenAccountId, args.destinationAddress, Chains.Near)) throw new DestinationAddressMatchesTokenAddressError(tokenAccountId, args.assetId);
|
|
75
78
|
if (utils.isImplicitAccount(args.destinationAddress) === false && await this.getCachedAccountExistenceCheck(args.destinationAddress) === false) throw new DestinationExplicitNearAccountDoesntExistError(args.destinationAddress);
|
|
76
79
|
}
|
|
77
80
|
async estimateWithdrawalFee(args) {
|
|
@@ -6,6 +6,7 @@ const require_estimate_fee = require('../../lib/estimate-fee.cjs');
|
|
|
6
6
|
const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.cjs');
|
|
7
7
|
const require_validateAddress = require('../../lib/validateAddress.cjs');
|
|
8
8
|
const require_bridge_name_enum = require('../../constants/bridge-name-enum.cjs');
|
|
9
|
+
const require_compareAddresses = require('../../lib/compareAddresses.cjs');
|
|
9
10
|
const require_error = require('./error.cjs');
|
|
10
11
|
const require_hot_bridge_constants = require('./hot-bridge-constants.cjs');
|
|
11
12
|
const require_hot_bridge_utils = require('./hot-bridge-utils.cjs');
|
|
@@ -122,8 +123,10 @@ var HotBridge = class HotBridge {
|
|
|
122
123
|
(0, _defuse_protocol_internal_utils.assert)(assetInfo != null, "Asset is not supported");
|
|
123
124
|
require_hot_bridge_utils.hotBlockchainInvariant(assetInfo.blockchain);
|
|
124
125
|
if (require_validateAddress.validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
126
|
+
const nativeAsset = "native" in assetInfo;
|
|
127
|
+
const token = nativeAsset ? "native" : assetInfo.address;
|
|
128
|
+
if (!nativeAsset && require_compareAddresses.compareAddresses(token, args.destinationAddress, assetInfo.blockchain)) throw new require_errors.DestinationAddressMatchesTokenAddressError(token, args.assetId);
|
|
125
129
|
if (assetInfo.blockchain === require_caip2.Chains.Stellar) {
|
|
126
|
-
const token = "native" in assetInfo ? "native" : assetInfo.address;
|
|
127
130
|
if (!await this.hotSdk.stellar.isTrustlineExists(args.destinationAddress, token)) throw new require_errors.TrustlineNotFoundError(args.destinationAddress, args.assetId, assetInfo.blockchain, token);
|
|
128
131
|
}
|
|
129
132
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { InvalidDestinationAddressForWithdrawalError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "../../classes/errors.js";
|
|
1
|
+
import { DestinationAddressMatchesTokenAddressError, InvalidDestinationAddressForWithdrawalError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "../../classes/errors.js";
|
|
2
2
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
3
3
|
import { Chains } from "../../lib/caip2.js";
|
|
4
4
|
import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
|
|
5
5
|
import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
|
|
6
6
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
7
7
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
8
|
+
import { compareAddresses } from "../../lib/compareAddresses.js";
|
|
8
9
|
import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError } from "./error.js";
|
|
9
10
|
import { HotWithdrawStatus, MIN_GAS_AMOUNT } from "./hot-bridge-constants.js";
|
|
10
11
|
import { formatTxHash, getFeeAssetIdForChain, hotBlockchainInvariant, hotNetworkIdToCAIP2, toHotNetworkId } from "./hot-bridge-utils.js";
|
|
@@ -120,8 +121,10 @@ var HotBridge$1 = class HotBridge$1 {
|
|
|
120
121
|
assert(assetInfo != null, "Asset is not supported");
|
|
121
122
|
hotBlockchainInvariant(assetInfo.blockchain);
|
|
122
123
|
if (validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
124
|
+
const nativeAsset = "native" in assetInfo;
|
|
125
|
+
const token = nativeAsset ? "native" : assetInfo.address;
|
|
126
|
+
if (!nativeAsset && compareAddresses(token, args.destinationAddress, assetInfo.blockchain)) throw new DestinationAddressMatchesTokenAddressError(token, args.assetId);
|
|
123
127
|
if (assetInfo.blockchain === Chains.Stellar) {
|
|
124
|
-
const token = "native" in assetInfo ? "native" : assetInfo.address;
|
|
125
128
|
if (!await this.hotSdk.stellar.isTrustlineExists(args.destinationAddress, token)) throw new TrustlineNotFoundError(args.destinationAddress, args.assetId, assetInfo.blockchain, token);
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
4
4
|
const OMNI_BRIDGE_CONTRACT = "omni.bridge.near";
|
|
5
5
|
const MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR = 500000000000000000000000n;
|
|
6
|
+
const SOL_OMNI_CONTRACT_ID = "sol.omft.near";
|
|
7
|
+
const MIN_AMOUNT_SOL_OMNI_WITHDRAWAL = 890880n;
|
|
6
8
|
const MIN_GAS_AMOUNT = "37400000000000";
|
|
7
9
|
const INTENTS_STORAGE_BALANCE_CACHE_KEY = "INTENTS_STORAGE_BALANCE";
|
|
8
10
|
const FEE_SUBSIDIZED_TOKENS = ["nep141:lsd-usdt.rhealab.near"];
|
|
@@ -10,7 +12,9 @@ const FEE_SUBSIDIZED_TOKENS = ["nep141:lsd-usdt.rhealab.near"];
|
|
|
10
12
|
//#endregion
|
|
11
13
|
exports.FEE_SUBSIDIZED_TOKENS = FEE_SUBSIDIZED_TOKENS;
|
|
12
14
|
exports.INTENTS_STORAGE_BALANCE_CACHE_KEY = INTENTS_STORAGE_BALANCE_CACHE_KEY;
|
|
15
|
+
exports.MIN_AMOUNT_SOL_OMNI_WITHDRAWAL = MIN_AMOUNT_SOL_OMNI_WITHDRAWAL;
|
|
13
16
|
exports.MIN_GAS_AMOUNT = MIN_GAS_AMOUNT;
|
|
14
17
|
exports.MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR = MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR;
|
|
15
18
|
exports.NEAR_NATIVE_ASSET_ID = NEAR_NATIVE_ASSET_ID;
|
|
16
|
-
exports.OMNI_BRIDGE_CONTRACT = OMNI_BRIDGE_CONTRACT;
|
|
19
|
+
exports.OMNI_BRIDGE_CONTRACT = OMNI_BRIDGE_CONTRACT;
|
|
20
|
+
exports.SOL_OMNI_CONTRACT_ID = SOL_OMNI_CONTRACT_ID;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
const NEAR_NATIVE_ASSET_ID = "nep141:wrap.near";
|
|
3
3
|
const OMNI_BRIDGE_CONTRACT = "omni.bridge.near";
|
|
4
4
|
const MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR = 500000000000000000000000n;
|
|
5
|
+
const SOL_OMNI_CONTRACT_ID = "sol.omft.near";
|
|
6
|
+
const MIN_AMOUNT_SOL_OMNI_WITHDRAWAL = 890880n;
|
|
5
7
|
const MIN_GAS_AMOUNT = "37400000000000";
|
|
6
8
|
const INTENTS_STORAGE_BALANCE_CACHE_KEY = "INTENTS_STORAGE_BALANCE";
|
|
7
9
|
const FEE_SUBSIDIZED_TOKENS = ["nep141:lsd-usdt.rhealab.near"];
|
|
8
10
|
|
|
9
11
|
//#endregion
|
|
10
|
-
export { FEE_SUBSIDIZED_TOKENS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_GAS_AMOUNT, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT };
|
|
12
|
+
export { FEE_SUBSIDIZED_TOKENS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, MIN_GAS_AMOUNT, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT, SOL_OMNI_CONTRACT_ID };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
2
|
const require_caip2 = require('../../lib/caip2.cjs');
|
|
3
3
|
const require_omni_bridge_constants = require('./omni-bridge-constants.cjs');
|
|
4
|
-
const
|
|
4
|
+
const require_poa_tokens_migrated_to_omni_bridge = require('../../constants/poa-tokens-migrated-to-omni-bridge.cjs');
|
|
5
5
|
let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
|
|
6
6
|
let valibot = require("valibot");
|
|
7
7
|
valibot = require_rolldown_runtime.__toESM(valibot);
|
|
@@ -82,7 +82,7 @@ function isUtxoChain(network) {
|
|
|
82
82
|
return UTXO_CHAINS.includes(network);
|
|
83
83
|
}
|
|
84
84
|
function poaContractIdToChainKind(contractId) {
|
|
85
|
-
return
|
|
85
|
+
return require_poa_tokens_migrated_to_omni_bridge.POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE[contractId] ?? null;
|
|
86
86
|
}
|
|
87
87
|
function validateOmniToken(nearAddress) {
|
|
88
88
|
if (nearAddress.endsWith(".testnet")) return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Chains } from "../../lib/caip2.js";
|
|
2
2
|
import { MIN_GAS_AMOUNT, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
|
|
3
|
-
import {
|
|
3
|
+
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "../../constants/poa-tokens-migrated-to-omni-bridge.js";
|
|
4
4
|
import { assert, utils } from "@defuse-protocol/internal-utils";
|
|
5
5
|
import * as v from "valibot";
|
|
6
6
|
import { ChainKind, getChain, isBridgeToken, omniAddress } from "@omni-bridge/core";
|
|
@@ -80,7 +80,7 @@ function isUtxoChain(network) {
|
|
|
80
80
|
return UTXO_CHAINS.includes(network);
|
|
81
81
|
}
|
|
82
82
|
function poaContractIdToChainKind(contractId) {
|
|
83
|
-
return
|
|
83
|
+
return POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE[contractId] ?? null;
|
|
84
84
|
}
|
|
85
85
|
function validateOmniToken(nearAddress) {
|
|
86
86
|
if (nearAddress.endsWith(".testnet")) return false;
|
|
@@ -6,9 +6,10 @@ const require_estimate_fee = require('../../lib/estimate-fee.cjs');
|
|
|
6
6
|
const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.cjs');
|
|
7
7
|
const require_validateAddress = require('../../lib/validateAddress.cjs');
|
|
8
8
|
const require_bridge_name_enum = require('../../constants/bridge-name-enum.cjs');
|
|
9
|
+
const require_compareAddresses = require('../../lib/compareAddresses.cjs');
|
|
9
10
|
const require_error = require('./error.cjs');
|
|
10
11
|
const require_omni_bridge_constants = require('./omni-bridge-constants.cjs');
|
|
11
|
-
const
|
|
12
|
+
const require_poa_tokens_migrated_to_omni_bridge = require('../../constants/poa-tokens-migrated-to-omni-bridge.cjs');
|
|
12
13
|
const require_omni_bridge_utils = require('./omni-bridge-utils.cjs');
|
|
13
14
|
let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
|
|
14
15
|
let lru_cache = require("lru-cache");
|
|
@@ -18,7 +19,7 @@ let _omni_bridge_core = require("@omni-bridge/core");
|
|
|
18
19
|
|
|
19
20
|
//#region src/bridges/omni-bridge/omni-bridge.ts
|
|
20
21
|
var OmniBridge = class {
|
|
21
|
-
constructor({ envConfig, nearProvider, solverRelayApiKey,
|
|
22
|
+
constructor({ envConfig, nearProvider, solverRelayApiKey, bridgeConfig }) {
|
|
22
23
|
this.route = require_route_enum.RouteEnum.OmniBridge;
|
|
23
24
|
this.intentsStorageBalanceCache = new _isaacs_ttlcache.default({
|
|
24
25
|
max: 1,
|
|
@@ -34,7 +35,6 @@ var OmniBridge = class {
|
|
|
34
35
|
this.nearProvider = nearProvider;
|
|
35
36
|
this.omniBridgeAPI = new _omni_bridge_core.BridgeAPI("mainnet");
|
|
36
37
|
this.solverRelayApiKey = solverRelayApiKey;
|
|
37
|
-
this.routeMigratedPoaTokensThroughOmniBridge = routeMigratedPoaTokensThroughOmniBridge ?? false;
|
|
38
38
|
this.bridgeConfig = { prefundedNativeFeeTokens: bridgeConfig?.prefundedNativeFeeTokens ?? [] };
|
|
39
39
|
}
|
|
40
40
|
is(routeConfig) {
|
|
@@ -48,7 +48,7 @@ var OmniBridge = class {
|
|
|
48
48
|
const nonValidStandard = parsed.standard !== "nep141";
|
|
49
49
|
if (nonValidStandard && (omniBridgeSetWithNoChain || targetChainSpecified)) throw new require_errors.UnsupportedAssetIdError(params.assetId, `Only NEP-141 tokens are supported by Omni Bridge.`);
|
|
50
50
|
if (nonValidStandard) return false;
|
|
51
|
-
const poaTokenRoutedThroughOmniBridge = this.
|
|
51
|
+
const poaTokenRoutedThroughOmniBridge = this.isPoaTokenMigratedToOmniBridge(parsed.contractId);
|
|
52
52
|
const nonValidToken = !poaTokenRoutedThroughOmniBridge && require_omni_bridge_utils.validateOmniToken(parsed.contractId) === false;
|
|
53
53
|
if (nonValidToken && omniBridgeSetWithNoChain) throw new require_errors.UnsupportedAssetIdError(params.assetId, `Non valid omni contract id ${parsed.contractId}`);
|
|
54
54
|
if (!targetChainSpecified && nonValidToken) return false;
|
|
@@ -73,7 +73,7 @@ var OmniBridge = class {
|
|
|
73
73
|
parseAssetId(assetId) {
|
|
74
74
|
const parsed = require_parse_defuse_asset_id.parseDefuseAssetId(assetId);
|
|
75
75
|
if (parsed.standard !== "nep141") return null;
|
|
76
|
-
const omniChainKind = this.
|
|
76
|
+
const omniChainKind = this.isPoaTokenMigratedToOmniBridge(parsed.contractId) ? require_omni_bridge_utils.poaContractIdToChainKind(parsed.contractId) : (0, _omni_bridge_core.parseOriginChain)(parsed.contractId);
|
|
77
77
|
if (omniChainKind === null) return null;
|
|
78
78
|
const blockchain = require_omni_bridge_utils.chainKindToCaip2(omniChainKind);
|
|
79
79
|
if (blockchain === null) return null;
|
|
@@ -92,7 +92,7 @@ var OmniBridge = class {
|
|
|
92
92
|
omniChainKind = require_omni_bridge_utils.caip2ToChainKind(routeConfig.chain);
|
|
93
93
|
blockchain = routeConfig.chain;
|
|
94
94
|
} else {
|
|
95
|
-
omniChainKind = this.
|
|
95
|
+
omniChainKind = this.isPoaTokenMigratedToOmniBridge(parsed.contractId) ? require_omni_bridge_utils.poaContractIdToChainKind(parsed.contractId) : (0, _omni_bridge_core.parseOriginChain)(parsed.contractId);
|
|
96
96
|
if (omniChainKind === null) return null;
|
|
97
97
|
blockchain = require_omni_bridge_utils.chainKindToCaip2(omniChainKind);
|
|
98
98
|
}
|
|
@@ -164,10 +164,12 @@ var OmniBridge = class {
|
|
|
164
164
|
if (require_validateAddress.validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new require_errors.InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
165
165
|
const omniChainKind = require_omni_bridge_utils.caip2ToChainKind(assetInfo.blockchain);
|
|
166
166
|
(0, _defuse_protocol_internal_utils.assert)(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
const
|
|
170
|
-
(
|
|
167
|
+
const destTokenOmniAddress = await this.getCachedDestinationTokenAddress(assetInfo.contractId, omniChainKind);
|
|
168
|
+
if (destTokenOmniAddress === null) throw new require_error.TokenNotFoundInDestinationChainError(args.assetId, assetInfo.blockchain);
|
|
169
|
+
const destTokenAddress = (0, _omni_bridge_core.getAddress)(destTokenOmniAddress);
|
|
170
|
+
if (require_compareAddresses.compareAddresses(destTokenAddress, args.destinationAddress, assetInfo.blockchain)) throw new require_errors.DestinationAddressMatchesTokenAddressError(destTokenAddress, args.assetId);
|
|
171
|
+
const decimals = await this.getCachedTokenDecimals(destTokenOmniAddress);
|
|
172
|
+
(0, _defuse_protocol_internal_utils.assert)(decimals !== null, `Failed to retrieve token decimals for address ${destTokenOmniAddress} via OmniBridge contract.
|
|
171
173
|
Ensure the token is supported and the address is correct.`);
|
|
172
174
|
if (!args.skipMinAmountValidation) {
|
|
173
175
|
if ((0, _omni_bridge_core.verifyTransferAmount)(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new require_errors.MinWithdrawalAmountError((0, _omni_bridge_core.getMinimumTransferableAmount)(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
|
|
@@ -195,7 +197,7 @@ var OmniBridge = class {
|
|
|
195
197
|
const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
196
198
|
if (actualAmountWithFee < minAmount) throw new require_errors.MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
|
|
197
199
|
}
|
|
198
|
-
}
|
|
200
|
+
} else if (!args.skipMinAmountValidation && omniChainKind === _omni_bridge_core.ChainKind.Sol && assetInfo.contractId === require_omni_bridge_constants.SOL_OMNI_CONTRACT_ID && args.amount < require_omni_bridge_constants.MIN_AMOUNT_SOL_OMNI_WITHDRAWAL) throw new require_errors.MinWithdrawalAmountError(require_omni_bridge_constants.MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, args.amount, args.assetId);
|
|
199
201
|
}
|
|
200
202
|
async estimateWithdrawalFee(args) {
|
|
201
203
|
const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
|
|
@@ -328,11 +330,10 @@ var OmniBridge = class {
|
|
|
328
330
|
return intentsStorageBalance;
|
|
329
331
|
}
|
|
330
332
|
/**
|
|
331
|
-
* Checks if passed token contract id is
|
|
332
|
-
* Always return false when feature flag routeMigratedPoaTokensThroughOmniBridge = false.
|
|
333
|
+
* Checks if passed token contract id is a Omni migrated PoA token.
|
|
333
334
|
*/
|
|
334
|
-
|
|
335
|
-
return
|
|
335
|
+
isPoaTokenMigratedToOmniBridge(nearAddress) {
|
|
336
|
+
return require_poa_tokens_migrated_to_omni_bridge.POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE[nearAddress] !== void 0;
|
|
336
337
|
}
|
|
337
338
|
};
|
|
338
339
|
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError, UnsupportedAssetIdError } from "../../classes/errors.js";
|
|
1
|
+
import { DestinationAddressMatchesTokenAddressError, InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError, UnsupportedAssetIdError } from "../../classes/errors.js";
|
|
2
2
|
import { RouteEnum } from "../../constants/route-enum.js";
|
|
3
3
|
import { Chains } from "../../lib/caip2.js";
|
|
4
4
|
import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
|
|
5
5
|
import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
|
|
6
6
|
import { validateAddress } from "../../lib/validateAddress.js";
|
|
7
7
|
import { BridgeNameEnum } from "../../constants/bridge-name-enum.js";
|
|
8
|
+
import { compareAddresses } from "../../lib/compareAddresses.js";
|
|
8
9
|
import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./error.js";
|
|
9
|
-
import { FEE_SUBSIDIZED_TOKENS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT } from "./omni-bridge-constants.js";
|
|
10
|
-
import {
|
|
10
|
+
import { FEE_SUBSIDIZED_TOKENS, INTENTS_STORAGE_BALANCE_CACHE_KEY, MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, MIN_STORAGE_BALANCE_FOR_INTENTS_NEAR, NEAR_NATIVE_ASSET_ID, OMNI_BRIDGE_CONTRACT, SOL_OMNI_CONTRACT_ID } from "./omni-bridge-constants.js";
|
|
11
|
+
import { POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE } from "../../constants/poa-tokens-migrated-to-omni-bridge.js";
|
|
11
12
|
import { caip2ToChainKind, chainKindToCaip2, createWithdrawIntentsPrimitive, getAccountOmniStorageBalance, getBridgedToken, getTokenDecimals, isUtxoChain, poaContractIdToChainKind, validateOmniToken } from "./omni-bridge-utils.js";
|
|
12
13
|
import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, withTimeout } from "@defuse-protocol/internal-utils";
|
|
13
14
|
import { LRUCache } from "lru-cache";
|
|
14
15
|
import TTLCache from "@isaacs/ttlcache";
|
|
15
|
-
import { BridgeAPI, ChainKind, getChain, getMinimumTransferableAmount, isEvmChain, omniAddress, parseOriginChain, verifyTransferAmount } from "@omni-bridge/core";
|
|
16
|
+
import { BridgeAPI, ChainKind, getAddress, getChain, getMinimumTransferableAmount, isEvmChain, omniAddress, parseOriginChain, verifyTransferAmount } from "@omni-bridge/core";
|
|
16
17
|
|
|
17
18
|
//#region src/bridges/omni-bridge/omni-bridge.ts
|
|
18
19
|
var OmniBridge = class {
|
|
19
|
-
constructor({ envConfig, nearProvider, solverRelayApiKey,
|
|
20
|
+
constructor({ envConfig, nearProvider, solverRelayApiKey, bridgeConfig }) {
|
|
20
21
|
this.route = RouteEnum.OmniBridge;
|
|
21
22
|
this.intentsStorageBalanceCache = new TTLCache({
|
|
22
23
|
max: 1,
|
|
@@ -32,7 +33,6 @@ var OmniBridge = class {
|
|
|
32
33
|
this.nearProvider = nearProvider;
|
|
33
34
|
this.omniBridgeAPI = new BridgeAPI("mainnet");
|
|
34
35
|
this.solverRelayApiKey = solverRelayApiKey;
|
|
35
|
-
this.routeMigratedPoaTokensThroughOmniBridge = routeMigratedPoaTokensThroughOmniBridge ?? false;
|
|
36
36
|
this.bridgeConfig = { prefundedNativeFeeTokens: bridgeConfig?.prefundedNativeFeeTokens ?? [] };
|
|
37
37
|
}
|
|
38
38
|
is(routeConfig) {
|
|
@@ -46,7 +46,7 @@ var OmniBridge = class {
|
|
|
46
46
|
const nonValidStandard = parsed.standard !== "nep141";
|
|
47
47
|
if (nonValidStandard && (omniBridgeSetWithNoChain || targetChainSpecified)) throw new UnsupportedAssetIdError(params.assetId, `Only NEP-141 tokens are supported by Omni Bridge.`);
|
|
48
48
|
if (nonValidStandard) return false;
|
|
49
|
-
const poaTokenRoutedThroughOmniBridge = this.
|
|
49
|
+
const poaTokenRoutedThroughOmniBridge = this.isPoaTokenMigratedToOmniBridge(parsed.contractId);
|
|
50
50
|
const nonValidToken = !poaTokenRoutedThroughOmniBridge && validateOmniToken(parsed.contractId) === false;
|
|
51
51
|
if (nonValidToken && omniBridgeSetWithNoChain) throw new UnsupportedAssetIdError(params.assetId, `Non valid omni contract id ${parsed.contractId}`);
|
|
52
52
|
if (!targetChainSpecified && nonValidToken) return false;
|
|
@@ -71,7 +71,7 @@ var OmniBridge = class {
|
|
|
71
71
|
parseAssetId(assetId) {
|
|
72
72
|
const parsed = parseDefuseAssetId(assetId);
|
|
73
73
|
if (parsed.standard !== "nep141") return null;
|
|
74
|
-
const omniChainKind = this.
|
|
74
|
+
const omniChainKind = this.isPoaTokenMigratedToOmniBridge(parsed.contractId) ? poaContractIdToChainKind(parsed.contractId) : parseOriginChain(parsed.contractId);
|
|
75
75
|
if (omniChainKind === null) return null;
|
|
76
76
|
const blockchain = chainKindToCaip2(omniChainKind);
|
|
77
77
|
if (blockchain === null) return null;
|
|
@@ -90,7 +90,7 @@ var OmniBridge = class {
|
|
|
90
90
|
omniChainKind = caip2ToChainKind(routeConfig.chain);
|
|
91
91
|
blockchain = routeConfig.chain;
|
|
92
92
|
} else {
|
|
93
|
-
omniChainKind = this.
|
|
93
|
+
omniChainKind = this.isPoaTokenMigratedToOmniBridge(parsed.contractId) ? poaContractIdToChainKind(parsed.contractId) : parseOriginChain(parsed.contractId);
|
|
94
94
|
if (omniChainKind === null) return null;
|
|
95
95
|
blockchain = chainKindToCaip2(omniChainKind);
|
|
96
96
|
}
|
|
@@ -162,10 +162,12 @@ var OmniBridge = class {
|
|
|
162
162
|
if (validateAddress(args.destinationAddress, assetInfo.blockchain) === false) throw new InvalidDestinationAddressForWithdrawalError(args.destinationAddress, assetInfo.blockchain);
|
|
163
163
|
const omniChainKind = caip2ToChainKind(assetInfo.blockchain);
|
|
164
164
|
assert(omniChainKind !== null, `Chain ${assetInfo.blockchain} is not supported by Omni Bridge`);
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
const
|
|
168
|
-
|
|
165
|
+
const destTokenOmniAddress = await this.getCachedDestinationTokenAddress(assetInfo.contractId, omniChainKind);
|
|
166
|
+
if (destTokenOmniAddress === null) throw new TokenNotFoundInDestinationChainError(args.assetId, assetInfo.blockchain);
|
|
167
|
+
const destTokenAddress = getAddress(destTokenOmniAddress);
|
|
168
|
+
if (compareAddresses(destTokenAddress, args.destinationAddress, assetInfo.blockchain)) throw new DestinationAddressMatchesTokenAddressError(destTokenAddress, args.assetId);
|
|
169
|
+
const decimals = await this.getCachedTokenDecimals(destTokenOmniAddress);
|
|
170
|
+
assert(decimals !== null, `Failed to retrieve token decimals for address ${destTokenOmniAddress} via OmniBridge contract.
|
|
169
171
|
Ensure the token is supported and the address is correct.`);
|
|
170
172
|
if (!args.skipMinAmountValidation) {
|
|
171
173
|
if (verifyTransferAmount(args.amount, 0n, decimals.origin_decimals, decimals.decimals) === false) throw new MinWithdrawalAmountError(getMinimumTransferableAmount(decimals.origin_decimals, decimals.decimals), args.amount, args.assetId);
|
|
@@ -193,7 +195,7 @@ var OmniBridge = class {
|
|
|
193
195
|
const actualAmountWithFee = args.amount + utxoMaxGasFee + utxoProtocolFee;
|
|
194
196
|
if (actualAmountWithFee < minAmount) throw new MinWithdrawalAmountError(minAmount, actualAmountWithFee, args.assetId);
|
|
195
197
|
}
|
|
196
|
-
}
|
|
198
|
+
} else if (!args.skipMinAmountValidation && omniChainKind === ChainKind.Sol && assetInfo.contractId === SOL_OMNI_CONTRACT_ID && args.amount < MIN_AMOUNT_SOL_OMNI_WITHDRAWAL) throw new MinWithdrawalAmountError(MIN_AMOUNT_SOL_OMNI_WITHDRAWAL, args.amount, args.assetId);
|
|
197
199
|
}
|
|
198
200
|
async estimateWithdrawalFee(args) {
|
|
199
201
|
const assetInfo = this.makeAssetInfo(args.withdrawalParams.assetId, args.withdrawalParams.routeConfig);
|
|
@@ -326,11 +328,10 @@ var OmniBridge = class {
|
|
|
326
328
|
return intentsStorageBalance;
|
|
327
329
|
}
|
|
328
330
|
/**
|
|
329
|
-
* Checks if passed token contract id is
|
|
330
|
-
* Always return false when feature flag routeMigratedPoaTokensThroughOmniBridge = false.
|
|
331
|
+
* Checks if passed token contract id is a Omni migrated PoA token.
|
|
331
332
|
*/
|
|
332
|
-
|
|
333
|
-
return
|
|
333
|
+
isPoaTokenMigratedToOmniBridge(nearAddress) {
|
|
334
|
+
return POA_TOKENS_MIGRATED_TO_OMNI_BRIDGE[nearAddress] !== void 0;
|
|
334
335
|
}
|
|
335
336
|
};
|
|
336
337
|
|
|
@@ -29,7 +29,6 @@ const caip2Mapping = {
|
|
|
29
29
|
[require_caip2.Chains.Arbitrum]: "eth:42161",
|
|
30
30
|
[require_caip2.Chains.Bitcoin]: "btc:mainnet",
|
|
31
31
|
[require_caip2.Chains.BitcoinCash]: "bch:mainnet",
|
|
32
|
-
[require_caip2.Chains.Solana]: "sol:mainnet",
|
|
33
32
|
[require_caip2.Chains.Dogecoin]: "doge:mainnet",
|
|
34
33
|
[require_caip2.Chains.XRPL]: "xrp:mainnet",
|
|
35
34
|
[require_caip2.Chains.Zcash]: "zec:mainnet",
|
|
@@ -37,11 +36,9 @@ const caip2Mapping = {
|
|
|
37
36
|
[require_caip2.Chains.Berachain]: "eth:80094",
|
|
38
37
|
[require_caip2.Chains.Tron]: "tron:mainnet",
|
|
39
38
|
[require_caip2.Chains.Sui]: "sui:mainnet",
|
|
40
|
-
[require_caip2.Chains.Aptos]: "aptos:mainnet",
|
|
41
39
|
[require_caip2.Chains.Movement]: "movement:mainnet",
|
|
42
40
|
[require_caip2.Chains.Cardano]: "cardano:mainnet",
|
|
43
41
|
[require_caip2.Chains.Litecoin]: "ltc:mainnet",
|
|
44
|
-
[require_caip2.Chains.Starknet]: "starknet:mainnet",
|
|
45
42
|
[require_caip2.Chains.Aleo]: "aleo:mainnet",
|
|
46
43
|
[require_caip2.Chains.Dash]: "dash:mainnet",
|
|
47
44
|
[require_caip2.Chains.Plasma]: "eth:9745"
|
|
@@ -56,7 +53,6 @@ const tokenPrefixMapping = {
|
|
|
56
53
|
arb: require_caip2.Chains.Arbitrum,
|
|
57
54
|
btc: require_caip2.Chains.Bitcoin,
|
|
58
55
|
bch: require_caip2.Chains.BitcoinCash,
|
|
59
|
-
sol: require_caip2.Chains.Solana,
|
|
60
56
|
doge: require_caip2.Chains.Dogecoin,
|
|
61
57
|
xrp: require_caip2.Chains.XRPL,
|
|
62
58
|
zec: require_caip2.Chains.Zcash,
|
|
@@ -64,11 +60,9 @@ const tokenPrefixMapping = {
|
|
|
64
60
|
bera: require_caip2.Chains.Berachain,
|
|
65
61
|
tron: require_caip2.Chains.Tron,
|
|
66
62
|
sui: require_caip2.Chains.Sui,
|
|
67
|
-
aptos: require_caip2.Chains.Aptos,
|
|
68
63
|
movement: require_caip2.Chains.Movement,
|
|
69
64
|
cardano: require_caip2.Chains.Cardano,
|
|
70
65
|
ltc: require_caip2.Chains.Litecoin,
|
|
71
|
-
starknet: require_caip2.Chains.Starknet,
|
|
72
66
|
aleo: require_caip2.Chains.Aleo,
|
|
73
67
|
dash: require_caip2.Chains.Dash,
|
|
74
68
|
plasma: require_caip2.Chains.Plasma
|