Skip to content

Commit

Permalink
fix: Missing brace after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Aug 7, 2023
1 parent 6bb35b8 commit 3de1250
Showing 1 changed file with 41 additions and 40 deletions.
81 changes: 41 additions & 40 deletions webapp/src/modules/nft/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,49 +167,50 @@ export function* nftSaga(getIdentity: () => AuthIdentity | undefined) {
}
}

function* handleTransferNFTRequest(action: TransferNFTRequestAction) {
const { nft, address } = action.payload
try {
const vendor: Vendor<VendorName> = yield call(
VendorFactory.build,
nft.vendor
)

const wallet: ReturnType<typeof getWallet> = yield select(getWallet)
if (!wallet) {
throw new Error('A wallet is needed to perform a NFT transfer request')
}
function* handleTransferNFTRequest(action: TransferNFTRequestAction) {
const { nft, address } = action.payload
try {
const vendor: Vendor<VendorName> = yield call(
VendorFactory.build,
nft.vendor
)

const wallet: ReturnType<typeof getWallet> = yield select(getWallet)
if (!wallet) {
throw new Error('A wallet is needed to perform a NFT transfer request')
}

const txHash: string = yield call(
[vendor.nftService, 'transfer'],
wallet,
address,
nft
)
yield put(transferNFTransactionSubmitted(nft, address, txHash))
if (nft?.openRentalId) {
yield call(waitForTx, txHash)
const rental: RentalListing | null = yield select(
getRentalById,
nft.openRentalId
const txHash: string = yield call(
[vendor.nftService, 'transfer'],
wallet,
address,
nft
)
if (isRentalListingOpen(rental)) {
yield call(waitUntilRentalChangesStatus, nft, RentalStatus.CANCELLED)
yield put(transferNFTransactionSubmitted(nft, address, txHash))
if (nft?.openRentalId) {
yield call(waitForTx, txHash)
const rental: RentalListing | null = yield select(
getRentalById,
nft.openRentalId
)
if (isRentalListingOpen(rental)) {
yield call(waitUntilRentalChangesStatus, nft, RentalStatus.CANCELLED)
}
}
}

yield put(transferNFTSuccess(nft, address))
} catch (error) {
const errorMessage = isErrorWithMessage(error)
? error.message
: t('global.unknown_error')
const errorCode =
error !== undefined &&
error !== null &&
typeof error === 'object' &&
'code' in error
? (error as { code: ErrorCode }).code
: undefined
yield put(transferNFTFailure(nft, address, errorMessage, errorCode))
yield put(transferNFTSuccess(nft, address))
} catch (error) {
const errorMessage = isErrorWithMessage(error)
? error.message
: t('global.unknown_error')
const errorCode =
error !== undefined &&
error !== null &&
typeof error === 'object' &&
'code' in error
? (error as { code: ErrorCode }).code
: undefined
yield put(transferNFTFailure(nft, address, errorMessage, errorCode))
}
}
}

0 comments on commit 3de1250

Please sign in to comment.