Skip to content

Commit 40d97e1

Browse files
authored
Merge pull request #158 from liquality/eth-fixes
Eth fixes
2 parents aa9b439 + ab82f6a commit 40d97e1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/providers/JsonRpcProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default class JsonRpcProvider extends Provider {
5454

5555
jsonrpc (method, ...params) {
5656
return this._axios.post(
57-
'/',
57+
'',
5858
this._prepareRequest(method, params)
5959
)
6060
.then(this._parseResponse)

src/providers/ethereum/EthereumSwapProvider.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ export default class EthereumSwapProvider extends Provider {
9898

9999
async verifyInitiateSwapTransaction (initiationTxHash, value, recipientAddress, refundAddress, secretHash, expiration) {
100100
const initiationTransaction = await this.getMethod('getTransactionByHash')(initiationTxHash)
101-
return this.doesTransactionMatchSwapParams(initiationTransaction, value, recipientAddress, refundAddress, secretHash, expiration)
101+
const initiationTransactionReceipt = await this.getMethod('getTransactionReceipt')(initiationTxHash)
102+
const transactionMatchesSwapParams = this.doesTransactionMatchSwapParams(initiationTransaction, value, recipientAddress, refundAddress, secretHash, expiration)
103+
return transactionMatchesSwapParams && initiationTransactionReceipt.status === '1'
102104
}
103105

104106
async findInitiateSwapTransaction (value, recipientAddress, refundAddress, secretHash, expiration) {
@@ -107,13 +109,9 @@ export default class EthereumSwapProvider extends Provider {
107109
while (!initiateSwapTransaction) {
108110
const block = await this.getMethod('getBlockByNumber')(blockNumber, true)
109111
if (block) {
110-
const transaction = block.transactions.find(transaction =>
112+
initiateSwapTransaction = block.transactions.find(transaction =>
111113
this.doesTransactionMatchSwapParams(transaction, value, recipientAddress, refundAddress, secretHash, expiration)
112114
)
113-
if (transaction) {
114-
const transactionReceipt = await this.getMethod('getTransactionReceipt')(transaction.hash)
115-
if (transactionReceipt.status === '1') initiateSwapTransaction = transaction
116-
}
117115
blockNumber++
118116
}
119117
await sleep(5000)

0 commit comments

Comments
 (0)