@1delta/wnative 0.0.6 → 0.0.7

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/index.js CHANGED
@@ -1,6 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  // src/wnative.ts
4
+ function getWrappedNativeAddress(chainId) {
5
+ const info = WRAPPED_NATIVE_INFO[String(chainId)];
6
+ if (!info) throw new Error(`No wrapped native for chain ${chainId}`);
7
+ return info.address;
8
+ }
9
+ function getWrappedNativeAddressSafe(chainId) {
10
+ return WRAPPED_NATIVE_INFO[String(chainId)]?.address;
11
+ }
12
+ function getWrappedNativeAddressLower(chainId) {
13
+ return getWrappedNativeAddress(chainId).toLowerCase();
14
+ }
4
15
  var WRAPPED_NATIVE_INFO = {
5
16
  "1": {
6
17
  chainId: "1",
@@ -684,3 +695,6 @@ var WRAPPED_NATIVE_INFO = {
684
695
  };
685
696
 
686
697
  exports.WRAPPED_NATIVE_INFO = WRAPPED_NATIVE_INFO;
698
+ exports.getWrappedNativeAddress = getWrappedNativeAddress;
699
+ exports.getWrappedNativeAddressLower = getWrappedNativeAddressLower;
700
+ exports.getWrappedNativeAddressSafe = getWrappedNativeAddressSafe;
package/dist/index.mjs CHANGED
@@ -1,4 +1,15 @@
1
1
  // src/wnative.ts
2
+ function getWrappedNativeAddress(chainId) {
3
+ const info = WRAPPED_NATIVE_INFO[String(chainId)];
4
+ if (!info) throw new Error(`No wrapped native for chain ${chainId}`);
5
+ return info.address;
6
+ }
7
+ function getWrappedNativeAddressSafe(chainId) {
8
+ return WRAPPED_NATIVE_INFO[String(chainId)]?.address;
9
+ }
10
+ function getWrappedNativeAddressLower(chainId) {
11
+ return getWrappedNativeAddress(chainId).toLowerCase();
12
+ }
2
13
  var WRAPPED_NATIVE_INFO = {
3
14
  "1": {
4
15
  chainId: "1",
@@ -681,4 +692,4 @@ var WRAPPED_NATIVE_INFO = {
681
692
  }
682
693
  };
683
694
 
684
- export { WRAPPED_NATIVE_INFO };
695
+ export { WRAPPED_NATIVE_INFO, getWrappedNativeAddress, getWrappedNativeAddressLower, getWrappedNativeAddressSafe };
package/dist/wnative.d.ts CHANGED
@@ -1,2 +1,10 @@
1
1
  import { WrappedNativeInfo } from './types';
2
+ type ChainIdLike = string | number;
3
+ /** Get the wrapped native token address for a chain. Throws if not found. */
4
+ export declare function getWrappedNativeAddress(chainId: ChainIdLike): string;
5
+ /** Get the wrapped native token address for a chain, or undefined if not found. */
6
+ export declare function getWrappedNativeAddressSafe(chainId: ChainIdLike): string | undefined;
7
+ /** Get the wrapped native token address (lowercase) for a chain. Throws if not found. */
8
+ export declare function getWrappedNativeAddressLower(chainId: ChainIdLike): string;
2
9
  export declare const WRAPPED_NATIVE_INFO: WrappedNativeInfo;
10
+ export {};
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.0.6",
7
+ "version": "0.0.7",
8
8
  "description": "Hold wnative currency data",
9
9
  "files": [
10
10
  "dist"
@@ -16,10 +16,9 @@
16
16
  "main": "dist/index.js",
17
17
  "types": "dist/index.d.ts",
18
18
  "module": "dist/index.mjs",
19
- "dependencies": {},
20
19
  "devDependencies": {
21
- "tsup": "^8.5.0",
22
- "typescript": "^5.8.3"
20
+ "tsup": "^8.5.1",
21
+ "typescript": "^5.9.3"
23
22
  },
24
23
  "engines": {
25
24
  "node": ">=20"