@defuse-protocol/intents-sdk 0.43.2 → 0.44.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.
Files changed (83) hide show
  1. package/README.md +143 -21
  2. package/dist/index.cjs +19 -18
  3. package/dist/index.d.cts +5 -3
  4. package/dist/index.d.ts +5 -3
  5. package/dist/index.js +7 -5
  6. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.cjs +5 -5
  7. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +24 -12
  8. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.js +19 -7
  9. package/dist/src/bridges/direct-bridge/direct-bridge-utils.cjs +5 -5
  10. package/dist/src/bridges/direct-bridge/direct-bridge.cjs +22 -10
  11. package/dist/src/bridges/direct-bridge/direct-bridge.js +16 -4
  12. package/dist/src/bridges/direct-bridge/error.cjs +2 -2
  13. package/dist/src/bridges/hot-bridge/error.cjs +4 -26
  14. package/dist/src/bridges/hot-bridge/error.d.cts +1 -17
  15. package/dist/src/bridges/hot-bridge/error.d.ts +1 -17
  16. package/dist/src/bridges/hot-bridge/error.js +1 -21
  17. package/dist/src/bridges/hot-bridge/hot-bridge-utils.cjs +10 -10
  18. package/dist/src/bridges/hot-bridge/hot-bridge.cjs +46 -32
  19. package/dist/src/bridges/hot-bridge/hot-bridge.js +38 -24
  20. package/dist/src/bridges/intents-bridge/intents-bridge.cjs +18 -4
  21. package/dist/src/bridges/intents-bridge/intents-bridge.js +18 -4
  22. package/dist/src/bridges/omni-bridge/error.cjs +6 -27
  23. package/dist/src/bridges/omni-bridge/error.d.cts +1 -16
  24. package/dist/src/bridges/omni-bridge/error.d.ts +1 -16
  25. package/dist/src/bridges/omni-bridge/error.js +1 -20
  26. package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +12 -7
  27. package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +5 -1
  28. package/dist/src/bridges/omni-bridge/omni-bridge.cjs +72 -54
  29. package/dist/src/bridges/omni-bridge/omni-bridge.js +47 -29
  30. package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +2 -2
  31. package/dist/src/bridges/poa-bridge/poa-bridge.cjs +79 -26
  32. package/dist/src/bridges/poa-bridge/poa-bridge.js +66 -13
  33. package/dist/src/classes/errors.cjs +7 -7
  34. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.cjs +17 -0
  35. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.cts +12 -0
  36. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.ts +12 -0
  37. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.js +16 -0
  38. package/dist/src/constants/withdrawal-timing.cjs +57 -0
  39. package/dist/src/constants/withdrawal-timing.js +56 -0
  40. package/dist/src/core/withdrawal-watcher.cjs +83 -0
  41. package/dist/src/core/withdrawal-watcher.d.cts +18 -0
  42. package/dist/src/core/withdrawal-watcher.d.ts +18 -0
  43. package/dist/src/core/withdrawal-watcher.js +79 -0
  44. package/dist/src/intents/expirable-nonce.cjs +3 -3
  45. package/dist/src/intents/intent-executer-impl/intent-executer.cjs +7 -4
  46. package/dist/src/intents/intent-executer-impl/intent-executer.js +5 -2
  47. package/dist/src/intents/intent-hash.cjs +2 -2
  48. package/dist/src/intents/intent-hashes/erc191.cjs +2 -2
  49. package/dist/src/intents/intent-hashes/nep413.cjs +2 -2
  50. package/dist/src/intents/intent-hashes/raw-ed25519.cjs +2 -2
  51. package/dist/src/intents/intent-hashes/sep53.cjs +4 -4
  52. package/dist/src/intents/intent-hashes/tip191.cjs +2 -2
  53. package/dist/src/intents/intent-hashes/ton-connect.cjs +2 -2
  54. package/dist/src/intents/intent-hashes/webauthn.cjs +2 -2
  55. package/dist/src/intents/intent-payload-builder.cjs +4 -4
  56. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.cjs +7 -7
  57. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.js +1 -1
  58. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.cjs +2 -2
  59. package/dist/src/intents/intent-signer-impl/intent-signer-nep413.cjs +3 -3
  60. package/dist/src/intents/intent-signer-impl/intent-signer-viem.cjs +3 -3
  61. package/dist/src/intents/interfaces/intent-relayer.d.cts +2 -1
  62. package/dist/src/intents/interfaces/intent-relayer.d.ts +2 -1
  63. package/dist/src/intents/salt-manager.cjs +5 -5
  64. package/dist/src/lib/array.cjs +2 -2
  65. package/dist/src/lib/caip2.cjs +4 -4
  66. package/dist/src/lib/configure-rpc-config.cjs +3 -3
  67. package/dist/src/lib/estimate-fee.cjs +6 -6
  68. package/dist/src/lib/parse-defuse-asset-id.cjs +2 -2
  69. package/dist/src/lib/route-config-factory.cjs +2 -5
  70. package/dist/src/lib/route-config-factory.d.cts +1 -1
  71. package/dist/src/lib/route-config-factory.d.ts +1 -1
  72. package/dist/src/lib/route-config-factory.js +2 -5
  73. package/dist/src/lib/tokensUsdPricesHttpClient/apis.cjs +3 -3
  74. package/dist/src/lib/validateAddress.cjs +18 -18
  75. package/dist/src/sdk.cjs +96 -47
  76. package/dist/src/sdk.d.cts +72 -11
  77. package/dist/src/sdk.d.ts +72 -11
  78. package/dist/src/sdk.js +85 -36
  79. package/dist/src/shared-types.d.cts +49 -15
  80. package/dist/src/shared-types.d.ts +49 -15
  81. package/package.json +5 -7
  82. package/dist/src/lib/route-config.cjs +0 -19
  83. package/dist/src/lib/route-config.js +0 -19
package/README.md CHANGED
@@ -9,26 +9,28 @@ interacting with various bridge implementations across multiple blockchains.
9
9
  - [Features](#features)
10
10
  - [Quick Start](#quick-start)
11
11
  - [Core Functionalities](#core-functionalities)
12
- - [Core Concepts](#core-concepts)
13
- - [Intent Execution](#intent-execution)
14
- - [Deposits](#deposits)
15
- - [Withdrawals](#withdrawals)
16
- - [Routes and Bridges](#routes-and-bridges)
17
- - [Route Types](#route-types)
18
- - [Fee Estimation](#fee-estimation)
12
+ - [Core Concepts](#core-concepts)
13
+ - [Intent Execution](#intent-execution)
14
+ - [Deposits](#deposits)
15
+ - [Withdrawals](#withdrawals)
16
+ - [Routes and Bridges](#routes-and-bridges)
17
+ - [Route Types](#route-types)
18
+ - [Fee Estimation](#fee-estimation)
19
19
  - [Advanced Usage](#advanced-usage)
20
- - [Custom RPC URLs](#custom-rpc-urls)
21
- - [Other Intent Signers](#other-intent-signers)
22
- - [Intent Payload Builder](#intent-payload-builder)
23
- - [Intent Publishing Hooks](#intent-publishing-hooks)
24
- - [Batch Withdrawals](#batch-withdrawals)
25
- - [Intent Management](#intent-management)
26
- - [Nonce Invalidation](#nonce-invalidation)
27
- - [Configure Withdrawal Routes](#configure-withdrawal-routes)
28
- - [Asset Information Parsing](#asset-information-parsing)
29
- - [Waiting for Completion](#waiting-for-completion)
30
- - [Error Handling](#error-handling)
31
- - [Atomic Multi-Intent Publishing](#atomic-multi-intent-publishing)
20
+ - [Custom RPC URLs](#custom-rpc-urls)
21
+ - [Feature Flags](#feature-flags)
22
+ - [Other Intent Signers](#other-intent-signers)
23
+ - [Intent Payload Builder](#intent-payload-builder)
24
+ - [Intent Publishing Hooks](#intent-publishing-hooks)
25
+ - [Batch Withdrawals](#batch-withdrawals)
26
+ - [Waiting for Batch Completion](#waiting-for-batch-completion)
27
+ - [Intent Management](#intent-management)
28
+ - [Nonce Invalidation](#nonce-invalidation)
29
+ - [Configure Withdrawal Routes](#configure-withdrawal-routes)
30
+ - [Asset Information Parsing](#asset-information-parsing)
31
+ - [Waiting for Completion](#waiting-for-completion)
32
+ - [Error Handling](#error-handling)
33
+ - [Atomic Multi-Intent Publishing](#atomic-multi-intent-publishing)
32
34
  - [Supported Networks](#supported-networks)
33
35
  - [Development](#development)
34
36
 
@@ -357,6 +359,51 @@ const sdk = new IntentsSDK({
357
359
  });
358
360
  ```
359
361
 
362
+ ### Feature Flags
363
+
364
+ Configure optional SDK features through the `features` configuration:
365
+
366
+ #### Migrated PoA Token Routing
367
+
368
+ 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:
369
+
370
+ ```typescript
371
+ const sdk = new IntentsSDK({
372
+ referral: 'your-referral-code',
373
+ features: {
374
+ routeMigratedPoaTokensThroughOmniBridge: true
375
+ }
376
+ });
377
+
378
+ // With this flag enabled, tokens like 'nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near' will route through Omni Bridge
379
+ const result = await sdk.processWithdrawal({
380
+ withdrawalParams: {
381
+ assetId: 'nep141:sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near', // Migrated PoA token
382
+ amount: 1000000n,
383
+ destinationAddress: '39hqXivfCPUSqmXAaX3eo4JcA5bGFXhhs26dmg585DGb',
384
+ feeInclusive: false
385
+ }
386
+ });
387
+ ```
388
+
389
+ **When to enable:**
390
+ - Working with PoA tokens that have been migrated to Omni Bridge
391
+ - Explicitly want to route `*.omft.near` tokens through the Omni Bridge
392
+ - Default behavior (when disabled) routes these tokens through the PoA Bridge
393
+
394
+ **Allowlisted Tokens:**
395
+
396
+ 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:
397
+
398
+ ```typescript
399
+ import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from '@defuse-protocol/intents-sdk';
400
+
401
+ console.log(POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE);
402
+ // { 'sol-...omft.near': ChainKind.Sol, ... }
403
+ ```
404
+
405
+ 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.
406
+
360
407
  ### Other Intent Signers
361
408
 
362
409
  The SDK supports multiple intent signing methods using factory functions:
@@ -550,14 +597,87 @@ const {intentHash} = await sdk.signAndSendWithdrawalIntent({
550
597
 
551
598
  const intentTx = await sdk.waitForIntentSettlement({intentHash});
552
599
 
600
+ // See "Waiting for Batch Completion" below for completion options
601
+ ```
602
+
603
+ #### Waiting for Batch Completion
604
+
605
+ After the intent settles on NEAR, you need to wait for withdrawals to complete on destination chains. Two approaches are available:
606
+
607
+ **Option A: Wait for All (`waitForWithdrawalCompletion`)**
608
+
609
+ Waits for all withdrawals to complete before returning. Simple, but blocks on the slowest withdrawal.
610
+
611
+ > **Note:** Waits until completion or chain-specific p99 timeout (throws `PollTimeoutError`). Use `AbortSignal.timeout()` to set a shorter timeout.
612
+
613
+ ```typescript
553
614
  const destinationTxs = await sdk.waitForWithdrawalCompletion({
554
615
  withdrawalParams,
555
- intentTx
616
+ intentTx,
617
+ signal: AbortSignal.timeout(10 * 60 * 1000), // 10 minute timeout
556
618
  });
557
619
 
558
620
  console.log('All destination transactions:', destinationTxs);
559
621
  ```
560
622
 
623
+ **Option B: Independent Promises (`createWithdrawalCompletionPromises`)**
624
+
625
+ For scenarios where fast withdrawals (Solana ~2s) shouldn't wait for slow ones (Bitcoin ~1hr), use `createWithdrawalCompletionPromises` to get promises that resolve independently:
626
+
627
+ ```typescript
628
+ // Get array of promises - one per withdrawal
629
+ const promises = sdk.createWithdrawalCompletionPromises({
630
+ withdrawalParams,
631
+ intentTx
632
+ });
633
+
634
+ // Fire and forget - handle each independently
635
+ promises[0].then(tx => saveUsdc(tx)).catch(err => logError(0, err));
636
+ promises[1].then(tx => saveBtc(tx)).catch(err => logError(1, err));
637
+
638
+ // Or await a specific withdrawal (fast chain first)
639
+ const usdcTx = await promises[0];
640
+ await notifyUser('USDC received', usdcTx.hash);
641
+
642
+ // Or process as they complete with backpressure
643
+ const pending = new Map(promises.map((p, i) => [i, p]));
644
+ while (pending.size > 0) {
645
+ const { index, tx } = await Promise.race(
646
+ [...pending.entries()].map(async ([i, p]) => ({ index: i, tx: await p }))
647
+ );
648
+ pending.delete(index);
649
+ await saveSuccess(index, tx); // Backpressure maintained
650
+ }
651
+
652
+ // Or wait for all with independent error handling
653
+ const results = await Promise.allSettled(promises);
654
+ for (const [i, result] of results.entries()) {
655
+ if (result.status === 'fulfilled') {
656
+ await saveSuccess(i, result.value);
657
+ } else {
658
+ await saveFailure(i, result.reason);
659
+ }
660
+ }
661
+ ```
662
+
663
+ **With timeout control:**
664
+
665
+ ```typescript
666
+ const promises = sdk.createWithdrawalCompletionPromises({
667
+ withdrawalParams,
668
+ intentTx,
669
+ signal: AbortSignal.timeout(30_000) // 30 second timeout
670
+ });
671
+ ```
672
+
673
+ **Key benefits:**
674
+ - Fast withdrawals (Solana ~2s) aren't blocked by slow ones (Bitcoin ~1hr)
675
+ - One failure doesn't affect other withdrawals
676
+ - Recovery-friendly: recreate promises from saved `{ withdrawalParams, intentTx }`
677
+ - Index correspondence: `promises[i]` corresponds to `withdrawalParams[i]`
678
+
679
+ > **Note:** Both methods wait until completion or chain-specific p99 timeout (throws `PollTimeoutError`). Use `AbortSignal.timeout()` for a shorter timeout.
680
+
561
681
  ### Intent Management
562
682
 
563
683
  The SDK provides direct access to intent operations for advanced use cases:
@@ -707,6 +827,7 @@ const intentTx = await sdk.waitForIntentSettlement({intentHash});
707
827
  console.log('Intent settled:', intentTx.hash);
708
828
 
709
829
  // Wait for withdrawal completion on destination chain
830
+ // Note: Has chain-specific p99 timeout - use signal for a shorter timeout
710
831
  const completionResult = await sdk.waitForWithdrawalCompletion({
711
832
  withdrawalParams: {
712
833
  assetId: 'nep141:usdt.tether-token.near',
@@ -714,7 +835,8 @@ const completionResult = await sdk.waitForWithdrawalCompletion({
714
835
  destinationAddress: '0x742d35Cc...',
715
836
  feeInclusive: false
716
837
  },
717
- intentTx
838
+ intentTx,
839
+ signal: AbortSignal.timeout(10 * 60 * 1000), // 10 minute timeout
718
840
  });
719
841
 
720
842
  if ('hash' in completionResult) {
package/dist/index.cjs CHANGED
@@ -1,30 +1,32 @@
1
1
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require_route_enum = require('./src/constants/route-enum.cjs');
3
2
  const require_errors = require('./src/classes/errors.cjs');
3
+ const require_route_enum = require('./src/constants/route-enum.cjs');
4
4
  const require_caip2 = require('./src/lib/caip2.cjs');
5
5
  const require_validateAddress = require('./src/lib/validateAddress.cjs');
6
6
  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 require_poa_tokens_routable_through_omni_bridge = require('./src/constants/poa-tokens-routable-through-omni-bridge.cjs');
10
11
  const require_intent_hash = require('./src/intents/intent-hash.cjs');
11
12
  const require_expirable_nonce = require('./src/intents/expirable-nonce.cjs');
12
- const require_route_config_factory = require('./src/lib/route-config-factory.cjs');
13
+ const require_withdrawal_watcher = require('./src/core/withdrawal-watcher.cjs');
13
14
  const require_intent_payload_builder = require('./src/intents/intent-payload-builder.cjs');
14
15
  const require_sdk = require('./src/sdk.cjs');
15
16
  const require_factories = require('./src/intents/intent-signer-impl/factories.cjs');
16
- let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
17
+ const require_route_config_factory = require('./src/lib/route-config-factory.cjs');
18
+ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
17
19
 
18
20
  Object.defineProperty(exports, 'AssertionError', {
19
21
  enumerable: true,
20
22
  get: function () {
21
- return __defuse_protocol_internal_utils.AssertionError;
23
+ return _defuse_protocol_internal_utils.AssertionError;
22
24
  }
23
25
  });
24
26
  Object.defineProperty(exports, 'BaseError', {
25
27
  enumerable: true,
26
28
  get: function () {
27
- return __defuse_protocol_internal_utils.BaseError;
29
+ return _defuse_protocol_internal_utils.BaseError;
28
30
  }
29
31
  });
30
32
  exports.BridgeNameEnum = require_bridge_name_enum.BridgeNameEnum;
@@ -32,13 +34,11 @@ exports.Chains = require_caip2.Chains;
32
34
  exports.DestinationExplicitNearAccountDoesntExistError = require_error.DestinationExplicitNearAccountDoesntExistError;
33
35
  exports.FeeExceedsAmountError = require_errors.FeeExceedsAmountError;
34
36
  exports.HotWithdrawalApiFeeRequestTimeoutError = require_error$1.HotWithdrawalApiFeeRequestTimeoutError;
35
- exports.HotWithdrawalCancelledError = require_error$1.HotWithdrawalCancelledError;
36
37
  exports.HotWithdrawalNotFoundError = require_error$1.HotWithdrawalNotFoundError;
37
- exports.HotWithdrawalPendingError = require_error$1.HotWithdrawalPendingError;
38
38
  Object.defineProperty(exports, 'HttpRequestError', {
39
39
  enumerable: true,
40
40
  get: function () {
41
- return __defuse_protocol_internal_utils.HttpRequestError;
41
+ return _defuse_protocol_internal_utils.HttpRequestError;
42
42
  }
43
43
  });
44
44
  exports.InsufficientUtxoForOmniBridgeWithdrawalError = require_error$2.InsufficientUtxoForOmniBridgeWithdrawalError;
@@ -46,57 +46,56 @@ exports.IntentPayloadBuilder = require_intent_payload_builder.IntentPayloadBuild
46
46
  Object.defineProperty(exports, 'IntentSettlementError', {
47
47
  enumerable: true,
48
48
  get: function () {
49
- return __defuse_protocol_internal_utils.IntentSettlementError;
49
+ return _defuse_protocol_internal_utils.IntentSettlementError;
50
50
  }
51
51
  });
52
52
  exports.IntentsNearOmniAvailableBalanceTooLowError = require_error$2.IntentsNearOmniAvailableBalanceTooLowError;
53
53
  exports.IntentsSDK = require_sdk.IntentsSDK;
54
54
  exports.InvalidFeeValueError = require_error$2.InvalidFeeValueError;
55
55
  exports.MinWithdrawalAmountError = require_errors.MinWithdrawalAmountError;
56
- exports.OmniTransferDestinationChainHashNotFoundError = require_error$2.OmniTransferDestinationChainHashNotFoundError;
57
- exports.OmniTransferNotFoundError = require_error$2.OmniTransferNotFoundError;
58
56
  exports.OmniWithdrawalApiFeeRequestTimeoutError = require_error$2.OmniWithdrawalApiFeeRequestTimeoutError;
57
+ exports.POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE = require_poa_tokens_routable_through_omni_bridge.POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE;
59
58
  Object.defineProperty(exports, 'PoaWithdrawalInvariantError', {
60
59
  enumerable: true,
61
60
  get: function () {
62
- return __defuse_protocol_internal_utils.PoaWithdrawalInvariantError;
61
+ return _defuse_protocol_internal_utils.PoaWithdrawalInvariantError;
63
62
  }
64
63
  });
65
64
  Object.defineProperty(exports, 'PoaWithdrawalNotFoundError', {
66
65
  enumerable: true,
67
66
  get: function () {
68
- return __defuse_protocol_internal_utils.PoaWithdrawalNotFoundError;
67
+ return _defuse_protocol_internal_utils.PoaWithdrawalNotFoundError;
69
68
  }
70
69
  });
71
70
  Object.defineProperty(exports, 'PoaWithdrawalPendingError', {
72
71
  enumerable: true,
73
72
  get: function () {
74
- return __defuse_protocol_internal_utils.PoaWithdrawalPendingError;
73
+ return _defuse_protocol_internal_utils.PoaWithdrawalPendingError;
75
74
  }
76
75
  });
77
76
  Object.defineProperty(exports, 'QuoteError', {
78
77
  enumerable: true,
79
78
  get: function () {
80
- return __defuse_protocol_internal_utils.QuoteError;
79
+ return _defuse_protocol_internal_utils.QuoteError;
81
80
  }
82
81
  });
83
82
  Object.defineProperty(exports, 'RelayPublishError', {
84
83
  enumerable: true,
85
84
  get: function () {
86
- return __defuse_protocol_internal_utils.RelayPublishError;
85
+ return _defuse_protocol_internal_utils.RelayPublishError;
87
86
  }
88
87
  });
89
88
  exports.RouteEnum = require_route_enum.RouteEnum;
90
89
  Object.defineProperty(exports, 'RpcRequestError', {
91
90
  enumerable: true,
92
91
  get: function () {
93
- return __defuse_protocol_internal_utils.RpcRequestError;
92
+ return _defuse_protocol_internal_utils.RpcRequestError;
94
93
  }
95
94
  });
96
95
  Object.defineProperty(exports, 'TimeoutError', {
97
96
  enumerable: true,
98
97
  get: function () {
99
- return __defuse_protocol_internal_utils.TimeoutError;
98
+ return _defuse_protocol_internal_utils.TimeoutError;
100
99
  }
101
100
  });
102
101
  exports.TokenNotFoundInDestinationChainError = require_error$2.TokenNotFoundInDestinationChainError;
@@ -109,6 +108,8 @@ Object.defineProperty(exports, 'VersionedNonceBuilder', {
109
108
  return require_expirable_nonce.VersionedNonceBuilder;
110
109
  }
111
110
  });
111
+ exports.WithdrawalFailedError = require_withdrawal_watcher.WithdrawalFailedError;
112
+ exports.WithdrawalWatchError = require_withdrawal_watcher.WithdrawalWatchError;
112
113
  exports.computeIntentHash = require_intent_hash.computeIntentHash;
113
114
  exports.createDefaultRoute = require_route_config_factory.createDefaultRoute;
114
115
  exports.createHotBridgeRoute = require_route_config_factory.createHotBridgeRoute;
package/dist/index.d.cts CHANGED
@@ -10,11 +10,13 @@ import { IntentPayloadBuilder } from "./src/intents/intent-payload-builder.cjs";
10
10
  import { IntentsSDK, IntentsSDKConfig } from "./src/sdk.cjs";
11
11
  import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.cjs";
12
12
  import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.cjs";
13
+ import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "./src/constants/poa-tokens-routable-through-omni-bridge.cjs";
14
+ import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType } from "./src/core/withdrawal-watcher.cjs";
13
15
  import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.cjs";
14
16
  import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.cjs";
15
- import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.cjs";
16
- import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
17
+ import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.cjs";
18
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.cjs";
17
19
  import { computeIntentHash } from "./src/intents/intent-hash.cjs";
18
20
  import { validateAddress } from "./src/lib/validateAddress.cjs";
19
21
  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";
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 };
22
+ 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, 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 OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, 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, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
package/dist/index.d.ts CHANGED
@@ -10,11 +10,13 @@ import { IntentPayloadBuilder } from "./src/intents/intent-payload-builder.js";
10
10
  import { IntentsSDK, IntentsSDKConfig } from "./src/sdk.js";
11
11
  import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
12
12
  import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
13
+ import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "./src/constants/poa-tokens-routable-through-omni-bridge.js";
14
+ import { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType } from "./src/core/withdrawal-watcher.js";
13
15
  import { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType } from "./src/classes/errors.js";
14
16
  import { DestinationExplicitNearAccountDoesntExistError, DestinationExplicitNearAccountDoesntExistErrorType } from "./src/bridges/direct-bridge/error.js";
15
- import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalCancelledError, HotWithdrawalCancelledErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType, HotWithdrawalPendingError, HotWithdrawalPendingErrorType } from "./src/bridges/hot-bridge/error.js";
16
- import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniTransferDestinationChainHashNotFoundError, OmniTransferDestinationChainHashNotFoundErrorType, OmniTransferNotFoundError, OmniTransferNotFoundErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
17
+ import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalApiFeeRequestTimeoutErrorType, HotWithdrawalNotFoundError, HotWithdrawalNotFoundErrorType } from "./src/bridges/hot-bridge/error.js";
18
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, InsufficientUtxoForOmniBridgeWithdrawalErrorType, IntentsNearOmniAvailableBalanceTooLowError, IntentsNearOmniAvailableBalanceTooLowErrorType, InvalidFeeValueError, InvalidFeeValueErrorType, OmniWithdrawalApiFeeRequestTimeoutError, OmniWithdrawalApiFeeRequestTimeoutErrorType, TokenNotFoundInDestinationChainError, TokenNotFoundInDestinationChainErrorType } from "./src/bridges/omni-bridge/error.js";
17
19
  import { computeIntentHash } from "./src/intents/intent-hash.js";
18
20
  import { validateAddress } from "./src/lib/validateAddress.js";
19
21
  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";
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 };
22
+ 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, 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 OmniBridgeRouteConfig, OmniWithdrawalApiFeeRequestTimeoutError, type OmniWithdrawalApiFeeRequestTimeoutErrorType, type OnBeforePublishIntentHook, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, 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, WithdrawalFailedError, type WithdrawalFailedErrorType, type WithdrawalIdentifier, type WithdrawalParams, type WithdrawalResult, WithdrawalWatchError, type WithdrawalWatchErrorType, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
package/dist/index.js CHANGED
@@ -1,17 +1,19 @@
1
- import { RouteEnum } from "./src/constants/route-enum.js";
2
1
  import { FeeExceedsAmountError, MinWithdrawalAmountError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError } from "./src/classes/errors.js";
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";
5
5
  import { BridgeNameEnum } from "./src/constants/bridge-name-enum.js";
6
6
  import { DestinationExplicitNearAccountDoesntExistError } from "./src/bridges/direct-bridge/error.js";
7
- import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalCancelledError, HotWithdrawalNotFoundError, HotWithdrawalPendingError } from "./src/bridges/hot-bridge/error.js";
8
- import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniTransferDestinationChainHashNotFoundError, OmniTransferNotFoundError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
7
+ import { HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError } from "./src/bridges/hot-bridge/error.js";
8
+ import { InsufficientUtxoForOmniBridgeWithdrawalError, IntentsNearOmniAvailableBalanceTooLowError, InvalidFeeValueError, OmniWithdrawalApiFeeRequestTimeoutError, TokenNotFoundInDestinationChainError } from "./src/bridges/omni-bridge/error.js";
9
+ import { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE } from "./src/constants/poa-tokens-routable-through-omni-bridge.js";
9
10
  import { computeIntentHash } from "./src/intents/intent-hash.js";
10
11
  import { VersionedNonceBuilder } from "./src/intents/expirable-nonce.js";
11
- import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
12
+ import { WithdrawalFailedError, WithdrawalWatchError } from "./src/core/withdrawal-watcher.js";
12
13
  import { IntentPayloadBuilder } from "./src/intents/intent-payload-builder.js";
13
14
  import { IntentsSDK } from "./src/sdk.js";
14
15
  import { createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem } from "./src/intents/intent-signer-impl/factories.js";
16
+ import { createDefaultRoute, createHotBridgeRoute, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute } from "./src/lib/route-config-factory.js";
15
17
  import { AssertionError, BaseError, HttpRequestError, IntentSettlementError, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RpcRequestError, TimeoutError } from "@defuse-protocol/internal-utils";
16
18
 
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 };
19
+ export { AssertionError, BaseError, BridgeNameEnum, Chains, DestinationExplicitNearAccountDoesntExistError, FeeExceedsAmountError, HotWithdrawalApiFeeRequestTimeoutError, HotWithdrawalNotFoundError, HttpRequestError, InsufficientUtxoForOmniBridgeWithdrawalError, IntentPayloadBuilder, IntentSettlementError, IntentsNearOmniAvailableBalanceTooLowError, IntentsSDK, InvalidFeeValueError, MinWithdrawalAmountError, OmniWithdrawalApiFeeRequestTimeoutError, POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE, PoaWithdrawalInvariantError, PoaWithdrawalNotFoundError, PoaWithdrawalPendingError, QuoteError, RelayPublishError, RouteEnum, RpcRequestError, TimeoutError, TokenNotFoundInDestinationChainError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError, VersionedNonceBuilder, WithdrawalFailedError, WithdrawalWatchError, computeIntentHash, createDefaultRoute, createHotBridgeRoute, createIntentSignerNEP413, createIntentSignerNearKeyPair, createIntentSignerViem, createInternalTransferRoute, createNearWithdrawalRoute, createOmniBridgeRoute, createPoaBridgeRoute, createVirtualChainRoute, validateAddress as validateAddressFormat };
@@ -1,13 +1,13 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_route_enum = require('../../constants/route-enum.cjs');
3
3
  const require_aurora_engine_bridge_constants = require('./aurora-engine-bridge-constants.cjs');
4
- let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
+ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
5
  let viem = require("viem");
6
6
 
7
7
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.ts
8
8
  function createWithdrawIntentPrimitive(params) {
9
- const { contractId: tokenAccountId, standard } = __defuse_protocol_internal_utils.utils.parseDefuseAssetId(params.assetId);
10
- (0, __defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
9
+ const { contractId: tokenAccountId, standard } = _defuse_protocol_internal_utils.utils.parseDefuseAssetId(params.assetId);
10
+ (0, _defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
11
11
  if (params.proxyTokenContractId == null) return {
12
12
  intent: "ft_withdraw",
13
13
  token: tokenAccountId,
@@ -35,8 +35,8 @@ function makeAuroraEngineDepositMsg(recipientAddress) {
35
35
  return (0, viem.getAddress)(recipientAddress).slice(2).toLowerCase();
36
36
  }
37
37
  function withdrawalParamsInvariant(params) {
38
- (0, __defuse_protocol_internal_utils.assert)(params.routeConfig != null, "Bridge config is required");
39
- (0, __defuse_protocol_internal_utils.assert)(params.routeConfig.route === require_route_enum.RouteEnum.VirtualChain, "Bridge is not aurora_engine");
38
+ (0, _defuse_protocol_internal_utils.assert)(params.routeConfig != null, "Bridge config is required");
39
+ (0, _defuse_protocol_internal_utils.assert)(params.routeConfig.route === require_route_enum.RouteEnum.VirtualChain, "Bridge is not aurora_engine");
40
40
  }
41
41
 
42
42
  //#endregion
@@ -1,23 +1,24 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ const require_errors = require('../../classes/errors.cjs');
2
3
  const require_route_enum = require('../../constants/route-enum.cjs');
4
+ const require_caip2 = require('../../lib/caip2.cjs');
3
5
  const require_estimate_fee = require('../../lib/estimate-fee.cjs');
4
- const require_aurora_engine_bridge_constants = require('./aurora-engine-bridge-constants.cjs');
5
- const require_aurora_engine_bridge_utils = require('./aurora-engine-bridge-utils.cjs');
6
- const require_errors = require('../../classes/errors.cjs');
7
6
  const require_parse_defuse_asset_id = require('../../lib/parse-defuse-asset-id.cjs');
8
- const require_caip2 = require('../../lib/caip2.cjs');
9
7
  const require_validateAddress = require('../../lib/validateAddress.cjs');
10
- let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
8
+ const require_aurora_engine_bridge_constants = require('./aurora-engine-bridge-constants.cjs');
9
+ const require_aurora_engine_bridge_utils = require('./aurora-engine-bridge-utils.cjs');
10
+ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
11
11
 
12
12
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
13
13
  var AuroraEngineBridge = class {
14
14
  constructor({ env, nearProvider, solverRelayApiKey }) {
15
+ this.route = require_route_enum.RouteEnum.VirtualChain;
15
16
  this.env = env;
16
17
  this.nearProvider = nearProvider;
17
18
  this.solverRelayApiKey = solverRelayApiKey;
18
19
  }
19
20
  is(routeConfig) {
20
- return routeConfig.route === require_route_enum.RouteEnum.VirtualChain;
21
+ return routeConfig.route === this.route;
21
22
  }
22
23
  async supports(params) {
23
24
  if (params.routeConfig == null || !this.is(params.routeConfig)) return false;
@@ -58,12 +59,12 @@ var AuroraEngineBridge = class {
58
59
  }
59
60
  async estimateWithdrawalFee(args) {
60
61
  require_aurora_engine_bridge_utils.withdrawalParamsInvariant(args.withdrawalParams);
61
- const { contractId: tokenAccountId, standard } = __defuse_protocol_internal_utils.utils.parseDefuseAssetId(args.withdrawalParams.assetId);
62
- (0, __defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
63
- const [minStorageBalance, userStorageBalance] = await Promise.all([(0, __defuse_protocol_internal_utils.getNearNep141MinStorageBalance)({
62
+ const { contractId: tokenAccountId, standard } = _defuse_protocol_internal_utils.utils.parseDefuseAssetId(args.withdrawalParams.assetId);
63
+ (0, _defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
64
+ const [minStorageBalance, userStorageBalance] = await Promise.all([(0, _defuse_protocol_internal_utils.getNearNep141MinStorageBalance)({
64
65
  contractId: tokenAccountId,
65
66
  nearProvider: this.nearProvider
66
- }), (0, __defuse_protocol_internal_utils.getNearNep141StorageBalance)({
67
+ }), (0, _defuse_protocol_internal_utils.getNearNep141StorageBalance)({
67
68
  contractId: tokenAccountId,
68
69
  accountId: args.withdrawalParams.routeConfig.auroraEngineContractId,
69
70
  nearProvider: this.nearProvider
@@ -90,8 +91,19 @@ var AuroraEngineBridge = class {
90
91
  underlyingFees: { [require_route_enum.RouteEnum.VirtualChain]: { storageDepositFee: feeAmount } }
91
92
  };
92
93
  }
93
- async waitForWithdrawalCompletion() {
94
- return { hash: null };
94
+ createWithdrawalIdentifier(args) {
95
+ return {
96
+ landingChain: require_caip2.Chains.Near,
97
+ index: args.index,
98
+ withdrawalParams: args.withdrawalParams,
99
+ tx: args.tx
100
+ };
101
+ }
102
+ async describeWithdrawal() {
103
+ return {
104
+ status: "completed",
105
+ txHash: null
106
+ };
95
107
  }
96
108
  };
97
109
 
@@ -1,22 +1,23 @@
1
+ import { InvalidDestinationAddressForWithdrawalError, UnsupportedAssetIdError } from "../../classes/errors.js";
1
2
  import { RouteEnum } from "../../constants/route-enum.js";
3
+ import { Chains } from "../../lib/caip2.js";
2
4
  import { getFeeQuote, getUnderlyingFee } from "../../lib/estimate-fee.js";
3
- import { NEAR_NATIVE_ASSET_ID } from "./aurora-engine-bridge-constants.js";
4
- import { createWithdrawIntentPrimitive, withdrawalParamsInvariant } from "./aurora-engine-bridge-utils.js";
5
- import { InvalidDestinationAddressForWithdrawalError, UnsupportedAssetIdError } from "../../classes/errors.js";
6
5
  import { parseDefuseAssetId } from "../../lib/parse-defuse-asset-id.js";
7
- import { Chains } from "../../lib/caip2.js";
8
6
  import { validateAddress } from "../../lib/validateAddress.js";
7
+ import { NEAR_NATIVE_ASSET_ID } from "./aurora-engine-bridge-constants.js";
8
+ import { createWithdrawIntentPrimitive, withdrawalParamsInvariant } from "./aurora-engine-bridge-utils.js";
9
9
  import { assert, getNearNep141MinStorageBalance, getNearNep141StorageBalance, utils } from "@defuse-protocol/internal-utils";
10
10
 
11
11
  //#region src/bridges/aurora-engine-bridge/aurora-engine-bridge.ts
12
12
  var AuroraEngineBridge = class {
13
13
  constructor({ env, nearProvider, solverRelayApiKey }) {
14
+ this.route = RouteEnum.VirtualChain;
14
15
  this.env = env;
15
16
  this.nearProvider = nearProvider;
16
17
  this.solverRelayApiKey = solverRelayApiKey;
17
18
  }
18
19
  is(routeConfig) {
19
- return routeConfig.route === RouteEnum.VirtualChain;
20
+ return routeConfig.route === this.route;
20
21
  }
21
22
  async supports(params) {
22
23
  if (params.routeConfig == null || !this.is(params.routeConfig)) return false;
@@ -89,8 +90,19 @@ var AuroraEngineBridge = class {
89
90
  underlyingFees: { [RouteEnum.VirtualChain]: { storageDepositFee: feeAmount } }
90
91
  };
91
92
  }
92
- async waitForWithdrawalCompletion() {
93
- return { hash: null };
93
+ createWithdrawalIdentifier(args) {
94
+ return {
95
+ landingChain: Chains.Near,
96
+ index: args.index,
97
+ withdrawalParams: args.withdrawalParams,
98
+ tx: args.tx
99
+ };
100
+ }
101
+ async describeWithdrawal() {
102
+ return {
103
+ status: "completed",
104
+ txHash: null
105
+ };
94
106
  }
95
107
  };
96
108
 
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_route_enum = require('../../constants/route-enum.cjs');
3
3
  const require_direct_bridge_constants = require('./direct-bridge-constants.cjs');
4
- let __defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
4
+ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils");
5
5
  let near_api_js = require("near-api-js");
6
6
 
7
7
  //#region src/bridges/direct-bridge/direct-bridge-utils.ts
@@ -11,8 +11,8 @@ function createWithdrawIntentPrimitive(params) {
11
11
  receiver_id: params.destinationAddress,
12
12
  amount: params.amount.toString()
13
13
  };
14
- const { contractId: tokenAccountId, standard } = __defuse_protocol_internal_utils.utils.parseDefuseAssetId(params.assetId);
15
- (0, __defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
14
+ const { contractId: tokenAccountId, standard } = _defuse_protocol_internal_utils.utils.parseDefuseAssetId(params.assetId);
15
+ (0, _defuse_protocol_internal_utils.assert)(standard === "nep141", "Only NEP-141 is supported");
16
16
  if (params.msg !== void 0) params.logger?.warn("min_gas is not set for direct-bridge withdrawal with msg, gas consumption is unpredictable");
17
17
  return {
18
18
  intent: "ft_withdraw",
@@ -25,11 +25,11 @@ function createWithdrawIntentPrimitive(params) {
25
25
  };
26
26
  }
27
27
  function withdrawalParamsInvariant(params) {
28
- (0, __defuse_protocol_internal_utils.assert)(!params.routeConfig ? true : params.routeConfig.route === require_route_enum.RouteEnum.NearWithdrawal, "Bridge is not direct");
28
+ (0, _defuse_protocol_internal_utils.assert)(!params.routeConfig ? true : params.routeConfig.route === require_route_enum.RouteEnum.NearWithdrawal, "Bridge is not direct");
29
29
  }
30
30
  async function accountExistsInNEAR(provider, accountId) {
31
31
  try {
32
- await (0, __defuse_protocol_internal_utils.unwrapNearFailoverRpcProvider)(provider).query({
32
+ await (0, _defuse_protocol_internal_utils.unwrapNearFailoverRpcProvider)(provider).query({
33
33
  request_type: "view_account",
34
34
  account_id: accountId,
35
35
  finality: "final"