@across-protocol/sdk 4.3.143-alpha.1 → 4.3.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/caching/Arweave/ArweaveClient.d.ts +6 -11
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js +79 -102
- package/dist/cjs/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.js +31 -13
- package/dist/cjs/src/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/esm/src/caching/Arweave/ArweaveClient.d.ts +8 -21
- package/dist/esm/src/caching/Arweave/ArweaveClient.js +89 -119
- package/dist/esm/src/caching/Arweave/ArweaveClient.js.map +1 -1
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.js +29 -11
- package/dist/esm/src/clients/BundleDataClient/utils/SuperstructUtils.js.map +1 -1
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts +8 -21
- package/dist/types/src/caching/Arweave/ArweaveClient.d.ts.map +1 -1
- package/dist/types/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts +64 -63
- package/dist/types/src/clients/BundleDataClient/utils/SuperstructUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/caching/Arweave/ArweaveClient.ts +88 -134
- package/src/clients/BundleDataClient/utils/SuperstructUtils.ts +26 -12
|
@@ -14,8 +14,12 @@ import {
|
|
|
14
14
|
union,
|
|
15
15
|
type,
|
|
16
16
|
} from "superstruct";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
17
|
+
import { utils as ethersUtils } from "ethers";
|
|
18
|
+
import { isAddress as isValidEvmAddress } from "viem";
|
|
19
|
+
import { isAddress as isValidSvmAddress } from "@solana/kit";
|
|
20
|
+
import { TronWeb } from "tronweb";
|
|
21
|
+
import { UNDEFINED_MESSAGE_HASH } from "../../../constants";
|
|
22
|
+
import { BigNumber, bs58, EvmAddress, RawAddress, SvmAddress, TvmAddress, toBytes32 } from "../../../utils";
|
|
19
23
|
|
|
20
24
|
const PositiveIntegerStringSS = pattern(string(), /\d+/);
|
|
21
25
|
const Web3AddressSS = pattern(string(), /^0x[a-fA-F0-9]{64}$/);
|
|
@@ -31,16 +35,26 @@ const BigNumberType = coerce(instance(BigNumber), union([string(), number()]), (
|
|
|
31
35
|
}
|
|
32
36
|
});
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const AddressInstanceSS = union([
|
|
39
|
+
instance(EvmAddress),
|
|
40
|
+
instance(SvmAddress),
|
|
41
|
+
instance(TvmAddress),
|
|
42
|
+
instance(RawAddress),
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
export const AddressType = coerce(AddressInstanceSS, string(), (value) => {
|
|
46
|
+
// Each family is matched by its native-format validator plus a length gate where it
|
|
47
|
+
// disambiguates. Unknown shapes fall to `RawAddress`, forcing future families into explicit
|
|
48
|
+
// branches rather than being absorbed silently.
|
|
49
|
+
try {
|
|
50
|
+
// strict: false preserves the prior byte-level acceptance of all-upper / non-checksummed hex.
|
|
51
|
+
if (value.length === 42 && isValidEvmAddress(value, { strict: false })) return EvmAddress.from(value);
|
|
52
|
+
if (value.length === 34 && TronWeb.isAddress(value)) return TvmAddress.from(value);
|
|
53
|
+
if (isValidSvmAddress(value)) return SvmAddress.from(value);
|
|
54
|
+
} catch {
|
|
55
|
+
// Validator accepted but `from()` rejected (e.g. SVM 12-zero EVM-masquerade) → RawAddress.
|
|
56
|
+
}
|
|
57
|
+
return new RawAddress(value.startsWith("0x") ? ethersUtils.arrayify(value) : bs58.decode(value));
|
|
44
58
|
});
|
|
45
59
|
|
|
46
60
|
const Web3AddressType = coerce(Web3AddressSS, string(), (value) => {
|