Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
borispoehland committed Aug 13, 2024
1 parent 64dfdaa commit 94e91fe
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 40 deletions.
7 changes: 4 additions & 3 deletions src/email/Markdown.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { PropsWithChildren, type ComponentProps } from 'react'
import React, { type ComponentProps } from 'react'

import { Heading, Img, Link, Text } from '@react-email/components'
import ReactMarkdown from 'react-markdown'
import type { Components } from 'react-markdown'

import { bodyStyle, headingStyle, linkStyle } from './utils'
Expand Down Expand Up @@ -50,6 +51,6 @@ const MarkdownComponents: Partial<Components> = {
a: (props) => <Link style={linkStyle} {...props} />,
}

export function Markdown({ children }: PropsWithChildren) {
return <div>{children}</div>
export function Markdown(props: ComponentProps<typeof ReactMarkdown>) {
return <ReactMarkdown components={MarkdownComponents} {...props} />
}
77 changes: 40 additions & 37 deletions src/interactions/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Interaction } from '@multiversx/sdk-core/out'
import { BytesValue, VariadicValue } from '@multiversx/sdk-core/out'
import type {
BytesValue,
Interaction,
VariadicValue,
} from '@multiversx/sdk-core/out'
import { Address } from '@multiversx/sdk-core/out/address'
import type { IPlainTransactionObject } from '@multiversx/sdk-core/out/interface'
import type { SmartContract } from '@multiversx/sdk-core/out/smartcontracts/smartContract'
Expand Down Expand Up @@ -344,14 +347,16 @@ export class SCInteraction {
if (sender.nonce) {
interaction.withNonce(sender.nonce)
}
return [interaction
.withChainID(this.api.chain)
.withSender(new Address(sender.address))
.withGasLimit(
Math.min(600_000_000, 25_000_000 + auctionIDs.length * 8_000_000)
)
.buildTransaction()
.toPlainObject()];
return [
interaction
.withChainID(this.api.chain)
.withSender(new Address(sender.address))
.withGasLimit(
Math.min(600_000_000, 25_000_000 + auctionIDs.length * 8_000_000)
)
.buildTransaction()
.toPlainObject(),
]
} else if (market == 'frameit') {
return auctionIDs.map((auction_id, index) => {
const interaction = this.xo.methodsExplicit.withdraw([
Expand All @@ -363,12 +368,10 @@ export class SCInteraction {
return interaction
.withChainID(this.api.chain)
.withSender(new Address(sender.address))
.withGasLimit(
Math.min(600_000_000, 25_000_000)
)
.withGasLimit(Math.min(600_000_000, 25_000_000))
.withExplicitReceiver(new Address(this.config.FM_SC))
.buildTransaction()
.toPlainObject();
.toPlainObject()
})
} else if (market == 'deadrare') {
return auctionIDs.map((auction_id, index) => {
Expand All @@ -381,12 +384,10 @@ export class SCInteraction {
return interaction
.withChainID(this.api.chain)
.withSender(new Address(sender.address))
.withGasLimit(
Math.min(600_000_000, 25_000_000)
)
.withGasLimit(Math.min(600_000_000, 25_000_000))
.withExplicitReceiver(new Address(this.config.DR_SC))
.buildTransaction()
.toPlainObject();
.toPlainObject()
})
} else {
throw new Error('Market not supported')
Expand All @@ -402,9 +403,12 @@ export class SCInteraction {

public withdrawGlobalOffer(
offerID: number,
market = "xoxno",
market = 'xoxno',
senderNonce: WithSenderAndNonce
): IPlainTransactionObject {
if (market != 'xoxno') {
throw Error('Marketplace not supported')
}

const interaction = this.xo.methods.withdrawGlobalOffer([offerID])

Expand All @@ -417,7 +421,6 @@ export class SCInteraction {
.withGasLimit(20_000_000)
.buildTransaction()
.toPlainObject()

}

/**
Expand All @@ -441,10 +444,10 @@ export class SCInteraction {
}
const interaction = signature
? this.xo.methods.acceptGlobalOffer([
offer_id,
auction_ids_opt ?? [],
signature,
])
offer_id,
auction_ids_opt ?? [],
signature,
])
: this.xo.methods.acceptGlobalOffer([offer_id, auction_ids_opt])
interaction.withSender(new Address(address))
if (nfts.length > 0) {
Expand All @@ -462,8 +465,8 @@ export class SCInteraction {
.withGasLimit(
Math.min(
35_000_000 +
(nfts.length + auction_ids_opt.length) * 7_000_000 +
(signature == undefined ? 15_000_000 : 0),
(nfts.length + auction_ids_opt.length) * 7_000_000 +
(signature == undefined ? 15_000_000 : 0),
600_000_000
)
)
Expand Down Expand Up @@ -726,14 +729,14 @@ export class SCInteraction {
tokenTransfers: isEgld
? undefined
: [
new TokenTransfer({
token: new Token({
identifier: payment.collection,
nonce: BigInt(payment.nonce ?? 0),
new TokenTransfer({
token: new Token({
identifier: payment.collection,
nonce: BigInt(payment.nonce ?? 0),
}),
amount: BigInt(payment.amount),
}),
amount: BigInt(payment.amount),
}),
],
],
})

if (sender.nonce) {
Expand Down Expand Up @@ -884,11 +887,11 @@ export class SCInteraction {
interaction.withValue(
bigNumber
? TokenTransfer.egldFromBigInteger(
new BigNumber(amount).multipliedBy(quantity)
)
new BigNumber(amount).multipliedBy(quantity)
)
: TokenTransfer.egldFromAmount(
new BigNumber(amount).multipliedBy(quantity)
)
new BigNumber(amount).multipliedBy(quantity)
)
)
} else {
if (!bigNumber) {
Expand Down

0 comments on commit 94e91fe

Please sign in to comment.