Merged
Conversation
ccorcoveanu
reviewed
Jan 28, 2026
| @@ -81,17 +112,4 @@ export class ExactMultiversXServer implements ISchemeNetworkServer { | |||
|
|
|||
| return req | |||
There was a problem hiding this comment.
In the go implementation we have the following logic - we should mirror this
if _, ok := reqCopy.Extra["assetTransferMethod"]; !ok {
if reqCopy.Asset == multiversx.NativeTokenTicker {
reqCopy.Extra["assetTransferMethod"] = multiversx.TransferMethodDirect
} else {
reqCopy.Extra["assetTransferMethod"] = multiversx.TransferMethodESDT
}
}
if _, ok := reqCopy.Extra["gasLimit"]; !ok {
if reqCopy.Extra["assetTransferMethod"] == multiversx.TransferMethodDirect {
reqCopy.Extra["gasLimit"] = uint64(multiversx.GasLimitStandard)
} else {
reqCopy.Extra["gasLimit"] = uint64(multiversx.GasLimitESDT)
}
}There was a problem hiding this comment.
plus the checks in ValidatePaymentRequirements
| const numericValue = parseFloat(cleanPrice) | ||
|
|
||
| if (!isNaN(numericValue)) { | ||
| // Convert USD to EGLD base units (18 decimals) |
There was a problem hiding this comment.
should remove the reasoning comments
| */ | ||
| async parsePrice(price: unknown, _network: string): Promise<{ asset: string; amount: string }> { | ||
| async parsePrice(price: Price, _network: Network): Promise<AssetAmount> { | ||
| // Handle Price parsing similar to Go "ParsePrice" |
| asset = typeof p.asset === 'string' ? p.asset : 'EGLD' | ||
| } else if (typeof price === 'string') { | ||
| amount = price // Assume EGLD if just amount string? Or error? | ||
| // Handle dollar format like "$0.001" |
There was a problem hiding this comment.
We should mirror the go implementation and accept all the same formats
| x402Version: number, | ||
| paymentRequirements: PaymentRequirements, | ||
| ): Promise<Pick<PaymentPayload, 'x402Version' | 'payload'>> { | ||
| if (!paymentRequirements.payTo) { |
There was a problem hiding this comment.
Plase mirror go improvements:
- Constants for ChainIds and Api Urls
- Relayed vs Non-Relayed transaction based on the
assetTransferMethodfield - Refactor the big if/else condition in function calls so the code would be easier to read
| gasPrice: BigInt(gasPrice), | ||
| data: new TransactionPayload(dataString), | ||
| chainID: chainRef, | ||
| version: 2, |
There was a problem hiding this comment.
missing version handling based on relayed vs non-relayed
| }) | ||
|
|
||
| if (relayer) { | ||
| // Future work: set relayer semantics if supported by SDK transaction object |
There was a problem hiding this comment.
I don't understand what should have been here
| */ | ||
| constructor(private apiUrl: string = 'https://devnet-api.multiversx.com') {} | ||
| constructor( | ||
| private apiUrl: string = 'https://devnet-api.multiversx.com', |
| relayerSignature: relayerSig, // might be empty | ||
| } | ||
|
|
||
| const response = await fetch(`${this.apiUrl}/transaction/simulate`, { |
There was a problem hiding this comment.
| const pollIntervalMs = 2000 | ||
| const startTime = Date.now() | ||
|
|
||
| while (Date.now() - startTime < timeoutMs) { |
There was a problem hiding this comment.
ccorcoveanu
approved these changes
Jan 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Tests
Checklist