-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: create account estimate fees #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think overall the approach is sound, left some comments though
convertToGenericAddress<ChainType.EVM>( | ||
data.addressToInvite, | ||
ChainType.EVM, | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The address to invite should already by generic. You are inviting an address on folksChainIdToInvite
which may not neccessarily be EVM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated b11a478
export function getAdapterAddress( | ||
folksChainId: FolksChainId, | ||
network: NetworkType, | ||
adapterType: AdapterType, | ||
) { | ||
if (isHubChain(folksChainId, network)) | ||
return getHubChainAdapterAddress(network, adapterType); | ||
return getSpokeChainAdapterAddress(folksChainId, network, adapterType); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When calling getAdapterAddress
with Avalanche, you may still be calling from the context of being a spoke in which case you should be calling getSpokeChainAdapterAddress
. Therefore it may be best to delete this function entirely and then call getHubChainAdapterAddress
/ getSpokeChainAdapterAddress
directly depending on the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export function buildEvmMessageToSend( | ||
messageToSendBuilderParams: MessageToSendBuilderParams, | ||
messageToSendBuilderParams: MessageBuilderParams, | ||
feeParams: OptionalMessageParams, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are naming this feeParams
but technically it could be any of the message params which is being overrided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the type is: type OptionalMessageParams = Partial<MessageParams>;
so related to the fees plus the adapters, I think calling it params or messageParams can be misleading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someone may mistakenly pass in feeParams
which overrides the adapters. I think the type of feeParams
should be changed to only include the params related to fees. Alternatively you ignore the non-fee params of feeParams
by not using the spread operator ...feeParams
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created the FeeParams
type instead 53d21c1
buildMessagePayload( | ||
messageBuilderParams.action, | ||
messageBuilderParams.accountId, | ||
getRandomGenericAddress(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a random address works here in place of the user address. The transaction will likely revert when trying to estimate gas because the address is not registered to the account id.
You probably want to include the user address in MessageBuilderParams
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/common/utils/chain.ts
Outdated
export function getSignerGenericAddress( | ||
folksChainSigner: FolksChainSigner, | ||
): GenericAddress { | ||
const chainType = folksChainSigner.chainType; | ||
switch (chainType) { | ||
case ChainType.EVM: | ||
return getEvmSignerAddress(folksChainSigner.signer); | ||
default: | ||
return exhaustiveCheck(chainType); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't returning the generic address?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes thanks 86989f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked all fixes and seem good
No description provided.