Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maxima-net committed Sep 5, 2022
1 parent 574acd9 commit 81ecba8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/tezos/atomexProtocol/taquitoAtomexProtocolMultiChain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TezosToolkit, TransactionWalletOperation } from '@taquito/taquito';
import type { ContractAbstraction, TezosToolkit, TransactionWalletOperation, Wallet } from '@taquito/taquito';
import BigNumber from 'bignumber.js';

import type {
Expand Down Expand Up @@ -78,6 +78,13 @@ export abstract class TaquitoAtomexProtocolMultiChain implements AtomexProtocolM
return taquitoWallet;
}

protected async getSwapContractCore<T extends ContractAbstraction<Wallet>>(address: string): Promise<T> {
const wallet = await this.getWallet(address);
const contract = await wallet.toolkit.wallet.at<T>(this.swapContractAddress);

return contract;
}

protected async getTransaction(operation: TransactionWalletOperation): Promise<Transaction> {
const status = await operation.status();
const confirmation = await operation.confirmation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ export class TezosTaquitoAtomexProtocolMultiChain extends TaquitoAtomexProtocolM
}

protected async getSwapContract(address: string): Promise<TezosMultiChainSmartContract<Wallet>> {
const wallet = await this.getWallet(address);
const contract = await wallet.toolkit.wallet.at<TezosMultiChainSmartContract<Wallet>>(this.swapContractAddress);

return contract;
return this.getSwapContractCore<TezosMultiChainSmartContract<Wallet>>(address);
}
}

0 comments on commit 81ecba8

Please sign in to comment.