-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat(swap): Integrate open orders with MuesliSwap API #2668
Conversation
@@ -442,7 +442,7 @@ export const makeShelleyWallet = (constants: typeof MAINNET | typeof TESTNET) => | |||
return Promise.resolve(result) | |||
} | |||
|
|||
private async getStakingKey() { | |||
public async getStakingKey() { |
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.
Muesliswap API needs a staking key to list all open orders. Not sure however if making this method public is the best way to go
@@ -45,8 +45,7 @@ export const asYoroiOrder = (openswapOrder: Order) => { | |||
...rest, | |||
from: asYoroiAmount(from), | |||
to: asYoroiAmount(to), | |||
// TODO: initialize the module with the primary token | |||
deposit: asYoroiAmount({amount: deposit, token: ''}), // token = wallet.primaryTokenInfo['id'] | |||
deposit: deposit as Balance.Quantity, |
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.
Deposit response is a string, so I've also changed it here
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.
it's supposed to be `asYoroiAmount({quantity: asQuantity(deposit), token: ''}), Yoroi will deal only with amounts in the Portfolio manager, token here is the wallet.primaryTokenInfo.id, we should add to the initialization when the factory is invoked.
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.
That's now updated
|
||
// TODO add icons for each pool and change it depending on name | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
export const PoolIcon = ({providerId, size}: {providerId: string; size: number}) => { |
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.
Used in pool selector and open orders list
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.
Do the same as mentioned below.
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.
That's now added
apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/ListOrders/mapOrders.ts
Outdated
Show resolved
Hide resolved
@@ -41,11 +41,12 @@ export const TxHistoryNavigator = () => { | |||
const [modalInfoState, setModalInfoState] = React.useState(false) | |||
const showModalInfo = () => setModalInfoState(true) | |||
const hideModalInfo = () => setModalInfoState(false) | |||
const stakingKey = useStakingKey(wallet) | |||
|
|||
const swapStorage = makeSwapStorage() | |||
const swapAPI = makeSwapApi({ |
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 it also need the primary token info for some of the transformations
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.
That should be now updated
@@ -115,6 +116,18 @@ export const useUtxos = (wallet: YoroiWallet) => { | |||
return wallet.utxos | |||
} | |||
|
|||
export const useStakingKey = (wallet: YoroiWallet) => { |
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.
don't we have it in the wallet. ?
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 see it in the constructor. The getStakingKey
on wallet returns PublicKey
and we need to use a string here.
Resolves YOMO-628
To test the functionality, you may need to