Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send Native token in MultiESDTNFTTransfer #462

Merged
merged 7 commits into from
Jul 9, 2024

Conversation

popenta
Copy link
Contributor

@popenta popenta commented Jun 28, 2024

Added support to send both native and esdt tokens using MultiESDTNFTTransfer.

@popenta popenta self-assigned this Jun 28, 2024
andreibancioiu
andreibancioiu previously approved these changes Jul 2, 2024

if (nativeTransferAmount && numberOfTokens) {
throw new ErrBadUsage("Can't send both native tokens and custom tokens(ESDT/NFT)");
const nativeTransfer = TokenTransfer.newFromEgldAmount(nativeTransferAmount);
tokenTransfers.push(nativeTransfer);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use array concatenation, similar to Python?

@@ -82,18 +82,10 @@ export class TransferTransactionsFactory {
return this.gasEstimator !== undefined;
}

private ensureMembersAreDefined() {
private ensureConfigIsDefined() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the presence of this.config indicates the presence of tokenComputer and tokenTransfersDataBuilder, as well. Also, we can set this.tokenComputer and this.tokenTransfersDataBuilder in constructor no matter what (irrespective to isGasEstimator()).

In v14, this is the first legacy thing to be dropped :)

}

const nativeTransfer = nativeAmount ? TokenTransfer.newFromEgldAmount(nativeAmount) : undefined;
nativeTransfer ? tokenTransfers.push(nativeTransfer) : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, array concatenation can be used (optional).

andreibancioiu
andreibancioiu previously approved these changes Jul 8, 2024
@popenta popenta merged commit d7d601b into feat/next Jul 9, 2024
1 check passed
@popenta popenta deleted the egld-in-multi-esdtnft-transfer branch July 9, 2024 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants