lampamazaza-new-intents-sdk 0.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1083 -0
  3. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  4. package/dist/index.cjs +124 -0
  5. package/dist/index.d.cts +22 -0
  6. package/dist/index.d.ts +22 -0
  7. package/dist/index.js +19 -0
  8. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.cjs +10 -0
  9. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-constants.js +7 -0
  10. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.cjs +44 -0
  11. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge-utils.js +42 -0
  12. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.cjs +111 -0
  13. package/dist/src/bridges/aurora-engine-bridge/aurora-engine-bridge.js +110 -0
  14. package/dist/src/bridges/direct-bridge/direct-bridge-constants.cjs +8 -0
  15. package/dist/src/bridges/direct-bridge/direct-bridge-constants.js +6 -0
  16. package/dist/src/bridges/direct-bridge/direct-bridge-utils.cjs +47 -0
  17. package/dist/src/bridges/direct-bridge/direct-bridge-utils.js +44 -0
  18. package/dist/src/bridges/direct-bridge/direct-bridge.cjs +155 -0
  19. package/dist/src/bridges/direct-bridge/direct-bridge.js +154 -0
  20. package/dist/src/bridges/direct-bridge/error.cjs +16 -0
  21. package/dist/src/bridges/direct-bridge/error.d.cts +12 -0
  22. package/dist/src/bridges/direct-bridge/error.d.ts +12 -0
  23. package/dist/src/bridges/direct-bridge/error.js +15 -0
  24. package/dist/src/bridges/hot-bridge/error.cjs +23 -0
  25. package/dist/src/bridges/hot-bridge/error.d.cts +19 -0
  26. package/dist/src/bridges/hot-bridge/error.d.ts +19 -0
  27. package/dist/src/bridges/hot-bridge/error.js +21 -0
  28. package/dist/src/bridges/hot-bridge/hot-bridge-chains.cjs +21 -0
  29. package/dist/src/bridges/hot-bridge/hot-bridge-chains.d.cts +6 -0
  30. package/dist/src/bridges/hot-bridge/hot-bridge-chains.d.ts +6 -0
  31. package/dist/src/bridges/hot-bridge/hot-bridge-chains.js +20 -0
  32. package/dist/src/bridges/hot-bridge/hot-bridge-constants.cjs +11 -0
  33. package/dist/src/bridges/hot-bridge/hot-bridge-constants.js +9 -0
  34. package/dist/src/bridges/hot-bridge/hot-bridge-utils.cjs +66 -0
  35. package/dist/src/bridges/hot-bridge/hot-bridge-utils.js +61 -0
  36. package/dist/src/bridges/hot-bridge/hot-bridge.cjs +241 -0
  37. package/dist/src/bridges/hot-bridge/hot-bridge.js +239 -0
  38. package/dist/src/bridges/intents-bridge/intents-bridge.cjs +59 -0
  39. package/dist/src/bridges/intents-bridge/intents-bridge.js +59 -0
  40. package/dist/src/bridges/omni-bridge/error.cjs +54 -0
  41. package/dist/src/bridges/omni-bridge/error.d.cts +41 -0
  42. package/dist/src/bridges/omni-bridge/error.d.ts +41 -0
  43. package/dist/src/bridges/omni-bridge/error.js +49 -0
  44. package/dist/src/bridges/omni-bridge/omni-bridge-constants.cjs +12 -0
  45. package/dist/src/bridges/omni-bridge/omni-bridge-constants.js +8 -0
  46. package/dist/src/bridges/omni-bridge/omni-bridge-utils.cjs +153 -0
  47. package/dist/src/bridges/omni-bridge/omni-bridge-utils.js +143 -0
  48. package/dist/src/bridges/omni-bridge/omni-bridge.cjs +316 -0
  49. package/dist/src/bridges/omni-bridge/omni-bridge.js +314 -0
  50. package/dist/src/bridges/poa-bridge/poa-bridge-utils.cjs +76 -0
  51. package/dist/src/bridges/poa-bridge/poa-bridge-utils.js +73 -0
  52. package/dist/src/bridges/poa-bridge/poa-bridge.cjs +175 -0
  53. package/dist/src/bridges/poa-bridge/poa-bridge.js +173 -0
  54. package/dist/src/bridges/poa-bridge/poa-constants.cjs +6 -0
  55. package/dist/src/bridges/poa-bridge/poa-constants.js +5 -0
  56. package/dist/src/classes/errors.cjs +87 -0
  57. package/dist/src/classes/errors.d.cts +48 -0
  58. package/dist/src/classes/errors.d.ts +48 -0
  59. package/dist/src/classes/errors.js +81 -0
  60. package/dist/src/constants/bridge-name-enum.cjs +11 -0
  61. package/dist/src/constants/bridge-name-enum.d.cts +11 -0
  62. package/dist/src/constants/bridge-name-enum.d.ts +11 -0
  63. package/dist/src/constants/bridge-name-enum.js +10 -0
  64. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.cjs +17 -0
  65. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.cts +12 -0
  66. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.d.ts +12 -0
  67. package/dist/src/constants/poa-tokens-routable-through-omni-bridge.js +16 -0
  68. package/dist/src/constants/public-rpc-urls.cjs +25 -0
  69. package/dist/src/constants/public-rpc-urls.js +24 -0
  70. package/dist/src/constants/route-enum.cjs +13 -0
  71. package/dist/src/constants/route-enum.d.cts +13 -0
  72. package/dist/src/constants/route-enum.d.ts +13 -0
  73. package/dist/src/constants/route-enum.js +12 -0
  74. package/dist/src/constants/withdrawal-timing.cjs +68 -0
  75. package/dist/src/constants/withdrawal-timing.js +68 -0
  76. package/dist/src/core/withdrawal-watcher.cjs +86 -0
  77. package/dist/src/core/withdrawal-watcher.d.cts +18 -0
  78. package/dist/src/core/withdrawal-watcher.d.ts +19 -0
  79. package/dist/src/core/withdrawal-watcher.js +82 -0
  80. package/dist/src/intents/expirable-nonce.cjs +90 -0
  81. package/dist/src/intents/expirable-nonce.d.cts +44 -0
  82. package/dist/src/intents/expirable-nonce.d.ts +45 -0
  83. package/dist/src/intents/expirable-nonce.js +82 -0
  84. package/dist/src/intents/intent-executer-impl/intent-executer.cjs +85 -0
  85. package/dist/src/intents/intent-executer-impl/intent-executer.d.cts +20 -0
  86. package/dist/src/intents/intent-executer-impl/intent-executer.d.ts +24 -0
  87. package/dist/src/intents/intent-executer-impl/intent-executer.js +85 -0
  88. package/dist/src/intents/intent-hash.cjs +48 -0
  89. package/dist/src/intents/intent-hash.d.cts +8 -0
  90. package/dist/src/intents/intent-hash.d.ts +8 -0
  91. package/dist/src/intents/intent-hash.js +47 -0
  92. package/dist/src/intents/intent-hashes/erc191.cjs +38 -0
  93. package/dist/src/intents/intent-hashes/erc191.js +37 -0
  94. package/dist/src/intents/intent-hashes/nep413.cjs +23 -0
  95. package/dist/src/intents/intent-hashes/nep413.js +22 -0
  96. package/dist/src/intents/intent-hashes/raw-ed25519.cjs +26 -0
  97. package/dist/src/intents/intent-hashes/raw-ed25519.js +25 -0
  98. package/dist/src/intents/intent-hashes/sep53.cjs +36 -0
  99. package/dist/src/intents/intent-hashes/sep53.js +35 -0
  100. package/dist/src/intents/intent-hashes/tip191.cjs +39 -0
  101. package/dist/src/intents/intent-hashes/tip191.js +38 -0
  102. package/dist/src/intents/intent-hashes/ton-connect.cjs +105 -0
  103. package/dist/src/intents/intent-hashes/ton-connect.js +104 -0
  104. package/dist/src/intents/intent-hashes/webauthn.cjs +26 -0
  105. package/dist/src/intents/intent-hashes/webauthn.js +25 -0
  106. package/dist/src/intents/intent-payload-builder.cjs +208 -0
  107. package/dist/src/intents/intent-payload-builder.d.cts +161 -0
  108. package/dist/src/intents/intent-payload-builder.d.ts +161 -0
  109. package/dist/src/intents/intent-payload-builder.js +207 -0
  110. package/dist/src/intents/intent-payload-factory.cjs +23 -0
  111. package/dist/src/intents/intent-payload-factory.js +21 -0
  112. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.cjs +43 -0
  113. package/dist/src/intents/intent-relayer-impl/intent-relayer-public.js +42 -0
  114. package/dist/src/intents/intent-signer-impl/factories.cjs +19 -0
  115. package/dist/src/intents/intent-signer-impl/factories.d.cts +11 -0
  116. package/dist/src/intents/intent-signer-impl/factories.d.ts +11 -0
  117. package/dist/src/intents/intent-signer-impl/factories.js +17 -0
  118. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.cjs +22 -0
  119. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.d.cts +15 -0
  120. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.d.ts +16 -0
  121. package/dist/src/intents/intent-signer-impl/intent-signer-near-keypair.js +21 -0
  122. package/dist/src/intents/intent-signer-impl/intent-signer-nep413.cjs +37 -0
  123. package/dist/src/intents/intent-signer-impl/intent-signer-nep413.d.cts +14 -0
  124. package/dist/src/intents/intent-signer-impl/intent-signer-nep413.d.ts +14 -0
  125. package/dist/src/intents/intent-signer-impl/intent-signer-nep413.js +36 -0
  126. package/dist/src/intents/intent-signer-impl/intent-signer-noop.cjs +8 -0
  127. package/dist/src/intents/intent-signer-impl/intent-signer-noop.js +7 -0
  128. package/dist/src/intents/intent-signer-impl/intent-signer-viem.cjs +31 -0
  129. package/dist/src/intents/intent-signer-impl/intent-signer-viem.d.cts +17 -0
  130. package/dist/src/intents/intent-signer-impl/intent-signer-viem.d.ts +17 -0
  131. package/dist/src/intents/intent-signer-impl/intent-signer-viem.js +30 -0
  132. package/dist/src/intents/interfaces/intent-executer.d.ts +2 -0
  133. package/dist/src/intents/interfaces/intent-relayer.d.cts +43 -0
  134. package/dist/src/intents/interfaces/intent-relayer.d.ts +43 -0
  135. package/dist/src/intents/interfaces/intent-signer.d.cts +8 -0
  136. package/dist/src/intents/interfaces/intent-signer.d.ts +8 -0
  137. package/dist/src/intents/interfaces/salt-manager.d.cts +9 -0
  138. package/dist/src/intents/interfaces/salt-manager.d.ts +9 -0
  139. package/dist/src/intents/salt-manager.cjs +74 -0
  140. package/dist/src/intents/salt-manager.js +72 -0
  141. package/dist/src/intents/shared-types.d.cts +20 -0
  142. package/dist/src/intents/shared-types.d.ts +20 -0
  143. package/dist/src/lib/array.cjs +11 -0
  144. package/dist/src/lib/array.js +10 -0
  145. package/dist/src/lib/caip2.cjs +50 -0
  146. package/dist/src/lib/caip2.d.cts +38 -0
  147. package/dist/src/lib/caip2.d.ts +38 -0
  148. package/dist/src/lib/caip2.js +48 -0
  149. package/dist/src/lib/configure-rpc-config.cjs +20 -0
  150. package/dist/src/lib/configure-rpc-config.js +18 -0
  151. package/dist/src/lib/estimate-fee.cjs +96 -0
  152. package/dist/src/lib/estimate-fee.js +94 -0
  153. package/dist/src/lib/hex.cjs +11 -0
  154. package/dist/src/lib/hex.js +10 -0
  155. package/dist/src/lib/nep413.cjs +42 -0
  156. package/dist/src/lib/nep413.d.cts +14 -0
  157. package/dist/src/lib/nep413.d.ts +14 -0
  158. package/dist/src/lib/nep413.js +41 -0
  159. package/dist/src/lib/object.cjs +10 -0
  160. package/dist/src/lib/object.js +9 -0
  161. package/dist/src/lib/parse-defuse-asset-id.cjs +15 -0
  162. package/dist/src/lib/parse-defuse-asset-id.js +14 -0
  163. package/dist/src/lib/route-config-factory.cjs +43 -0
  164. package/dist/src/lib/route-config-factory.d.cts +13 -0
  165. package/dist/src/lib/route-config-factory.d.ts +13 -0
  166. package/dist/src/lib/route-config-factory.js +37 -0
  167. package/dist/src/lib/tokensUsdPricesHttpClient/apis.cjs +17 -0
  168. package/dist/src/lib/tokensUsdPricesHttpClient/apis.js +16 -0
  169. package/dist/src/lib/validateAddress.cjs +271 -0
  170. package/dist/src/lib/validateAddress.d.cts +14 -0
  171. package/dist/src/lib/validateAddress.d.ts +14 -0
  172. package/dist/src/lib/validateAddress.js +270 -0
  173. package/dist/src/sdk.cjs +435 -0
  174. package/dist/src/sdk.d.cts +231 -0
  175. package/dist/src/sdk.d.ts +231 -0
  176. package/dist/src/sdk.js +433 -0
  177. package/dist/src/shared-types.d.cts +378 -0
  178. package/dist/src/shared-types.d.ts +378 -0
  179. package/package.json +62 -0
@@ -0,0 +1,48 @@
1
+ import { FeeEstimation } from "../shared-types.js";
2
+ import { BaseError } from "lampamazaza-internal-utils";
3
+
4
+ //#region src/classes/errors.d.ts
5
+ type FeeExceedsAmountErrorType = FeeExceedsAmountError & {
6
+ name: "FeeExceedsAmountError";
7
+ };
8
+ declare class FeeExceedsAmountError extends BaseError {
9
+ feeEstimation: FeeEstimation;
10
+ amount: bigint;
11
+ constructor(feeEstimation: FeeEstimation, amount: bigint);
12
+ }
13
+ type MinWithdrawalAmountErrorType = MinWithdrawalAmountError & {
14
+ name: "MinWithdrawalAmountError";
15
+ };
16
+ declare class MinWithdrawalAmountError extends BaseError {
17
+ minAmount: bigint;
18
+ requestedAmount: bigint;
19
+ assetId: string;
20
+ constructor(minAmount: bigint, requestedAmount: bigint, assetId: string);
21
+ }
22
+ type UnsupportedDestinationMemoErrorType = UnsupportedDestinationMemoError & {
23
+ name: "UnsupportedDestinationMemoError";
24
+ };
25
+ declare class UnsupportedDestinationMemoError extends BaseError {
26
+ blockchain: string;
27
+ assetId: string;
28
+ constructor(blockchain: string, assetId: string);
29
+ }
30
+ type TrustlineNotFoundErrorType = TrustlineNotFoundError & {
31
+ name: "TrustlineNotFoundError";
32
+ };
33
+ declare class TrustlineNotFoundError extends BaseError {
34
+ destinationAddress: string;
35
+ assetId: string;
36
+ blockchain: string;
37
+ tokenAddress: string;
38
+ constructor(destinationAddress: string, assetId: string, blockchain: string, tokenAddress: string);
39
+ }
40
+ type UnsupportedAssetIdErrorType = UnsupportedAssetIdError & {
41
+ name: "UnsupportedAssetIdError";
42
+ };
43
+ declare class UnsupportedAssetIdError extends BaseError {
44
+ assetId: string;
45
+ constructor(assetId: string, details: string);
46
+ }
47
+ //#endregion
48
+ export { FeeExceedsAmountError, FeeExceedsAmountErrorType, MinWithdrawalAmountError, MinWithdrawalAmountErrorType, TrustlineNotFoundError, TrustlineNotFoundErrorType, UnsupportedAssetIdError, UnsupportedAssetIdErrorType, UnsupportedDestinationMemoError, UnsupportedDestinationMemoErrorType };
@@ -0,0 +1,81 @@
1
+ import { BaseError } from "lampamazaza-internal-utils";
2
+
3
+ //#region src/classes/errors.ts
4
+ var FeeExceedsAmountError = class extends BaseError {
5
+ constructor(feeEstimation, amount) {
6
+ super("Amount too small to pay fee.", {
7
+ metaMessages: [`Required fee: ${feeEstimation.amount}`, `Withdrawal amount: ${amount}`],
8
+ name: "FeeExceedsAmountError"
9
+ });
10
+ this.feeEstimation = feeEstimation;
11
+ this.amount = amount;
12
+ }
13
+ };
14
+ var MinWithdrawalAmountError = class extends BaseError {
15
+ constructor(minAmount, requestedAmount, assetId) {
16
+ super("Withdrawal amount is below minimum required by the bridge.", {
17
+ metaMessages: [
18
+ `Asset ID: ${assetId}`,
19
+ `Minimum amount: ${minAmount}`,
20
+ `Requested amount: ${requestedAmount}`
21
+ ],
22
+ name: "MinWithdrawalAmountError"
23
+ });
24
+ this.minAmount = minAmount;
25
+ this.requestedAmount = requestedAmount;
26
+ this.assetId = assetId;
27
+ }
28
+ };
29
+ var UnsupportedDestinationMemoError = class extends BaseError {
30
+ constructor(blockchain, assetId) {
31
+ super("Destination memo is not supported for this blockchain.", {
32
+ details: "Destination memo is only supported for XRP Ledger withdrawals.",
33
+ metaMessages: [`Blockchain: ${blockchain}`, `Asset ID: ${assetId}`],
34
+ name: "UnsupportedDestinationMemoError"
35
+ });
36
+ this.blockchain = blockchain;
37
+ this.assetId = assetId;
38
+ }
39
+ };
40
+ var TrustlineNotFoundError = class extends BaseError {
41
+ constructor(destinationAddress, assetId, blockchain, tokenAddress) {
42
+ super("Destination address does not have a trustline for this asset.", {
43
+ details: "The destination address must establish a trustline before receiving this asset.",
44
+ metaMessages: [
45
+ `Blockchain: ${blockchain}`,
46
+ `Asset ID: ${assetId}`,
47
+ `Destination address: ${destinationAddress}`,
48
+ `Token address: ${tokenAddress}`
49
+ ],
50
+ name: "TrustlineNotFoundError"
51
+ });
52
+ this.destinationAddress = destinationAddress;
53
+ this.assetId = assetId;
54
+ this.blockchain = blockchain;
55
+ this.tokenAddress = tokenAddress;
56
+ }
57
+ };
58
+ var UnsupportedAssetIdError = class extends BaseError {
59
+ constructor(assetId, details) {
60
+ super("Asset ID is not supported.", {
61
+ details,
62
+ metaMessages: [`Asset ID: ${assetId}`],
63
+ name: "UnsupportedAssetIdError"
64
+ });
65
+ this.assetId = assetId;
66
+ }
67
+ };
68
+ var InvalidDestinationAddressForWithdrawalError = class extends BaseError {
69
+ constructor(destinationAddress, destinationChain) {
70
+ super(`Invalid destination address.`, {
71
+ metaMessages: [`Destination address: ${destinationAddress}`, `Destination chain: ${destinationChain}`],
72
+ name: "InvalidDestinationAddressForWithdrawalError",
73
+ details: `Destination address ${destinationAddress} is not valid for withdrawal to ${destinationChain}.`
74
+ });
75
+ this.destinationAddress = destinationAddress;
76
+ this.destinationChain = destinationChain;
77
+ }
78
+ };
79
+
80
+ //#endregion
81
+ export { FeeExceedsAmountError, InvalidDestinationAddressForWithdrawalError, MinWithdrawalAmountError, TrustlineNotFoundError, UnsupportedAssetIdError, UnsupportedDestinationMemoError };
@@ -0,0 +1,11 @@
1
+
2
+ //#region src/constants/bridge-name-enum.ts
3
+ const BridgeNameEnum = {
4
+ Hot: "hot",
5
+ Poa: "poa",
6
+ Omni: "omni",
7
+ None: null
8
+ };
9
+
10
+ //#endregion
11
+ exports.BridgeNameEnum = BridgeNameEnum;
@@ -0,0 +1,11 @@
1
+ //#region src/constants/bridge-name-enum.d.ts
2
+ declare const BridgeNameEnum: {
3
+ readonly Hot: "hot";
4
+ readonly Poa: "poa";
5
+ readonly Omni: "omni";
6
+ readonly None: null;
7
+ };
8
+ type BridgeNameEnum = typeof BridgeNameEnum;
9
+ type BridgeNameEnumValues = (typeof BridgeNameEnum)[keyof typeof BridgeNameEnum];
10
+ //#endregion
11
+ export { BridgeNameEnum, BridgeNameEnumValues };
@@ -0,0 +1,11 @@
1
+ //#region src/constants/bridge-name-enum.d.ts
2
+ declare const BridgeNameEnum: {
3
+ readonly Hot: "hot";
4
+ readonly Poa: "poa";
5
+ readonly Omni: "omni";
6
+ readonly None: null;
7
+ };
8
+ type BridgeNameEnum = typeof BridgeNameEnum;
9
+ type BridgeNameEnumValues = (typeof BridgeNameEnum)[keyof typeof BridgeNameEnum];
10
+ //#endregion
11
+ export { BridgeNameEnum, BridgeNameEnumValues };
@@ -0,0 +1,10 @@
1
+ //#region src/constants/bridge-name-enum.ts
2
+ const BridgeNameEnum = {
3
+ Hot: "hot",
4
+ Poa: "poa",
5
+ Omni: "omni",
6
+ None: null
7
+ };
8
+
9
+ //#endregion
10
+ export { BridgeNameEnum };
@@ -0,0 +1,17 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let _omni_bridge_core = require("@omni-bridge/core");
3
+
4
+ //#region src/constants/poa-tokens-routable-through-omni-bridge.ts
5
+ /**
6
+ * These tokens can be routed through either PoA Bridge or Omni Bridge
7
+ * depending on the SDK configuration. Use the `routeMigratedPoaTokensThroughOmniBridge`
8
+ * feature flag to enable Omni Bridge routing for these tokens.
9
+ */
10
+ const POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE = {
11
+ "sol-57d087fd8c460f612f8701f5499ad8b2eec5ab68.omft.near": _omni_bridge_core.ChainKind.Sol,
12
+ "sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near": _omni_bridge_core.ChainKind.Sol,
13
+ "sol-b9c68f94ec8fd160137af8cdfe5e61cd68e2afba.omft.near": _omni_bridge_core.ChainKind.Sol
14
+ };
15
+
16
+ //#endregion
17
+ exports.POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE = POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE;
@@ -0,0 +1,12 @@
1
+ import { ChainKind } from "@omni-bridge/core";
2
+
3
+ //#region src/constants/poa-tokens-routable-through-omni-bridge.d.ts
4
+
5
+ /**
6
+ * These tokens can be routed through either PoA Bridge or Omni Bridge
7
+ * depending on the SDK configuration. Use the `routeMigratedPoaTokensThroughOmniBridge`
8
+ * feature flag to enable Omni Bridge routing for these tokens.
9
+ */
10
+ declare const POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE: Record<string, ChainKind>;
11
+ //#endregion
12
+ export { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE };
@@ -0,0 +1,12 @@
1
+ import { ChainKind } from "@omni-bridge/core";
2
+
3
+ //#region src/constants/poa-tokens-routable-through-omni-bridge.d.ts
4
+
5
+ /**
6
+ * These tokens can be routed through either PoA Bridge or Omni Bridge
7
+ * depending on the SDK configuration. Use the `routeMigratedPoaTokensThroughOmniBridge`
8
+ * feature flag to enable Omni Bridge routing for these tokens.
9
+ */
10
+ declare const POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE: Record<string, ChainKind>;
11
+ //#endregion
12
+ export { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE };
@@ -0,0 +1,16 @@
1
+ import { ChainKind } from "@omni-bridge/core";
2
+
3
+ //#region src/constants/poa-tokens-routable-through-omni-bridge.ts
4
+ /**
5
+ * These tokens can be routed through either PoA Bridge or Omni Bridge
6
+ * depending on the SDK configuration. Use the `routeMigratedPoaTokensThroughOmniBridge`
7
+ * feature flag to enable Omni Bridge routing for these tokens.
8
+ */
9
+ const POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE = {
10
+ "sol-57d087fd8c460f612f8701f5499ad8b2eec5ab68.omft.near": ChainKind.Sol,
11
+ "sol-c58e6539c2f2e097c251f8edf11f9c03e581f8d4.omft.near": ChainKind.Sol,
12
+ "sol-b9c68f94ec8fd160137af8cdfe5e61cd68e2afba.omft.near": ChainKind.Sol
13
+ };
14
+
15
+ //#endregion
16
+ export { POA_TOKENS_ROUTABLE_THROUGH_OMNI_BRIDGE };
@@ -0,0 +1,25 @@
1
+ const require_caip2 = require('../lib/caip2.cjs');
2
+
3
+ //#region src/constants/public-rpc-urls.ts
4
+ /**
5
+ * Default EVM RPC endpoints for HOT bridge supported chains
6
+ */
7
+ const PUBLIC_EVM_RPC_URLS = {
8
+ [require_caip2.Chains.BNB]: ["https://bsc-rpc.publicnode.com"],
9
+ [require_caip2.Chains.Polygon]: ["https://polygon-bor-rpc.publicnode.com"],
10
+ [require_caip2.Chains.Monad]: ["https://rpc.monad.xyz"],
11
+ [require_caip2.Chains.Optimism]: ["https://optimism-rpc.publicnode.com"],
12
+ [require_caip2.Chains.Avalanche]: ["https://avalanche-c-chain-rpc.publicnode.com"],
13
+ [require_caip2.Chains.LayerX]: ["https://rpc.xlayer.tech"],
14
+ [require_caip2.Chains.Adi]: ["https://rpc.adifoundation.ai"],
15
+ [require_caip2.Chains.Plasma]: ["https://rpc.plasma.to"],
16
+ [require_caip2.Chains.Scroll]: ["https://rpc.scroll.io"]
17
+ };
18
+ const PUBLIC_STELLAR_RPC_URLS = {
19
+ soroban: ["https://mainnet.sorobanrpc.com"],
20
+ horizon: ["https://horizon.stellar.org"]
21
+ };
22
+
23
+ //#endregion
24
+ exports.PUBLIC_EVM_RPC_URLS = PUBLIC_EVM_RPC_URLS;
25
+ exports.PUBLIC_STELLAR_RPC_URLS = PUBLIC_STELLAR_RPC_URLS;
@@ -0,0 +1,24 @@
1
+ import { Chains } from "../lib/caip2.js";
2
+
3
+ //#region src/constants/public-rpc-urls.ts
4
+ /**
5
+ * Default EVM RPC endpoints for HOT bridge supported chains
6
+ */
7
+ const PUBLIC_EVM_RPC_URLS = {
8
+ [Chains.BNB]: ["https://bsc-rpc.publicnode.com"],
9
+ [Chains.Polygon]: ["https://polygon-bor-rpc.publicnode.com"],
10
+ [Chains.Monad]: ["https://rpc.monad.xyz"],
11
+ [Chains.Optimism]: ["https://optimism-rpc.publicnode.com"],
12
+ [Chains.Avalanche]: ["https://avalanche-c-chain-rpc.publicnode.com"],
13
+ [Chains.LayerX]: ["https://rpc.xlayer.tech"],
14
+ [Chains.Adi]: ["https://rpc.adifoundation.ai"],
15
+ [Chains.Plasma]: ["https://rpc.plasma.to"],
16
+ [Chains.Scroll]: ["https://rpc.scroll.io"]
17
+ };
18
+ const PUBLIC_STELLAR_RPC_URLS = {
19
+ soroban: ["https://mainnet.sorobanrpc.com"],
20
+ horizon: ["https://horizon.stellar.org"]
21
+ };
22
+
23
+ //#endregion
24
+ export { PUBLIC_EVM_RPC_URLS, PUBLIC_STELLAR_RPC_URLS };
@@ -0,0 +1,13 @@
1
+
2
+ //#region src/constants/route-enum.ts
3
+ const RouteEnum = {
4
+ HotBridge: "hot_bridge",
5
+ PoaBridge: "poa_bridge",
6
+ OmniBridge: "omni_bridge",
7
+ NearWithdrawal: "near_withdrawal",
8
+ VirtualChain: "virtual_chain",
9
+ InternalTransfer: "internal_transfer"
10
+ };
11
+
12
+ //#endregion
13
+ exports.RouteEnum = RouteEnum;
@@ -0,0 +1,13 @@
1
+ //#region src/constants/route-enum.d.ts
2
+ declare const RouteEnum: {
3
+ readonly HotBridge: "hot_bridge";
4
+ readonly PoaBridge: "poa_bridge";
5
+ readonly OmniBridge: "omni_bridge";
6
+ readonly NearWithdrawal: "near_withdrawal";
7
+ readonly VirtualChain: "virtual_chain";
8
+ readonly InternalTransfer: "internal_transfer";
9
+ };
10
+ type RouteEnum = typeof RouteEnum;
11
+ type RouteEnumValues = (typeof RouteEnum)[keyof typeof RouteEnum];
12
+ //#endregion
13
+ export { RouteEnum, RouteEnumValues };
@@ -0,0 +1,13 @@
1
+ //#region src/constants/route-enum.d.ts
2
+ declare const RouteEnum: {
3
+ readonly HotBridge: "hot_bridge";
4
+ readonly PoaBridge: "poa_bridge";
5
+ readonly OmniBridge: "omni_bridge";
6
+ readonly NearWithdrawal: "near_withdrawal";
7
+ readonly VirtualChain: "virtual_chain";
8
+ readonly InternalTransfer: "internal_transfer";
9
+ };
10
+ type RouteEnum = typeof RouteEnum;
11
+ type RouteEnumValues = (typeof RouteEnum)[keyof typeof RouteEnum];
12
+ //#endregion
13
+ export { RouteEnum, RouteEnumValues };
@@ -0,0 +1,12 @@
1
+ //#region src/constants/route-enum.ts
2
+ const RouteEnum = {
3
+ HotBridge: "hot_bridge",
4
+ PoaBridge: "poa_bridge",
5
+ OmniBridge: "omni_bridge",
6
+ NearWithdrawal: "near_withdrawal",
7
+ VirtualChain: "virtual_chain",
8
+ InternalTransfer: "internal_transfer"
9
+ };
10
+
11
+ //#endregion
12
+ export { RouteEnum };
@@ -0,0 +1,68 @@
1
+ const require_route_enum = require('./route-enum.cjs');
2
+
3
+ //#region src/constants/withdrawal-timing.ts
4
+ const HOT_EXTRA_TIMEOUT_MS = 720 * 1e3;
5
+ /**
6
+ * Withdrawal timing p99 values (in seconds) by CAIP-2 chain identifier.
7
+ * Used to derive CompletionStats for chain-aware polling.
8
+ */
9
+ const WITHDRAWAL_P99_BY_CHAIN = {
10
+ "eip155:1": 1852,
11
+ "eip155:56": 36,
12
+ "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": 1387,
13
+ "eip155:8453": 651,
14
+ "tron:27Lqcw": 2358,
15
+ "eip155:42161": 928,
16
+ "bip122:000000000019d6689c085ae165831e93": 3656,
17
+ "eip155:137": 410,
18
+ "xrpl:0": 2276,
19
+ "bip122:00040fe8ec8471911baa1db1266ea15d": 2093,
20
+ "tvm:-239": 53,
21
+ "near:mainnet": 356,
22
+ "bip122:12a765e31ffd4059bada1e25190f6e98": 2385,
23
+ "eip155:143": 22,
24
+ "eip155:43114": 657,
25
+ "stellar:pubnet": 50,
26
+ "eip155:10": 23,
27
+ "bip122:1a91e3dace36e2be3bf030a65679fe82": 1970,
28
+ "sui:mainnet": 752,
29
+ "eip155:80085": 579,
30
+ "eip155:100": 3308,
31
+ "aptos:mainnet": 394,
32
+ "cip34:1-764824073": 807
33
+ };
34
+ /**
35
+ * Default stats for chains without timing data.
36
+ * Conservative 6-hour timeout (3x 2-hour p99) with gradual phase transitions.
37
+ */
38
+ const DEFAULT_WITHDRAWAL_STATS = {
39
+ p50: 6e4,
40
+ p90: 6e5,
41
+ p99: 216e5
42
+ };
43
+ /**
44
+ * Returns CompletionStats for the given chain and bridge.
45
+ * Derives p50/p90 from p99 using reasonable ratios with minimum floors.
46
+ * Timeout (p99 field) is set to 3x of the actual p99, with extra 12 minutes for HOT bridge.
47
+ */
48
+ function getWithdrawalStatsForChain(options) {
49
+ const p99Seconds = WITHDRAWAL_P99_BY_CHAIN[options.chain];
50
+ if (p99Seconds == null) {
51
+ const extraTimeout$1 = options.bridgeRoute === require_route_enum.RouteEnum.HotBridge ? HOT_EXTRA_TIMEOUT_MS : 0;
52
+ return {
53
+ ...DEFAULT_WITHDRAWAL_STATS,
54
+ p99: DEFAULT_WITHDRAWAL_STATS.p99 + extraTimeout$1
55
+ };
56
+ }
57
+ const p99 = p99Seconds * 1e3;
58
+ const timeout = p99 * 3;
59
+ const extraTimeout = options.bridgeRoute === require_route_enum.RouteEnum.HotBridge ? HOT_EXTRA_TIMEOUT_MS : 0;
60
+ return {
61
+ p50: Math.max(5e3, p99 * .15),
62
+ p90: Math.max(3e4, p99 * .5),
63
+ p99: timeout + extraTimeout
64
+ };
65
+ }
66
+
67
+ //#endregion
68
+ exports.getWithdrawalStatsForChain = getWithdrawalStatsForChain;
@@ -0,0 +1,68 @@
1
+ import { RouteEnum } from "./route-enum.js";
2
+
3
+ //#region src/constants/withdrawal-timing.ts
4
+ const HOT_EXTRA_TIMEOUT_MS = 720 * 1e3;
5
+ /**
6
+ * Withdrawal timing p99 values (in seconds) by CAIP-2 chain identifier.
7
+ * Used to derive CompletionStats for chain-aware polling.
8
+ */
9
+ const WITHDRAWAL_P99_BY_CHAIN = {
10
+ "eip155:1": 1852,
11
+ "eip155:56": 36,
12
+ "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": 1387,
13
+ "eip155:8453": 651,
14
+ "tron:27Lqcw": 2358,
15
+ "eip155:42161": 928,
16
+ "bip122:000000000019d6689c085ae165831e93": 3656,
17
+ "eip155:137": 410,
18
+ "xrpl:0": 2276,
19
+ "bip122:00040fe8ec8471911baa1db1266ea15d": 2093,
20
+ "tvm:-239": 53,
21
+ "near:mainnet": 356,
22
+ "bip122:12a765e31ffd4059bada1e25190f6e98": 2385,
23
+ "eip155:143": 22,
24
+ "eip155:43114": 657,
25
+ "stellar:pubnet": 50,
26
+ "eip155:10": 23,
27
+ "bip122:1a91e3dace36e2be3bf030a65679fe82": 1970,
28
+ "sui:mainnet": 752,
29
+ "eip155:80085": 579,
30
+ "eip155:100": 3308,
31
+ "aptos:mainnet": 394,
32
+ "cip34:1-764824073": 807
33
+ };
34
+ /**
35
+ * Default stats for chains without timing data.
36
+ * Conservative 6-hour timeout (3x 2-hour p99) with gradual phase transitions.
37
+ */
38
+ const DEFAULT_WITHDRAWAL_STATS = {
39
+ p50: 6e4,
40
+ p90: 6e5,
41
+ p99: 216e5
42
+ };
43
+ /**
44
+ * Returns CompletionStats for the given chain and bridge.
45
+ * Derives p50/p90 from p99 using reasonable ratios with minimum floors.
46
+ * Timeout (p99 field) is set to 3x of the actual p99, with extra 12 minutes for HOT bridge.
47
+ */
48
+ function getWithdrawalStatsForChain(options) {
49
+ const p99Seconds = WITHDRAWAL_P99_BY_CHAIN[options.chain];
50
+ if (p99Seconds == null) {
51
+ const extraTimeout$1 = options.bridgeRoute === RouteEnum.HotBridge ? HOT_EXTRA_TIMEOUT_MS : 0;
52
+ return {
53
+ ...DEFAULT_WITHDRAWAL_STATS,
54
+ p99: DEFAULT_WITHDRAWAL_STATS.p99 + extraTimeout$1
55
+ };
56
+ }
57
+ const p99 = p99Seconds * 1e3;
58
+ const timeout = p99 * 3;
59
+ const extraTimeout = options.bridgeRoute === RouteEnum.HotBridge ? HOT_EXTRA_TIMEOUT_MS : 0;
60
+ return {
61
+ p50: Math.max(5e3, p99 * .15),
62
+ p90: Math.max(3e4, p99 * .5),
63
+ p99: timeout + extraTimeout
64
+ };
65
+ }
66
+
67
+ //#endregion
68
+ export { getWithdrawalStatsForChain };
@@ -0,0 +1,86 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_withdrawal_timing = require('../constants/withdrawal-timing.cjs');
3
+ let lampamazaza_internal_utils = require("lampamazaza-internal-utils");
4
+
5
+ //#region src/core/withdrawal-watcher.ts
6
+ const MAX_CONSECUTIVE_ERRORS = 3;
7
+ async function watchWithdrawal(args) {
8
+ const stats = require_withdrawal_timing.getWithdrawalStatsForChain({
9
+ chain: args.wid.landingChain,
10
+ bridgeRoute: args.bridge.route
11
+ });
12
+ let consecutiveErrors = 0;
13
+ try {
14
+ return await (0, lampamazaza_internal_utils.poll)(async () => {
15
+ try {
16
+ const status = await args.bridge.describeWithdrawal({
17
+ ...args.wid,
18
+ logger: args.logger
19
+ });
20
+ consecutiveErrors = 0;
21
+ if (status.status === "completed") return status.txHash != null ? { hash: status.txHash } : { hash: null };
22
+ if (status.status === "failed") throw new WithdrawalFailedError(status.reason);
23
+ return lampamazaza_internal_utils.POLL_PENDING;
24
+ } catch (err) {
25
+ if (err instanceof WithdrawalFailedError) throw err;
26
+ consecutiveErrors++;
27
+ if (consecutiveErrors >= MAX_CONSECUTIVE_ERRORS) throw new WithdrawalWatchError(err);
28
+ args.logger?.warn(`Transient error (${consecutiveErrors}/${MAX_CONSECUTIVE_ERRORS}): ${err}`);
29
+ return lampamazaza_internal_utils.POLL_PENDING;
30
+ }
31
+ }, {
32
+ stats,
33
+ signal: args.signal
34
+ });
35
+ } catch (err) {
36
+ if (err instanceof lampamazaza_internal_utils.PollTimeoutError) throw new WithdrawalWatchError(err);
37
+ throw err;
38
+ }
39
+ }
40
+ async function createWithdrawalIdentifiers(args) {
41
+ const indexes = /* @__PURE__ */ new Map();
42
+ const results = [];
43
+ for (const w of args.withdrawalParams) {
44
+ const bridge = await findBridgeForWithdrawal(args.bridges, w);
45
+ if (bridge == null) throw new BridgeNotFoundError();
46
+ const currentIndex = indexes.get(bridge.route) ?? 0;
47
+ indexes.set(bridge.route, currentIndex + 1);
48
+ const wid = bridge.createWithdrawalIdentifier({
49
+ withdrawalParams: w,
50
+ index: currentIndex,
51
+ tx: args.intentTx
52
+ });
53
+ results.push({
54
+ bridge,
55
+ wid
56
+ });
57
+ }
58
+ return results;
59
+ }
60
+ async function findBridgeForWithdrawal(bridges, params) {
61
+ for (const bridge of bridges) if (await bridge.supports(params)) return bridge;
62
+ }
63
+ var BridgeNotFoundError = class extends lampamazaza_internal_utils.BaseError {
64
+ constructor() {
65
+ super("Bridge adapter not found", { name: "BridgeNotFoundError" });
66
+ }
67
+ };
68
+ var WithdrawalFailedError = class extends lampamazaza_internal_utils.BaseError {
69
+ constructor(reason) {
70
+ super(`Withdrawal failed: ${reason}`, { name: "WithdrawalFailedError" });
71
+ }
72
+ };
73
+ var WithdrawalWatchError = class extends lampamazaza_internal_utils.BaseError {
74
+ constructor(cause) {
75
+ super("Withdrawal watch failed", {
76
+ name: "WithdrawalWatchError",
77
+ cause
78
+ });
79
+ }
80
+ };
81
+
82
+ //#endregion
83
+ exports.WithdrawalFailedError = WithdrawalFailedError;
84
+ exports.WithdrawalWatchError = WithdrawalWatchError;
85
+ exports.createWithdrawalIdentifiers = createWithdrawalIdentifiers;
86
+ exports.watchWithdrawal = watchWithdrawal;
@@ -0,0 +1,18 @@
1
+ import { BaseError, ILogger } from "lampamazaza-internal-utils";
2
+
3
+ //#region src/core/withdrawal-watcher.d.ts
4
+
5
+ type WithdrawalFailedErrorType = WithdrawalFailedError & {
6
+ name: "WithdrawalFailedError";
7
+ };
8
+ declare class WithdrawalFailedError extends BaseError {
9
+ constructor(reason: string);
10
+ }
11
+ type WithdrawalWatchErrorType = WithdrawalWatchError & {
12
+ name: "WithdrawalWatchError";
13
+ };
14
+ declare class WithdrawalWatchError extends BaseError {
15
+ constructor(cause: unknown);
16
+ }
17
+ //#endregion
18
+ export { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType };
@@ -0,0 +1,19 @@
1
+ import "../shared-types.js";
2
+ import { BaseError, ILogger } from "lampamazaza-internal-utils";
3
+
4
+ //#region src/core/withdrawal-watcher.d.ts
5
+
6
+ type WithdrawalFailedErrorType = WithdrawalFailedError & {
7
+ name: "WithdrawalFailedError";
8
+ };
9
+ declare class WithdrawalFailedError extends BaseError {
10
+ constructor(reason: string);
11
+ }
12
+ type WithdrawalWatchErrorType = WithdrawalWatchError & {
13
+ name: "WithdrawalWatchError";
14
+ };
15
+ declare class WithdrawalWatchError extends BaseError {
16
+ constructor(cause: unknown);
17
+ }
18
+ //#endregion
19
+ export { WithdrawalFailedError, WithdrawalFailedErrorType, WithdrawalWatchError, WithdrawalWatchErrorType };