@sodax/types 2.0.0-rc.1 → 2.0.0-rc.3

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/README.md CHANGED
@@ -1,54 +1,68 @@
1
- # @sodax/wallet-types
1
+ # @sodax/types
2
2
 
3
- Wallet connectivity type definitions for the SODAX multi-chain ecosystem.
3
+ Shared SODAX type definitions, constants, and configuration for SDK packages and applications.
4
4
 
5
- Provides `WalletProvider` interfaces and chain-specific transaction types for 9 blockchain families. Self-contained with **zero external dependencies**.
5
+ This package includes chain and token metadata, wallet provider interfaces, transaction and receipt types, backend API contracts, swap and money market configuration, DEX configuration, and common utilities.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- pnpm add @sodax/wallet-types
10
+ pnpm add @sodax/types
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
- Import everything from the root:
15
+ Import shared types, constants, configuration, and helpers from the root package:
16
16
 
17
17
  ```typescript
18
- import type { WalletAddressProvider, IBitcoinWalletProvider } from '@sodax/wallet-types';
18
+ import {
19
+ ChainKeys,
20
+ CONFIG_VERSION,
21
+ getEvmChainKeyByChainId,
22
+ sodaxConfig,
23
+ supportedTokensByChain,
24
+ } from '@sodax/types';
25
+
26
+ import type {
27
+ Address,
28
+ DeepPartial,
29
+ EvmRawTransaction,
30
+ IBitcoinWalletProvider,
31
+ IEvmWalletProvider,
32
+ IWalletProvider,
33
+ SpokeChainKey,
34
+ WalletAddressProvider,
35
+ } from '@sodax/types';
19
36
  ```
20
37
 
21
- Or import only the chain you need via sub-package exports:
38
+ DEX types and constants are also available from the dedicated DEX subpath export:
22
39
 
23
40
  ```typescript
24
- import type { IEvmWalletProvider, EvmRawTransaction } from '@sodax/wallet-types/evm';
25
- import type { ISolanaWalletProvider } from '@sodax/wallet-types/solana';
26
- import type { IBitcoinWalletProvider, UTXO } from '@sodax/wallet-types/bitcoin';
27
- import type { IIconWalletProvider } from '@sodax/wallet-types/icon';
28
- import type { INearWalletProvider } from '@sodax/wallet-types/near';
29
- import type { IStellarWalletProvider } from '@sodax/wallet-types/stellar';
30
- import type { ISuiWalletProvider } from '@sodax/wallet-types/sui';
31
- import type { IInjectiveWalletProvider } from '@sodax/wallet-types/injective';
32
- import type { IStacksWalletProvider } from '@sodax/wallet-types/stacks';
41
+ import { concentratedLiquidityConfig, dexConfig } from '@sodax/types/dex';
42
+
43
+ import type { ConcentratedLiquidityConfig, DexConfig, PoolKey } from '@sodax/types/dex';
33
44
  ```
34
45
 
35
- ## Supported Chains
46
+ The package currently exposes only the root export (`@sodax/types`) and the DEX export (`@sodax/types/dex`). Chain-specific types such as `IEvmWalletProvider`, `BitcoinRawTransaction`, and `SolanaRawTransactionReceipt` are available from the root package.
47
+
48
+ ## Export Overview
36
49
 
37
- | Chain | Sub-import | Wallet Provider Interface |
38
- | --- | --- | --- |
39
- | EVM (Sonic, Ethereum, Arbitrum, …) | `@sodax/wallet-types/evm` | `IEvmWalletProvider` |
40
- | Bitcoin | `@sodax/wallet-types/bitcoin` | `IBitcoinWalletProvider` |
41
- | Solana | `@sodax/wallet-types/solana` | `ISolanaWalletProvider` |
42
- | Stellar | `@sodax/wallet-types/stellar` | `IStellarWalletProvider` |
43
- | Sui | `@sodax/wallet-types/sui` | `ISuiWalletProvider` |
44
- | ICON | `@sodax/wallet-types/icon` | `IIconWalletProvider` |
45
- | Injective | `@sodax/wallet-types/injective` | `IInjectiveWalletProvider` |
46
- | NEAR | `@sodax/wallet-types/near` | `INearWalletProvider` |
47
- | Stacks | `@sodax/wallet-types/stacks` | `IStacksWalletProvider` |
50
+ | Area | Examples |
51
+ | --- | --- |
52
+ | Shared primitives | `Address`, `Hex`, `Hash`, `Base64String`, `HttpUrl`, `TxPollingConfig` |
53
+ | Common types and constants | `Result`, `PartnerFee`, `TxReturnType`, `apiConfig`, `solverConfig`, retry and timeout constants |
54
+ | Chains and tokens | `ChainKeys`, `SpokeChainKey`, `ChainType`, `baseChainInfo`, `spokeChainConfig` [^cfg], `supportedTokensByChain` |
55
+ | Wallet providers | `WalletAddressProvider`, `ICoreWallet`, `IWalletProvider`, `GetWalletProviderType` |
56
+ | Chain transaction types | `EvmRawTransaction`, `BitcoinRawTransaction`, `SolanaRawTransaction`, `StellarRawTransaction`, `SuiRawTransaction`, `IconRawTransaction`, `InjectiveRawTransaction`, `NearRawTransaction`, `StacksRawTransaction` |
57
+ | Backend API contracts | `IConfigApi`, `GetAllConfigApiResponse`, `SubmitSwapTxRequest`, `SubmitSwapTxResponse`, `SubmitSwapTxStatusResponse` |
58
+ | Product configuration | `sodaxConfig` [^cfg], `bridgeConfig`, `swapsConfig`, `moneyMarketConfig`, `dexConfig`, `concentratedLiquidityConfig` |
59
+ | Utilities | `DeepPartial`, `getChainType`, `getEvmChainKeyByChainId`, chain guard helpers, bnUSD token helpers |
48
60
 
49
- ## Base Interface
61
+ [^cfg]: `spokeChainConfig` and `sodaxConfig` (and the related `hubConfig`, etc.) are **packaged-default snapshots** frozen at SDK release time. They are safe to import at module scope, but **direct imports do NOT reflect overrides passed to `new Sodax(config)` or dynamic config loaded by `sodax.config.initialize()`** — those flow into the `ConfigService` only. Once a `Sodax` instance exists, prefer the instance-scope readers: `sodax.config.spokeChainConfig`, `sodax.config.getChainConfig(chainKey)`, `sodax.config.sodaxConfig`, `sodax.config.getHubChainConfig()`, etc. Mixing a static import with a custom-configured `Sodax` instance will silently fall back to defaults for any chain you customized.
50
62
 
51
- All wallet providers extend `WalletAddressProvider`:
63
+ ## Wallet Providers
64
+
65
+ All wallet providers extend the base wallet address contract:
52
66
 
53
67
  ```typescript
54
68
  interface WalletAddressProvider {
@@ -57,4 +71,28 @@ interface WalletAddressProvider {
57
71
  }
58
72
  ```
59
73
 
60
- Each chain-specific provider adds its own signing, transaction, and query methods.
74
+ `ICoreWallet` extends `WalletAddressProvider`, and each chain-specific provider adds its own signing, transaction, and query methods. The root export includes provider interfaces for all supported chain families:
75
+
76
+ | Chain family | Provider interface |
77
+ | --- | --- |
78
+ | EVM | `IEvmWalletProvider` |
79
+ | Bitcoin | `IBitcoinWalletProvider` |
80
+ | Solana | `ISolanaWalletProvider` |
81
+ | Stellar | `IStellarWalletProvider` |
82
+ | Sui | `ISuiWalletProvider` |
83
+ | ICON | `IIconWalletProvider` |
84
+ | Injective | `IInjectiveWalletProvider` |
85
+ | NEAR | `INearWalletProvider` |
86
+ | Stacks | `IStacksWalletProvider` |
87
+
88
+ Use `IWalletProvider` for the union of all chain-specific wallet providers, or `GetWalletProviderType<C>` to map a `SpokeChainKey` or `ChainType` to the matching provider interface.
89
+
90
+ ```typescript
91
+ import type { GetWalletProviderType, IEvmWalletProvider, IWalletProvider, SpokeChainKey } from '@sodax/types';
92
+
93
+ type ProviderForChain<C extends SpokeChainKey> = GetWalletProviderType<C>;
94
+
95
+ function isEvmProvider(provider: IWalletProvider): provider is IEvmWalletProvider {
96
+ return provider.chainType === 'EVM';
97
+ }
98
+ ```
@@ -1120,7 +1120,7 @@ export declare const spokeChainConfig: {
1120
1120
  readonly walletAddress: "";
1121
1121
  readonly pollingConfig: {
1122
1122
  readonly pollingIntervalMs: 750;
1123
- readonly maxTimeoutMs: 60000;
1123
+ readonly maxTimeoutMs: 15000;
1124
1124
  };
1125
1125
  };
1126
1126
  readonly "0xa86a.avax": {
@@ -363,7 +363,7 @@ export const spokeChainConfig = {
363
363
  walletAddress: '',
364
364
  pollingConfig: {
365
365
  pollingIntervalMs: 750,
366
- maxTimeoutMs: 60_000, // aligns with blockhash expiry timeout.
366
+ maxTimeoutMs: 15_000, // aligns with blockhash expiry timeout.
367
367
  },
368
368
  },
369
369
  [ChainKeys.AVALANCHE_MAINNET]: {
package/dist/index.d.ts CHANGED
@@ -17,5 +17,5 @@ export * from './sui/index.js';
17
17
  export * from './swap/index.js';
18
18
  export * from './utils/index.js';
19
19
  export * from './wallet/index.js';
20
- export declare const CONFIG_VERSION = 200;
20
+ export declare const CONFIG_VERSION = 201;
21
21
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -17,5 +17,5 @@ export * from './sui/index.js';
17
17
  export * from './swap/index.js';
18
18
  export * from './utils/index.js';
19
19
  export * from './wallet/index.js';
20
- export const CONFIG_VERSION = 200; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
20
+ export const CONFIG_VERSION = 201; // this value should be incremented (inside release/sdk branch) each time @sodax/types package is updated
21
21
  //# sourceMappingURL=index.js.map
@@ -661,7 +661,7 @@ export declare const sodaxConfig: {
661
661
  readonly walletAddress: "";
662
662
  readonly pollingConfig: {
663
663
  readonly pollingIntervalMs: 750;
664
- readonly maxTimeoutMs: 60000;
664
+ readonly maxTimeoutMs: 15000;
665
665
  };
666
666
  };
667
667
  readonly "0xa86a.avax": {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "2.0.0-rc.1",
7
+ "version": "2.0.0-rc.3",
8
8
  "description": "Sodax Common Types",
9
9
  "main": "dist/index.js",
10
10
  "homepage": "https://github.com/icon-project/sodax-sdks/tree/main/packages/types",
@@ -15,6 +15,9 @@
15
15
  "type": "git",
16
16
  "url": "https://github.com/icon-project/sodax-sdks"
17
17
  },
18
+ "engines": {
19
+ "node": ">=20.0.0"
20
+ },
18
21
  "files": [
19
22
  "dist"
20
23
  ],