@defuse-protocol/intents-sdk 0.76.0 → 0.78.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.
@@ -68,7 +68,8 @@ const CHAIN_MAPPINGS = [
68
68
  [require_caip2.Chains.Starknet, _omni_bridge_core.ChainKind.Strk],
69
69
  [require_caip2.Chains.Fogo, _omni_bridge_core.ChainKind.Fogo],
70
70
  [require_caip2.Chains.Polygon, _omni_bridge_core.ChainKind.Pol],
71
- [require_caip2.Chains.Aptos, _omni_bridge_core.ChainKind.Aptos]
71
+ [require_caip2.Chains.Aptos, _omni_bridge_core.ChainKind.Aptos],
72
+ [require_caip2.Chains.HyperEvm, _omni_bridge_core.ChainKind.HyperEvm]
72
73
  ];
73
74
  function caip2ToChainKind(network) {
74
75
  return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
@@ -100,7 +101,7 @@ async function getAccountOmniStorageBalance(nearProvider, accountId) {
100
101
  })])
101
102
  });
102
103
  }
103
- const OmniAddressSchema = valibot.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:") || input.startsWith("aptos:")), "Must comply with omni address schema");
104
+ const OmniAddressSchema = valibot.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:") || input.startsWith("aptos:") || input.startsWith("hlevm:")), "Must comply with omni address schema");
104
105
  /**
105
106
  * Converts a token address from one chain to its equivalent on another chain.
106
107
  * @param nearProvider Near provider used for querying the contract
@@ -66,7 +66,8 @@ const CHAIN_MAPPINGS = [
66
66
  [Chains.Starknet, ChainKind.Strk],
67
67
  [Chains.Fogo, ChainKind.Fogo],
68
68
  [Chains.Polygon, ChainKind.Pol],
69
- [Chains.Aptos, ChainKind.Aptos]
69
+ [Chains.Aptos, ChainKind.Aptos],
70
+ [Chains.HyperEvm, ChainKind.HyperEvm]
70
71
  ];
71
72
  function caip2ToChainKind(network) {
72
73
  return CHAIN_MAPPINGS.find(([chain]) => chain === network)?.[1] ?? null;
@@ -98,7 +99,7 @@ async function getAccountOmniStorageBalance(nearProvider, accountId) {
98
99
  })])
99
100
  });
100
101
  }
101
- const OmniAddressSchema = v.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:") || input.startsWith("aptos:")), "Must comply with omni address schema");
102
+ const OmniAddressSchema = v.custom((input) => typeof input === "string" && (input.startsWith("eth:") || input.startsWith("near:") || input.startsWith("sol:") || input.startsWith("arb:") || input.startsWith("base:") || input.startsWith("btc:") || input.startsWith("bnb:") || input.startsWith("abs:") || input.startsWith("strk:") || input.startsWith("fogo:") || input.startsWith("pol:") || input.startsWith("aptos:") || input.startsWith("hlevm:")), "Must comply with omni address schema");
102
103
  /**
103
104
  * Converts a token address from one chain to its equivalent on another chain.
104
105
  * @param nearProvider Near provider used for querying the contract
@@ -40,7 +40,8 @@ const Chains = {
40
40
  Aleo: "aleo:0",
41
41
  Dash: "bip122:00000ffd590b1485b3caadc19b22e637",
42
42
  Abstract: "eip155:2741",
43
- HyperCore: "hlcore:mainnet"
43
+ HyperCore: "hlcore:mainnet",
44
+ HyperEvm: "eip155:999"
44
45
  };
45
46
  function getEIP155ChainId(chain) {
46
47
  (0, _defuse_protocol_internal_utils.assert)(chain.startsWith("eip155:"), "Chain is not an EIP-155 chain");
@@ -38,6 +38,7 @@ declare const Chains: {
38
38
  readonly Dash: "bip122:00000ffd590b1485b3caadc19b22e637";
39
39
  readonly Abstract: "eip155:2741";
40
40
  readonly HyperCore: "hlcore:mainnet";
41
+ readonly HyperEvm: "eip155:999";
41
42
  };
42
43
  type Chain = (typeof Chains)[keyof typeof Chains];
43
44
  //#endregion
@@ -38,6 +38,7 @@ declare const Chains: {
38
38
  readonly Dash: "bip122:00000ffd590b1485b3caadc19b22e637";
39
39
  readonly Abstract: "eip155:2741";
40
40
  readonly HyperCore: "hlcore:mainnet";
41
+ readonly HyperEvm: "eip155:999";
41
42
  };
42
43
  type Chain = (typeof Chains)[keyof typeof Chains];
43
44
  //#endregion
@@ -39,7 +39,8 @@ const Chains = {
39
39
  Aleo: "aleo:0",
40
40
  Dash: "bip122:00000ffd590b1485b3caadc19b22e637",
41
41
  Abstract: "eip155:2741",
42
- HyperCore: "hlcore:mainnet"
42
+ HyperCore: "hlcore:mainnet",
43
+ HyperEvm: "eip155:999"
43
44
  };
44
45
  function getEIP155ChainId(chain) {
45
46
  assert(chain.startsWith("eip155:"), "Chain is not an EIP-155 chain");
@@ -5,7 +5,6 @@ let _defuse_protocol_internal_utils = require("@defuse-protocol/internal-utils")
5
5
  let viem = require("viem");
6
6
  let _noble_hashes_sha2 = require("@noble/hashes/sha2");
7
7
  let _scure_base = require("@scure/base");
8
- let _solana_web3_js = require("@solana/web3.js");
9
8
  let ripple_address_codec = require("ripple-address-codec");
10
9
 
11
10
  //#region src/lib/validateAddress.ts
@@ -50,7 +49,8 @@ function validateAddress(address, blockchain) {
50
49
  case require_caip2.Chains.Plasma:
51
50
  case require_caip2.Chains.Scroll:
52
51
  case require_caip2.Chains.Abstract:
53
- case require_caip2.Chains.HyperCore: return validateEthAddress(address);
52
+ case require_caip2.Chains.HyperCore:
53
+ case require_caip2.Chains.HyperEvm: return validateEthAddress(address);
54
54
  case require_caip2.Chains.Aleo: return validateAleoAddress(address);
55
55
  case require_caip2.Chains.Dash: return validateDashAddress(address);
56
56
  default: return false;
@@ -180,7 +180,8 @@ function verifyBchChecksum(address) {
180
180
  }
181
181
  function validateSolAddress(address) {
182
182
  try {
183
- return _solana_web3_js.PublicKey.isOnCurve(address);
183
+ if (_scure_base.base58.decode(address).length !== 32) return false;
184
+ return true;
184
185
  } catch {
185
186
  return false;
186
187
  }
@@ -4,7 +4,6 @@ import { utils } from "@defuse-protocol/internal-utils";
4
4
  import { isAddress } from "viem";
5
5
  import { sha256 } from "@noble/hashes/sha2";
6
6
  import { base58, bech32, bech32m, hex } from "@scure/base";
7
- import { PublicKey } from "@solana/web3.js";
8
7
  import { isValidClassicAddress, isValidXAddress } from "ripple-address-codec";
9
8
 
10
9
  //#region src/lib/validateAddress.ts
@@ -49,7 +48,8 @@ function validateAddress(address, blockchain) {
49
48
  case Chains.Plasma:
50
49
  case Chains.Scroll:
51
50
  case Chains.Abstract:
52
- case Chains.HyperCore: return validateEthAddress(address);
51
+ case Chains.HyperCore:
52
+ case Chains.HyperEvm: return validateEthAddress(address);
53
53
  case Chains.Aleo: return validateAleoAddress(address);
54
54
  case Chains.Dash: return validateDashAddress(address);
55
55
  default: return false;
@@ -179,7 +179,8 @@ function verifyBchChecksum(address) {
179
179
  }
180
180
  function validateSolAddress(address) {
181
181
  try {
182
- return PublicKey.isOnCurve(address);
182
+ if (base58.decode(address).length !== 32) return false;
183
+ return true;
183
184
  } catch {
184
185
  return false;
185
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defuse-protocol/intents-sdk",
3
- "version": "0.76.0",
3
+ "version": "0.78.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "repository": {
@@ -42,15 +42,14 @@
42
42
  "@omni-bridge/near": "0.16.0",
43
43
  "@noble/hashes": "^1.7.1",
44
44
  "@scure/base": "^1.0.0",
45
- "@solana/web3.js": "^1.0.0",
46
45
  "borsher": "^4.0.0",
47
46
  "lru-cache": "^11",
48
47
  "near-api-js": "^4.0.0 || ^5.0.0",
49
48
  "ripple-address-codec": "^5.0.0",
50
49
  "valibot": "^1.0.0",
51
50
  "viem": "^2.0.0",
52
- "@defuse-protocol/contract-types": "0.6.4",
53
- "@defuse-protocol/internal-utils": "0.35.2"
51
+ "@defuse-protocol/internal-utils": "0.35.2",
52
+ "@defuse-protocol/contract-types": "0.6.4"
54
53
  },
55
54
  "devDependencies": {
56
55
  "@ton/core": "^0.60.0",