@galacticcouncil/xc-sdk 1.2.2 → 1.4.0-pr344-9e041f4

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 (33) hide show
  1. package/build/Wallet.d.ts +17 -1
  2. package/build/index.cjs +4 -4
  3. package/build/index.mjs +4 -4
  4. package/build/platforms/adapter.d.ts +2 -5
  5. package/build/platforms/evm/EvmPlatform.d.ts +2 -5
  6. package/build/platforms/solana/SolanaPlatform.d.ts +2 -5
  7. package/build/platforms/substrate/SubstratePlatform.d.ts +2 -5
  8. package/build/platforms/substrate/SubstrateService.d.ts +1 -2
  9. package/build/platforms/sui/SuiPlatform.d.ts +2 -5
  10. package/build/platforms/types.d.ts +2 -5
  11. package/build/transfer/DataDestinationProcessor.d.ts +10 -0
  12. package/build/transfer/DataOriginProcessor.d.ts +7 -0
  13. package/build/transfer/DataProcessor.d.ts +11 -4
  14. package/build/transfer/index.d.ts +1 -1
  15. package/build/transfer/utils.d.ts +10 -1
  16. package/build/types.d.ts +3 -0
  17. package/package.json +2 -2
  18. package/build/index.mjs.map +0 -7
  19. package/build/platforms/evm/balance/Erc20.d.ts +0 -8
  20. package/build/platforms/evm/balance/EvmBalance.d.ts +0 -10
  21. package/build/platforms/evm/balance/EvmBalanceFactory.d.ts +0 -5
  22. package/build/platforms/evm/balance/Native.d.ts +0 -5
  23. package/build/platforms/evm/balance/index.d.ts +0 -2
  24. package/build/platforms/solana/balance/Native.d.ts +0 -5
  25. package/build/platforms/solana/balance/SolanaBalance.d.ts +0 -11
  26. package/build/platforms/solana/balance/SolanaBalanceFactory.d.ts +0 -6
  27. package/build/platforms/solana/balance/Token.d.ts +0 -9
  28. package/build/platforms/solana/balance/index.d.ts +0 -2
  29. package/build/platforms/sui/balance/Native.d.ts +0 -5
  30. package/build/platforms/sui/balance/SuiBalance.d.ts +0 -11
  31. package/build/platforms/sui/balance/SuiBalanceFactory.d.ts +0 -6
  32. package/build/platforms/sui/balance/index.d.ts +0 -2
  33. package/build/transfer/DataReverseProcessor.d.ts +0 -6
@@ -0,0 +1,10 @@
1
+ import { DataProcessor } from './DataProcessor';
2
+ /**
3
+ * Resolves destination-side transfer data (received balance, minimum,
4
+ * existential deposit) directly from the destination chain.
5
+ *
6
+ * Thin {@link DataProcessor} — its `(chain, asset)` are supplied directly so
7
+ * one-way routes resolve destination data without a reverse `TransferConfig`.
8
+ */
9
+ export declare class DataDestinationProcessor extends DataProcessor {
10
+ }
@@ -1,7 +1,14 @@
1
1
  import { Asset, AssetAmount, TransferCtx, TransferConfig, TransactCtx } from '@galacticcouncil/xc-core';
2
2
  import { Call, PlatformAdapter } from '../platforms';
3
3
  import { DataProcessor } from './DataProcessor';
4
+ /**
5
+ * Resolves origin-side transfer data — balance, minimum and existential
6
+ * deposit (via {@link DataProcessor}) plus the source/destination fee
7
+ * estimates and the transfer {@link Call} — sourcing `(chain, asset)` and the
8
+ * route from its `TransferConfig`.
9
+ */
4
10
  export declare class DataOriginProcessor extends DataProcessor {
11
+ readonly config: TransferConfig;
5
12
  constructor(adapter: PlatformAdapter, config: TransferConfig);
6
13
  getCall(ctx: TransferCtx): Promise<Call>;
7
14
  getDestinationFee(transferAmount?: bigint): Promise<{
@@ -1,12 +1,19 @@
1
- import { Asset, AssetAmount, TransferConfig } from '@galacticcouncil/xc-core';
1
+ import { AnyChain, Asset, AssetAmount } from '@galacticcouncil/xc-core';
2
2
  import { PlatformAdapter } from '../platforms';
3
+ /**
4
+ * Resolves chain-side transfer data (balance, minimum, existential deposit)
5
+ * for a given `(chain, asset)` directly from the chain. Shared by the origin
6
+ * and destination processors — the origin sources `(chain, asset)` from its
7
+ * `TransferConfig`, the destination receives them directly (one-way routes
8
+ * have no reverse config).
9
+ */
3
10
  export declare abstract class DataProcessor {
4
11
  readonly adapter: PlatformAdapter;
5
- readonly config: TransferConfig;
6
- constructor(adapter: PlatformAdapter, config: TransferConfig);
12
+ readonly chain: AnyChain;
13
+ readonly asset: Asset;
14
+ constructor(adapter: PlatformAdapter, chain: AnyChain, asset: Asset);
7
15
  getEd(): Promise<AssetAmount | undefined>;
8
16
  getBalance(address: string): Promise<AssetAmount>;
9
17
  getMin(): Promise<AssetAmount>;
10
- private getAssetMin;
11
18
  protected getDecimals(asset: Asset): Promise<number>;
12
19
  }
@@ -1,3 +1,3 @@
1
1
  export { DataOriginProcessor } from './DataOriginProcessor';
2
- export { DataReverseProcessor } from './DataReverseProcessor';
2
+ export { DataDestinationProcessor } from './DataDestinationProcessor';
3
3
  export * from './utils';
@@ -1,4 +1,4 @@
1
- import { AnyChain, AssetAmount } from '@galacticcouncil/xc-core';
1
+ import { AnyChain, Asset, AssetAmount } from '@galacticcouncil/xc-core';
2
2
  /**
3
3
  * Calculate maximum allowed amount of asset to send from source to
4
4
  * destination chain.
@@ -39,3 +39,12 @@ export declare function formatEvmAddress(address: string, chain: AnyChain): Prom
39
39
  * @returns formatted amount or 0
40
40
  */
41
41
  export declare function formatAmount(decimals: number, amount?: number): bigint;
42
+ /**
43
+ * Resolve decimals for an asset on a given chain, falling back to the chain
44
+ * native currency decimals when the asset has no chain-specific override.
45
+ *
46
+ * @param chain - chain the asset is read on
47
+ * @param asset - asset to resolve decimals for
48
+ * @returns asset decimals
49
+ */
50
+ export declare function getDecimals(chain: AnyChain, asset: Asset): Promise<number>;
package/build/types.d.ts CHANGED
@@ -41,10 +41,13 @@ export interface TransferDestinationData {
41
41
  * @interface Transfer
42
42
  * @member {TransferSourceData} source Source chain data
43
43
  * @member {TransferDestinationData} destination Destination chain data
44
+ * @member {boolean} reversible True if a return-trip route is registered.
45
+ * Consumers may use this to gate UI affordances (swap-direction button, etc.).
44
46
  */
45
47
  export interface Transfer {
46
48
  source: TransferSourceData;
47
49
  destination: TransferDestinationData;
50
+ reversible: boolean;
48
51
  buildCall(amount: bigint | number | string): Promise<Call>;
49
52
  estimateFee(amount: bigint | number | string): Promise<AssetAmount>;
50
53
  estimateDestinationFee(amount: bigint | number | string): Promise<AssetAmount>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacticcouncil/xc-sdk",
3
- "version": "1.2.2",
3
+ "version": "1.4.0-pr344-9e041f4",
4
4
  "description": "Cross-chain sdk",
5
5
  "author": "GalacticCouncil",
6
6
  "type": "module",
@@ -33,6 +33,6 @@
33
33
  "link": "npm ln"
34
34
  },
35
35
  "dependencies": {
36
- "@galacticcouncil/xc-core": "^1.2.1"
36
+ "@galacticcouncil/xc-core": "1.4.0-pr344-9e041f4"
37
37
  }
38
38
  }