@galacticcouncil/xc-cfg 2.9.0-pr379-bc66401 → 2.9.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.
@@ -0,0 +1,43 @@
1
+ /** Omni bridge (NEAR One) mainnet api. */
2
+ export declare const OMNI_BRIDGE_API = "https://mainnet.api.bridge.nearone.org/api/v3";
3
+ /** NEAR MPC signer withdraw accounts derive under, Ed25519 domain. */
4
+ export declare const OMNI_MPC_SIGNER = "v1.signer";
5
+ export declare const OMNI_MPC_DOMAIN = 1;
6
+ /**
7
+ * NEAR account a failed publish of a deposit refunds to.
8
+ *
9
+ * - The depositor has no NEAR account; the DAO pays them back by hand
10
+ * - Registered on every connector token
11
+ */
12
+ export declare const OMNI_REFUND_TO = "hydration.sputnik-dao.near";
13
+ /** Omni's name of a UTXO chain. */
14
+ export type OmniUtxoChain = 'zcash';
15
+ /**
16
+ * Our withdraw leg of a connector: Hydration → the UTXO chain.
17
+ *
18
+ * - The emitter settles over ntt to a NEAR account derived from the address
19
+ * - The withdraw contract signs that account's withdrawal to the address
20
+ */
21
+ export interface OmniWithdrawal {
22
+ /** `UtxoEmitter` on Hydration. */
23
+ emitter: string;
24
+ /** `UtxoWithdraw` on NEAR, the derivation predecessor. */
25
+ contract: string;
26
+ /** Connector's `min_withdraw_amount`, smallest unit. */
27
+ minWithdraw: bigint;
28
+ /** Miner fee the withdraw contract fixes, smallest unit. */
29
+ minerFee: bigint;
30
+ }
31
+ export interface OmniConnector {
32
+ /** Omni's name of the chain. */
33
+ chain: OmniUtxoChain;
34
+ /** Connector contract on NEAR. */
35
+ account: string;
36
+ /** NEAR token a deposit is minted as. */
37
+ token: string;
38
+ /** Smallest unit; a smaller deposit is neither minted nor refunded. */
39
+ minDeposit: bigint;
40
+ withdrawal: OmniWithdrawal;
41
+ }
42
+ /** Mainnet connectors, by chain key; `minDeposit` mirrors `min_deposit_amount`. */
43
+ export declare const OMNI_CONNECTORS: Record<string, OmniConnector>;
@@ -0,0 +1,2 @@
1
+ export * from './constants';
2
+ export * from './msg';
@@ -0,0 +1,14 @@
1
+ import { AnyChain } from '@galacticcouncil/xc-core';
2
+ /**
3
+ * `msg` of the `ft_transfer_call` Omni's connector makes into a NEAR ntt
4
+ * manager.
5
+ *
6
+ * - Omni derives the deposit address from this exact string
7
+ * - The manager takes the recipient as 32 bytes, an ss58 one derived first
8
+ * - `refund_to` takes a failed publish's refund instead of the connector
9
+ *
10
+ * @param destination - chain the manager publishes to
11
+ * @param address - recipient on the destination
12
+ * @param refundTo - NEAR account a failed publish refunds
13
+ */
14
+ export declare function getDepositMsg(destination: AnyChain, address: string, refundTo: string): Promise<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { Erc20 } from './contracts/Erc20';
2
+ import { Omni } from './contracts/Omni';
2
3
  import { PolkadotXcm } from './contracts/PolkadotXcm';
3
4
  import { Wormhole } from './contracts/Wormhole';
4
5
  export declare function ContractBuilder(): {
@@ -9,6 +10,7 @@ export declare function ContractBuilder(): {
9
10
  Basejump: () => {
10
11
  bridgeViaWormhole: () => import("@galacticcouncil/xc-core").ContractConfigBuilder;
11
12
  };
13
+ Omni: typeof Omni;
12
14
  PolkadotXcm: typeof PolkadotXcm;
13
15
  Snowbridge: () => {
14
16
  v2SendMessage: () => import("@galacticcouncil/xc-core").ContractConfigBuilder;
@@ -0,0 +1,4 @@
1
+ import { Omni } from './deposits/Omni';
2
+ export declare function DepositBuilder(): {
3
+ Omni: typeof Omni;
4
+ };
@@ -1,4 +1,4 @@
1
- import { AnyParachain, FeeAmountConfigBuilder, Parachain } from '@galacticcouncil/xc-core';
1
+ import { AnyParachain, FeeAmountConfigBuilder, NearChain, Parachain } from '@galacticcouncil/xc-core';
2
2
  type SendFeeOpts = {
3
3
  hub: Parachain;
4
4
  };
@@ -30,8 +30,20 @@ declare function Wormhole(): {
30
30
  declare function Basejump(): {
31
31
  quoteFee: () => FeeAmountConfigBuilder;
32
32
  };
33
+ declare function Omni(): {
34
+ /**
35
+ * Cut of a withdrawal to a UTXO chain, out of what lands.
36
+ *
37
+ * - Emitter fee, kept on the source for the bots' NEAR gas
38
+ * - Omni's bridge fee and the miner fee, taken on the way out
39
+ *
40
+ * @param hub - NEAR chain the transfer settles on
41
+ */
42
+ withdrawFee: (hub: NearChain) => FeeAmountConfigBuilder;
43
+ };
33
44
  export declare function FeeAmountBuilder(): {
34
45
  Basejump: typeof Basejump;
46
+ Omni: typeof Omni;
35
47
  XcmPaymentApi: typeof XcmPaymentApi;
36
48
  Snowbridge: typeof Snowbridge;
37
49
  Wormhole: typeof Wormhole;
@@ -0,0 +1,4 @@
1
+ import { ContractConfigBuilder, NearChain } from '@galacticcouncil/xc-core';
2
+ export declare const UtxoEmitter: () => {
3
+ send: (hub: NearChain) => ContractConfigBuilder;
4
+ };
@@ -0,0 +1,5 @@
1
+ export declare function Omni(): {
2
+ UtxoEmitter: () => {
3
+ send: (hub: import("@galacticcouncil/xc-core").NearChain) => import("@galacticcouncil/xc-core").ContractConfigBuilder;
4
+ };
5
+ };
@@ -0,0 +1,4 @@
1
+ import { DepositConfigBuilder, NearChain } from '@galacticcouncil/xc-core';
2
+ export declare const Ntt: () => {
3
+ transfer: (hub: NearChain) => DepositConfigBuilder;
4
+ };
@@ -0,0 +1,5 @@
1
+ export declare function Omni(): {
2
+ Ntt: () => {
3
+ transfer: (hub: import("@galacticcouncil/xc-core").NearChain) => import("@galacticcouncil/xc-core").DepositConfigBuilder;
4
+ };
5
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './ContractBuilder';
2
+ export * from './DepositBuilder';
2
3
  export * from './ExtrinsicBuilder';
3
4
  export * from './FeeAmountBuilder';
4
5
  export * from './FeeAssetBuilder';
@@ -1,4 +1,5 @@
1
1
  export * from './base';
2
2
  export * from './chain';
3
3
  export * from './ntt';
4
+ export * from './omni';
4
5
  export * from './wormhole';
@@ -0,0 +1,72 @@
1
+ import { AnyChain, NearChain } from '@galacticcouncil/xc-core';
2
+ import { OmniConnector } from '../../bridges/omni';
3
+ /** Connector's `get_config` view, raw. */
4
+ export interface OmniConnectorConfig {
5
+ min_deposit_amount: string;
6
+ min_withdraw_amount: string;
7
+ refund_timelock_sec: number;
8
+ withdraw_bridge_fee: {
9
+ fee_min: string;
10
+ fee_rate: number;
11
+ };
12
+ }
13
+ /** Order Omni derives the deposit address from. */
14
+ export interface OmniDepositOrder {
15
+ /** NEAR account the deposit is delivered to. */
16
+ recipient: string;
17
+ /** `ft_transfer_call` msg, byte for byte. */
18
+ msg: string;
19
+ /** Source chain address a refused deposit is refunded to. */
20
+ refundAddress: string;
21
+ }
22
+ /**
23
+ * Omni connector of a UTXO chain, over the mainnet api and the NEAR hub.
24
+ *
25
+ * - Registers orders with `skip_tx`, leaving no public NEAR record
26
+ * - Returns an address only once the connector's own view derives it
27
+ * - Caches deposit addresses and withdraw accounts; a failed one is retried
28
+ */
29
+ export declare class OmniClient {
30
+ readonly source: AnyChain;
31
+ readonly hub: NearChain;
32
+ readonly connector: OmniConnector;
33
+ private readonly timeoutMs;
34
+ private readonly addresses;
35
+ private readonly accounts;
36
+ /**
37
+ * @param source - UTXO chain deposits are paid on
38
+ * @param hub - NEAR chain the connector is read from
39
+ * @param timeoutMs - per request timeout
40
+ */
41
+ constructor(source: AnyChain, hub: NearChain, timeoutMs?: number);
42
+ /** Live connector config. */
43
+ getConfig(): Promise<OmniConnectorConfig>;
44
+ /**
45
+ * Deposit address of the order.
46
+ *
47
+ * @param order - recipient, msg and refund address
48
+ */
49
+ getDepositAddress(order: OmniDepositOrder): Promise<string>;
50
+ /**
51
+ * NEAR account a withdrawal to `address` settles to.
52
+ *
53
+ * - The withdraw contract's `path_of`, then the MPC signer's key under it
54
+ * - Implicit: the account id is the key's hex
55
+ * - One address, one account, permanently
56
+ *
57
+ * @param address - destination on the UTXO chain, already valid
58
+ */
59
+ getWithdrawAccount(address: string): Promise<string>;
60
+ /**
61
+ * What Omni takes from a withdrawal on its way out, smallest unit.
62
+ *
63
+ * - Bridge fee, the connector's own formula: `max(amount × rate, min)`
64
+ * - Miner fee the withdraw contract fixes
65
+ *
66
+ * @param amount - landing on NEAR, smallest unit
67
+ */
68
+ getWithdrawFee(amount: bigint): Promise<bigint>;
69
+ private view;
70
+ private register;
71
+ private resolve;
72
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { AnyChain, NearChain } from '@galacticcouncil/xc-core';
2
+ import { OmniClient } from './OmniClient';
3
+ export * from './OmniClient';
4
+ /**
5
+ * Omni connector of a UTXO chain.
6
+ *
7
+ * - One client per chain, so an order's address is registered once
8
+ *
9
+ * @param source - UTXO chain deposits are paid on
10
+ * @param hub - NEAR chain the connector is read from
11
+ */
12
+ export declare function omniClient(source: AnyChain, hub: NearChain): OmniClient;
@@ -1,4 +1,4 @@
1
- import { AnyChain, AnyParachain, Asset, AssetRoute, Parachain } from '@galacticcouncil/xc-core';
1
+ import { AnyChain, AnyParachain, Asset, AssetRoute, NearChain, Parachain } from '@galacticcouncil/xc-core';
2
2
  import { XcmTransferType } from '../../../builders';
3
3
  export declare const GLMR_MIN_DEST_FEE = 1;
4
4
  export declare const HUB_EXT_USDT_DEST_FEE = 0.02;
@@ -15,6 +15,14 @@ export declare function toParaErc20Template(asset: Asset, destination: AnyParach
15
15
  * signer takes the `contract` and signs plain evm transactions.
16
16
  */
17
17
  export declare function viaNttTemplate(assetIn: Asset, assetOut: Asset, to: AnyChain): AssetRoute;
18
+ /**
19
+ * Withdrawal to a UTXO chain through Omni, over the NEAR hub.
20
+ *
21
+ * - One call: the emitter settles to the NEAR account derived from the
22
+ * address; bots redeem and withdraw from there
23
+ * - Emitter, bridge and miner fees come out of what lands
24
+ */
25
+ export declare function viaOmniTemplate(asset: Asset, to: AnyChain, hub: NearChain): AssetRoute;
18
26
  /**
19
27
  * Executor-delivered variant, offered alongside the self-redeem route above
20
28
  * for the same pair - the sender pays for delivery instead of signing a
@@ -0,0 +1,2 @@
1
+ import { ChainRoutes } from '@galacticcouncil/xc-core';
2
+ export declare const zcashChainsConfig: ChainRoutes[];
@@ -0,0 +1,2 @@
1
+ import { ChainRoutes } from '@galacticcouncil/xc-core';
2
+ export declare const zcashConfig: ChainRoutes;
@@ -0,0 +1 @@
1
+ export {};