Skip to content

Commit

Permalink
Removed Unnecessary Endpoint (#143)
Browse files Browse the repository at this point in the history
* removed cross chain quote endpoint

* removed unused imports and files
  • Loading branch information
vignesha22 authored Jul 18, 2022
1 parent 3a35705 commit f791b09
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 279 deletions.
94 changes: 0 additions & 94 deletions examples/src/16-cross-chain-quote.ts

This file was deleted.

File renamed without changes.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "etherspot",
"version": "1.34.2",
"version": "1.34.3",
"description": "Etherspot SDK",
"keywords": [
"ether",
Expand Down
78 changes: 0 additions & 78 deletions src/sdk/exchange/classes/exchange-cross-chain-quote.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/sdk/exchange/classes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ export * from './cross-chain-bridge-token-list';
export * from './cross-chain-bridge-token';
export * from './exchange-offer';
export * from './exchange-offers';
export * from './exchange-cross-chain-quote';
export * from './exchange-bridging-quote';
72 changes: 0 additions & 72 deletions src/sdk/exchange/exchange.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
CrossChainBridgeRoute,
CrossChainBridgeRoutes,
CrossChainBridgeBuildTXResponse,
CrossChainQuote,
BridgingQuotes,
} from './classes';

Expand Down Expand Up @@ -58,77 +57,6 @@ export class ExchangeService extends Service {
return result;
}

async getCrossChainQuote(
fromTokenAddress: string,
toTokenAddress: string,
fromChainId: number,
toChainId: number,
fromAmount: BigNumber,
): Promise<CrossChainQuote> {
const { apiService, accountService } = this.services;

const account = accountService.accountAddress;

const { result } = await apiService.query<{
result: CrossChainQuote;
}>(
gql`
query(
$account: String!
$fromTokenAddress: String!
$toTokenAddress: String!
$fromAmount: BigNumber!
$fromChainId: Int
$toChainId: Int
) {
result: getCrossChainQuote(
account: $account
fromTokenAddress: $fromTokenAddress
toTokenAddress: $toTokenAddress
fromAmount: $fromAmount
fromChainId: $fromChainId
toChainId: $toChainId
) {
id
action {
fromAmount
fromToken {
address
}
}
estimate {
approvalAddress
}
transactionRequest {
data
to
value
from
chainId
gasLimit
gasPrice
}
}
}
`,
{
variables: {
account,
fromTokenAddress,
toTokenAddress,
fromChainId,
toChainId,
fromAmount,
},
models: {
result: CrossChainQuote,
},
},
);

return result ? result : null;
}

async getCrossChainQuotes(
fromTokenAddress: string,
toTokenAddress: string,
Expand Down
31 changes: 0 additions & 31 deletions src/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ import {
ExchangeOffer,
ExchangeService,
CrossChainBridgeBuildTXResponse,
CrossChainQuote,
BridgingQuotes,
} from './exchange';

Expand Down Expand Up @@ -1324,36 +1323,6 @@ export class Sdk {
return this.services.exchangeService.buildCrossChainBridgeTransaction(dto);
}

/**
* gets cross chain quote
* @param dto
* @return Promise<CrossChainQuote>
*/
async getCrossChainQuote(dto: GetExchangeCrossChainQuoteDto): Promise<CrossChainQuote> {
const { fromChainId, toChainId, fromTokenAddress, toTokenAddress, fromAmount } = await validateDto(
dto,
GetExchangeCrossChainQuoteDto,
{
addressKeys: ['fromTokenAddress', 'toTokenAddress'],
},
);

await this.require({
session: true,
});

let { chainId } = this.services.networkService;
chainId = fromChainId ? fromChainId : chainId;

return this.services.exchangeService.getCrossChainQuote(
fromTokenAddress,
toTokenAddress,
chainId,
toChainId,
BigNumber.from(fromAmount),
);
}

/**
* gets multi chain quotes
* @param dto
Expand Down

0 comments on commit f791b09

Please sign in to comment.