Skip to content

Commit

Permalink
chore: update cbpay configs
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk committed Jan 3, 2024
1 parent 8dd4b14 commit a27df69
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 9 additions & 0 deletions packages/core/src/utils/ConstantsUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ export const ConstantsUtil = {
* Network name to Coinbase Pay SDK chain name map object
* @see supported chain names on Coinbase for Pay SDK: https://github.com/coinbase/cbpay-js/blob/d4bda2c05c4d5917c8db6a05476b603546046394/src/types/onramp.ts
*/
WC_COINBASE_PAY_SDK_CHAINS: [
'ethereum',
'arbitrum',
'polygon',
'avalanche-c-chain',
'optimism',
'celo'
],

WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP: {
Ethereum: 'ethereum',
'Arbitrum One': 'arbitrum',
Expand Down
11 changes: 9 additions & 2 deletions packages/scaffold/src/views/w3m-onramp-providers-view/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
ConstantsUtil,
OnRampController,
type OnRampProvider,
RouterController
RouterController,
NetworkController
} from '@web3modal/core'
import { customElement } from '@web3modal/ui'
import { LitElement, html } from 'lit'
Expand Down Expand Up @@ -68,15 +69,21 @@ export class W3mOnRampProvidersView extends LitElement {

private getCoinbaseOnRampURL() {
const address = AccountController.state.address
const network = NetworkController.state.caipNetwork

if (!address) {
throw new Error('No address found')
}

if (!network) {
throw new Error('No network found')
}

return generateOnRampURL({
appId: ConstantsUtil.WC_COINBASE_ONRAMP_APP_ID,
defaultNetwork: network.name,
destinationWallets: [
{ address, blockchains: ['ethereum', 'avalanche-c-chain', 'polygon'], assets: ['USDC'] }
{ address, blockchains: ConstantsUtil.WC_COINBASE_PAY_SDK_CHAINS, assets: ['USDC'] }
],
partnerUserId: address
})
Expand Down

0 comments on commit a27df69

Please sign in to comment.