mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-15 22:52:36 +03:00
Fix types
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.19.60",
|
||||
"version": "0.19.61",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/index.cjs",
|
||||
"module": "./lib/index.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ethers } from 'ethers';
|
||||
import type {
|
||||
Orion, Unit, AtomicSwapLocal, SupportedChainId, TransactionInfo
|
||||
Unit, AtomicSwapLocal, SupportedChainId, TransactionInfo, AtomicSwap
|
||||
} from '../../index.js';
|
||||
import { INTERNAL_PROTOCOL_PRECISION, TxStatus, TxType } from '../../index.js';
|
||||
import getHistoryExt from './getHistory.js';
|
||||
@@ -14,30 +14,6 @@ import { invariant } from '../../utils/invariant.js';
|
||||
export const SECONDS_IN_DAY = 60 * 60 * 24;
|
||||
export const EXPIRATION_DAYS = 4;
|
||||
|
||||
type BridgeHistory = Awaited<ReturnType<Orion['bridge']['getHistory']>>;
|
||||
|
||||
type BridgeHistoryItem = NonNullable<BridgeHistory[string]>;
|
||||
|
||||
export type AtomicSwap = Partial<
|
||||
Omit<BridgeHistoryItem, 'creationDate' | 'expiration' | 'secret'>
|
||||
> & Partial<
|
||||
Omit<AtomicSwapLocal, 'creationDate' | 'expiration' | 'secret'>
|
||||
> & {
|
||||
sourceChainId: SupportedChainId
|
||||
targetChainId: SupportedChainId
|
||||
lockExpiration: number
|
||||
secretHash: string
|
||||
walletAddress: string
|
||||
secret?: string | undefined
|
||||
|
||||
creationDate?: number | undefined
|
||||
redeemExpired?: boolean | undefined
|
||||
|
||||
lockTx?: TransactionInfo | undefined
|
||||
redeemTx?: TransactionInfo | undefined
|
||||
refundTx?: TransactionInfo | undefined
|
||||
liquidityMigrationTx?: TransactionInfo | undefined
|
||||
}
|
||||
export default class Bridge {
|
||||
constructor(
|
||||
private readonly unitsArray: Unit[],
|
||||
|
||||
33
src/types.ts
33
src/types.ts
@@ -3,6 +3,7 @@ import type { BigNumber } from 'bignumber.js';
|
||||
import type subOrderStatuses from './constants/subOrderStatuses.js';
|
||||
import type positionStatuses from './constants/positionStatuses.js';
|
||||
import type { knownEnvs } from './config/schemas/index.js';
|
||||
import type getHistory from './Orion/bridge/getHistory.js';
|
||||
|
||||
export type DeepPartial<T> = T extends object ? {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
@@ -315,9 +316,16 @@ export interface AtomicSwapLocal {
|
||||
}
|
||||
|
||||
export enum TxStatus {
|
||||
QUEUED = 'queued',
|
||||
SIGN_FAILED = 'sign_failed',
|
||||
GAS_ESTIMATING = 'gas_estimating',
|
||||
ESTIMATE_GAS_FAILED = 'estimate_gas_failed',
|
||||
CANCELLED = 'cancelled',
|
||||
PENDING = 'pending',
|
||||
FAILED = 'failed',
|
||||
SETTLED = 'settled',
|
||||
SIGNING = 'signing',
|
||||
UNKNOWN = 'unknown',
|
||||
}
|
||||
|
||||
export enum TxType {
|
||||
@@ -353,3 +361,28 @@ export type TransactionInfo = {
|
||||
hash?: string
|
||||
payload?: BridgeLockTxPayload | BridgeRedeemTxPayload | BridgeRefundTxPayload
|
||||
}
|
||||
|
||||
type BridgeHistory = Awaited<ReturnType<typeof getHistory>>;
|
||||
|
||||
type BridgeHistoryItem = NonNullable<BridgeHistory[string]>;
|
||||
|
||||
export type AtomicSwap = Partial<
|
||||
Omit<BridgeHistoryItem, 'creationDate' | 'expiration' | 'secret'>
|
||||
> & Partial<
|
||||
Omit<AtomicSwapLocal, 'creationDate' | 'expiration' | 'secret'>
|
||||
> & {
|
||||
sourceChainId: SupportedChainId
|
||||
targetChainId: SupportedChainId
|
||||
lockExpiration: number
|
||||
secretHash: string
|
||||
walletAddress: string
|
||||
secret?: string | undefined
|
||||
|
||||
creationDate?: number | undefined
|
||||
redeemExpired?: boolean | undefined
|
||||
|
||||
lockTx?: TransactionInfo | undefined
|
||||
redeemTx?: TransactionInfo | undefined
|
||||
refundTx?: TransactionInfo | undefined
|
||||
liquidityMigrationTx?: TransactionInfo | undefined
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user