Skip to content

Commit

Permalink
Removed getTransactions endpoint and fixed session checking (#35)
Browse files Browse the repository at this point in the history
* Removed getTransactions endpoint and fixed session checking
* updated package version
  • Loading branch information
kaushalrajbacancy authored Sep 21, 2023
1 parent 66692f8 commit 467daed
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 139 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog

## [1.2.8] - 2023-09-21
### Fixes
- Fixed the issue with getExchangeOffers endpoint (Account must need to be deployed to access this endpoint)
- Removed getTransactions endpoint

## [1.2.7] - 2023-09-20
### Fixes
- Fixed the issue on usage of axios when paymaster is called via react native by replacing it to fetch.
Expand Down
22 changes: 0 additions & 22 deletions examples/07-transactions.ts

This file was deleted.

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.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@etherspot/prime-sdk",
"version": "1.2.7",
"version": "1.2.8",
"description": "Etherspot Prime (Account Abstraction) SDK",
"keywords": [
"ether",
Expand All @@ -27,7 +27,6 @@
"03-transfer-erc20": "./node_modules/.bin/ts-node ./examples/03-transfer-erc20",
"05-get-account-balances": "./node_modules/.bin/ts-node ./examples/05-get-account-balances",
"06-transaction": "./node_modules/.bin/ts-node ./examples/06-transaction",
"07-transactions": "./node_modules/.bin/ts-node ./examples/07-transactions",
"08-nft-list": "./node_modules/.bin/ts-node ./examples/08-nft-list",
"09-exchange": "./node_modules/.bin/ts-node ./examples/09-exchange",
"10-advance-routes-lifi": "./node_modules/.bin/ts-node ./examples/10-advance-routes-lifi",
Expand Down
1 change: 0 additions & 1 deletion src/sdk/data/classes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export * from './transaction-log';
export * from './decoded-log-param';
export * from './transaction-log-decoded';
export * from './transaction';
export * from './transactions';
export * from './nft-collection';
export * from './nft-list';
export * from './nft';
Expand Down
7 changes: 0 additions & 7 deletions src/sdk/data/classes/transactions.ts

This file was deleted.

58 changes: 1 addition & 57 deletions src/sdk/data/data.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { gql } from '@apollo/client/core';
import { HeaderNames, ObjectSubject, Service } from '../common';
import { Route } from '@lifi/sdk';
import { AccountBalances, AdvanceRoutesLiFi, BridgingQuotes, ExchangeOffer, ExchangeOffers, NftList, StepTransaction, StepTransactions, Transaction, Transactions } from './classes';
import { AccountBalances, AdvanceRoutesLiFi, BridgingQuotes, ExchangeOffer, ExchangeOffers, NftList, StepTransaction, StepTransactions, Transaction } from './classes';
import { BigNumber } from 'ethers';
import { CrossChainServiceProvider, LiFiBridge } from './constants';

Expand Down Expand Up @@ -112,62 +112,6 @@ export class DataService extends Service {
return result;
}

async getTransactions(account: string, ChainId: number): Promise<Transactions> {
const { apiService } = this.services;

const { result } = await apiService.query<{
result: Transactions;
}>(
gql`
query($ChainId: Int, $account: String!) {
result: transactions(chainId: $ChainId, account: $account) {
items {
blockNumber
timestamp
from
gasLimit
gasPrice
gasUsed
hash
logs
status
to
value
direction
internalTransactions
internalTransactionsFetched
mainTransactionDataFetched
batch
asset {
from
to
name
symbol
category
type
value
decimal
contract
}
blockExplorerUrl
}
}
}
`,
{
variables: {
account,
ChainId,
},
models: {
result: Transactions,
},
},
);

return result;
}

async getNftList(account: string, ChainId: number): Promise<NftList> {
const { apiService } = this.services;

Expand Down
12 changes: 0 additions & 12 deletions src/sdk/dto/get-transactions.dto.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/sdk/dto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export * from './create-session.dto';
export * from './onRamper.dto';
export * from './get-account-balances.dto';
export * from './get-transaction.dto';
export * from './get-transactions.dto';
export * from './get-nft-list.dto';
export * from './join-contract-account.dto';
export * from './get-exchange-offers.dto';
Expand Down
40 changes: 5 additions & 35 deletions src/sdk/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { getNetworkConfig, Networks, onRamperAllNetworks } from './network/const
import { UserOperationStruct } from './contracts/account-abstraction/contracts/core/BaseAccount';
import { EtherspotWalletAPI, HttpRpcClient, VerifyingPaymasterAPI } from './base';
import { TransactionDetailsForUserOp, TransactionGasInfoForUserOp } from './base/TransactionDetailsForUserOp';
import { CreateSessionDto, OnRamperDto, GetAccountBalancesDto, GetAdvanceRoutesLiFiDto, GetExchangeCrossChainQuoteDto, GetExchangeOffersDto, GetNftListDto, GetStepTransactionsLiFiDto, GetTransactionDto, GetTransactionsDto, SignMessageDto, validateDto } from './dto';
import { AccountBalances, AdvanceRoutesLiFi, BridgingQuotes, ExchangeOffer, NftList, StepTransactions, Transaction, Transactions, Session } from './';
import { CreateSessionDto, OnRamperDto, GetAccountBalancesDto, GetAdvanceRoutesLiFiDto, GetExchangeCrossChainQuoteDto, GetExchangeOffersDto, GetNftListDto, GetStepTransactionsLiFiDto, GetTransactionDto, SignMessageDto, validateDto } from './dto';
import { AccountBalances, AdvanceRoutesLiFi, BridgingQuotes, ExchangeOffer, NftList, StepTransactions, Transaction, Session } from './';

/**
* Prime-Sdk
Expand Down Expand Up @@ -307,31 +307,6 @@ export class PrimeSdk {
return this.etherspotWallet.services.dataService.getTransaction(hash);
}

/**
* gets transactions
* @param dto
* @return Promise<Transactions>
*/
async getTransactions(dto: GetTransactionsDto): Promise<Transactions> {
const { account, chainId } = await validateDto(dto, GetTransactionsDto, {
addressKeys: ['account'],
});

this.etherspotWallet.services.accountService.joinContractAccount(account);

await this.etherspotWallet.require({
wallet: !account,
contractAccount: true,
});

const ChainId = chainId ? chainId : this.etherspotWallet.services.walletService.chainId;

return this.etherspotWallet.services.dataService.getTransactions(
this.etherspotWallet.prepareAccountAddress(account),
ChainId,
);
}

/**
* gets NFT list belonging to account
* @param dto
Expand Down Expand Up @@ -366,14 +341,13 @@ export class PrimeSdk {

let { toAddress, fromAddress } = dto;

if (!fromAddress) fromAddress = this.etherspotWallet.services.walletService.walletAddress;
if (!fromAddress) fromAddress = await this.getCounterFactualAddress();

if (!toAddress) toAddress = fromAddress;

this.etherspotWallet.services.accountService.joinContractAccount(fromAddress);

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

Expand Down Expand Up @@ -428,7 +402,7 @@ export class PrimeSdk {
}

async getStepTransaction(dto: GetStepTransactionsLiFiDto): Promise<StepTransactions> {
const accountAddress = this.etherspotWallet.services.walletService.walletAddress;
const accountAddress = await this.getCounterFactualAddress();

return this.etherspotWallet.services.dataService.getStepTransaction(dto.route, accountAddress);
}
Expand All @@ -455,11 +429,7 @@ export class PrimeSdk {

let { fromAddress } = dto;

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

if (!fromAddress) fromAddress = this.etherspotWallet.services.walletService.walletAddress;
if (!fromAddress) fromAddress = await this.getCounterFactualAddress();

let { chainId } = this.etherspotWallet.services.walletService;

Expand Down

0 comments on commit 467daed

Please sign in to comment.