Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add/fix encoding types #101

Merged
merged 5 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xsquid/squid-types",
"version": "0.1.94",
"version": "0.1.95",
"description": "JS and TS types relating to 0xsquid related projects.",
"main": "dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/bridges/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export enum BridgeType {
CCTP = "cctp",
NOBLE_CCTP = "noble-cctp",
IBC = "ibc",
CHAINFLIP = "chainflip",
RFQ = "rfq",
}

export enum BridgeProvider {
Expand All @@ -12,6 +14,8 @@ export enum BridgeProvider {
NOBLE_CCTP = "Noble CCTP",
IBC = "IBC",
PFM = "IBC Packet forward middleware",
CHAINFLIP = "Chainflip",
RFQ = "RFQ",
}

export type BridgeConfig = Record<string, string>;
9 changes: 8 additions & 1 deletion src/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BridgeConfig } from "bridges";
export enum ChainType {
EVM = "evm",
COSMOS = "cosmos",
BTC = "bitcoin",
}

export type BaseChain = {
Expand Down Expand Up @@ -99,7 +100,7 @@ export type CosmosGasType = {
high: number;
};

export type ChainData = EvmChain | CosmosChain;
export type ChainData = BaseChain | EvmChain | CosmosChain;

export enum ChainName {
ARBITRUM = "Arbitrum",
Expand Down Expand Up @@ -189,6 +190,9 @@ export enum ChainName {
CHAIN4ENERGY = "c4e",
SAGA = "saga",
NIBIRU = "nibiru",

// BTC
BITCOIN = "bitcoin",
}

export enum NetworkIdentifier {
Expand Down Expand Up @@ -274,6 +278,9 @@ export enum NetworkIdentifier {
CHAIN4ENERGY = "c4e",
SAGA = "saga",
NIBIRU = "nibiru",

// BTC
BITCOIN = "bitcoin",
}

export type ChainIBCInfo = {
Expand Down
1 change: 1 addition & 0 deletions src/fees/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum FeeType {
GAS_RECEIVER_FEE = "Gas receiver fee",
BOOST_FEE = "Boost fee",
INTEGRATOR_FEE = "Integrator fee",
CHAINFLIP_FEE = "Chainflip fee",
}

export enum GasCostType {
Expand Down
7 changes: 3 additions & 4 deletions src/path/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export interface ActionBaseData {
// bridges
name: string;
provider: string;
liquidityProvider: string;
}

export interface PathAction {
Expand All @@ -80,8 +81,6 @@ export interface PathAction {
export interface PathParams {
fromChainId: string;
toChainId: string;
fromToken: Pick<Token, "type" | "chainId" | "name" | "symbol" | "decimals" | "address">;
toToken: Pick<Token, "type" | "chainId" | "name" | "symbol" | "decimals" | "address">;
maxResults?: number;
subgraphIds?: string[];
fromToken: string;
toToken: string;
}
26 changes: 23 additions & 3 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,27 @@ export interface Route {
export interface RouteActionResponse extends Omit<RouteAction, "fromChain" | "toChain" | "data"> {
fromChain: string;
toChain: string;
data: _SwapDetails | WrapDetails | BridgeDetails | CustomCallDetails | FeeDetails | LiquidityProviderDetails;
data:
| _SwapDetails
| WrapDetails
| BridgeDetails
| CustomCallDetails
| FeeDetails
| LiquidityProviderDetails;
}

export interface RouteAction extends QuoteAction {
provider?: string;
description?: string;
logoURI?: string;
estimatedDuration?: number;
data: SwapDetails | WrapDetails | BridgeDetails | CustomCallDetails | FeeDetails | LiquidityProviderDetails;
data:
| SwapDetails
| WrapDetails
| BridgeDetails
| CustomCallDetails
| FeeDetails
| LiquidityProviderDetails;
}

export enum ActionType {
Expand All @@ -98,7 +110,7 @@ export enum ActionType {
IBC_TRANSFER = "ibc-transfer",
CUSTOM = "custom",
FEE = "fee",
LP = "lp",
RFQ = "rfq",
}

export interface WrapDetails {
Expand Down Expand Up @@ -160,7 +172,13 @@ export interface CustomCallDetails {
}

export interface LiquidityProviderDetails {
liquidityProvider: string;
target: string;
provider: string;
type: BridgeType;
name: string;
logoURI?: string;
calls?: ChainCall[];
}

export interface Integrator {
Expand Down Expand Up @@ -267,6 +285,8 @@ export enum ActionStage {
COSMOS_DESTINATION,
COSMOS_TRANSIENT,
COSMOS_ONLY,
BTC_SOURCE,
BTC_DESTINATION,
}

export interface StageContext {
Expand Down
2 changes: 2 additions & 0 deletions src/squid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export enum SquidRouteType {
BRIDGE = "BRIDGE",
EVM_ONLY = "EVM_ONLY",
COSMOS_ONLY = "COSMOS_ONLY",
RFQ = "RFQ",
FUND_AND_RUN_MULTICALL = "FUND_AND_RUN_MULTICALL",
}

export interface SquidData {
Expand Down
Loading