Skip to content

Commit

Permalink
Merge pull request #4538 from roiLeo/feature/bsx/gift
Browse files Browse the repository at this point in the history
🔧 bsx gift unlist
  • Loading branch information
yangwao committed Jan 1, 2023
2 parents 6cc4df0 + 740f89d commit d2f92bb
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions components/bsx/Gallery/Item/AvailableActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ export default class AvailableActions extends mixins(
return this.selectedAction === ShoppingActions.CONSUME
}
get isOffer() {
return this.selectedAction === ShoppingActions.MAKE_OFFER
}
get isSend() {
return this.selectedAction === ShoppingActions.SEND
}
unlistNft() {
this.selectedAction = ShoppingActions.LIST
this.meta = 0
Expand All @@ -228,6 +236,7 @@ export default class AvailableActions extends mixins(
protected async submit() {
const api = await this.useApi()
let expiration: number | undefined = undefined
this.initTransactionLoader()
try {
Expand All @@ -237,13 +246,23 @@ export default class AvailableActions extends mixins(
}
showNotification(`[${this.selectedAction}] NFT: ${this.nftId}`)
let cb = getApiCall(api, this.urlPrefix, this.selectedAction)
let expiration: number | undefined = undefined
if (this.selectedAction === ShoppingActions.MAKE_OFFER) {
const cb = this.isSend
? api.tx.utility.batchAll
: getApiCall(api, this.urlPrefix, this.selectedAction)
if (this.isOffer) {
const currentBlock = await api.query.system.number()
expiration = this.getExpiration(currentBlock.toNumber())
}
let arg: any[] = this.getArgs(expiration)
const arg: any[] = this.isSend
? [
[
api.tx.marketplace.setPrice(this.collectionId, this.nftId, 0),
api.tx.nft.transfer(this.collectionId, this.nftId, this.meta),
],
]
: this.getArgs(expiration)
this.howAboutToExecute(
this.accountId,
Expand Down

0 comments on commit d2f92bb

Please sign in to comment.