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

feat: change address string to EVMAddress #179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
63 changes: 32 additions & 31 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
BridgeDefinition,
Chain,
ChainId,
EVMAddress,
ExchangeDefinition,
LifiStep,
Token,
Expand All @@ -16,12 +17,12 @@ export interface RoutesRequest {
fromChainId: number
fromAmount: string

fromTokenAddress: string
fromAddress?: string
fromTokenAddress: EVMAddress
fromAddress?: EVMAddress

toChainId: number
toTokenAddress: string
toAddress?: string
toTokenAddress: EVMAddress
toAddress?: EVMAddress

options?: RouteOptions
fromAmountForGas?: string
Expand Down Expand Up @@ -84,14 +85,14 @@ export interface Route {
fromAmountUSD: string
fromAmount: string
fromToken: Token
fromAddress?: string
fromAddress?: EVMAddress

toChainId: number
toAmountUSD: string
toAmount: string
toAmountMin: string
toToken: Token
toAddress?: string
toAddress?: EVMAddress

gasCostUSD?: string // Aggregation of underlying gas costs in usd

Expand Down Expand Up @@ -151,7 +152,7 @@ export interface PossibilitiesResponse {

export interface GetTokenRequest {
chain: number | string
token: string
token: EVMAddress
}

export interface ToolConfiguration {
Expand All @@ -165,13 +166,13 @@ export interface ToolConfiguration {

export interface QuoteRequest extends ToolConfiguration {
fromChain: number | string
fromToken: string
fromAddress: string
fromToken: EVMAddress
fromAddress: EVMAddress
fromAmount: string

toChain: number | string
toToken: string
toAddress?: string
toToken: EVMAddress
toAddress?: EVMAddress

order?: Order
slippage?: number | string
Expand All @@ -186,18 +187,18 @@ export interface QuoteRequest extends ToolConfiguration {

export interface ContractCallQuoteRequest extends ToolConfiguration {
fromChain: number | string
fromToken: string
fromAddress: string
fromToken: EVMAddress
fromAddress: EVMAddress

toChain: number | string
toToken: string
toToken: EVMAddress
toAmount: string
toContractAddress: string
toContractAddress: EVMAddress
toContractCallData: string
toContractGasLimit: string
toApprovalAddress?: string
toFallbackAddress?: string
contractOutputsToken?: string
toApprovalAddress?: EVMAddress
toFallbackAddress?: EVMAddress
contractOutputsToken?: EVMAddress

slippage?: number | string
integrator?: string
Expand All @@ -208,17 +209,17 @@ export interface ContractCallQuoteRequest extends ToolConfiguration {

export interface ContractCallQuotesRequest extends ToolConfiguration {
fromChain: number | string
fromToken: string
fromAddress: string
fromToken: EVMAddress
fromAddress: EVMAddress

toChain: number | string
toFallbackAddress?: string
toFallbackAddress?: EVMAddress
toContractCalls: {
sendingAmount: string
sendingToken: string
receivingToken: string
contractAddress: string
approvalAddress?: string
sendingToken: EVMAddress
receivingToken: EVMAddress
contractAddress: EVMAddress
approvalAddress?: EVMAddress
callData: string
gasLimit: string
}[]
Expand All @@ -231,9 +232,9 @@ export interface ContractCallQuotesRequest extends ToolConfiguration {

export interface ConnectionsRequest extends ToolConfiguration {
fromChain?: number | string
fromToken?: string
fromToken?: EVMAddress
toChain?: number | string
toToken?: string
toToken?: EVMAddress
}

export interface Connection {
Expand Down Expand Up @@ -358,8 +359,8 @@ export interface FullStatusData extends StatusData {
sending: ExtendedTransactionInfo
receiving: PendingReceivingInfo | ExtendedTransactionInfo
lifiExplorerLink: string
fromAddress: string
toAddress: string
fromAddress: EVMAddress
toAddress: EVMAddress
bridgeExplorerLink?: string
}

Expand Down Expand Up @@ -406,7 +407,7 @@ export type TokenBalance = {
export interface IntegratorWithdrawalRequest {
integratorId: string
chainId: ChainId
tokens?: string[]
tokens?: EVMAddress[]
}

export interface IntegratorWithdrawalTransactionResponse {
Expand All @@ -425,7 +426,7 @@ export type LIFuelStatusResponse = {
export type GasRecommendationRequest = {
chainId: ChainId
fromChain?: ChainId
fromToken?: string
fromToken?: EVMAddress
}

export type RefetchSourceLIFuelRequest = {
Expand Down
5 changes: 4 additions & 1 deletion src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,13 @@ export enum ChainId {
LNAT = 59140,
}

export type EVMAddress = string & { __EVMAddress: never }

export interface BaseToken {
chainId: ChainId
address: string
address: EVMAddress
}

export interface StaticToken extends BaseToken {
symbol: string
decimals: number
Expand Down
Loading