Skip to content

Commit

Permalink
chore: disable onramp option for solana (#2610)
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk authored Jul 29, 2024
1 parent a6416ab commit 4618fab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
9 changes: 9 additions & 0 deletions apps/laboratory/tests/shared/validators/ModalValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,13 @@ export class ModalValidator {
const switchNetworkButton = this.page.getByTestId('w3m-account-select-network')
await expect(switchNetworkButton).toBeVisible()
}

async expectOnrampButton(library: string) {
const onrampButton = this.page.getByTestId('w3m-account-default-onramp-button')
if (library === 'solana') {
await expect(onrampButton).toBeHidden()
} else {
await expect(onrampButton).toBeVisible()
}
}
}
5 changes: 5 additions & 0 deletions apps/laboratory/tests/wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ sampleWalletTest(
await modalPage.closeModal()
}
)

sampleWalletTest('it should not show onramp button accordingly', async ({ library }) => {
await modalPage.openModal()
await modalValidator.expectOnrampButton(library)
})
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,19 @@ export class W3mAccountDefaultWidget extends LitElement {
const { enableOnramp } = OptionsController.state
const isSolana = ChainController.state.activeChain === ConstantsUtil.CHAIN.SOLANA

if (!enableOnramp) {
if (!enableOnramp || isSolana) {
return null
}

return html`
<wui-list-item
data-testid="w3m-account-default-onramp-button"
iconVariant="blue"
icon="card"
?chevron=${!isSolana}
?disabled=${isSolana}
?chevron=${true}
@click=${this.handleClickPay.bind(this)}
>
<wui-text variant="paragraph-500" color="fg-100" ?disabled=${isSolana}>Buy crypto</wui-text>
${isSolana ? html`<wui-tag variant="main">Coming soon</wui-tag>` : ''}
<wui-text variant="paragraph-500" color="fg-100">Buy crypto</wui-text>
</wui-list-item>
`
}
Expand Down

0 comments on commit 4618fab

Please sign in to comment.