Skip to content
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(ramps): introduces dynamic support for rampable networks #24041

Merged
merged 93 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
8bda667
feat(ramps): introduce dynamic support for rampable networks
georgeweiler Apr 16, 2024
7c4ba77
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Apr 16, 2024
c4f1fb9
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 16, 2024
7fe1f84
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 16, 2024
5349c10
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Apr 17, 2024
8fecf66
refactor(ramps): updates file directory to organize ramps hooks and u…
georgeweiler Apr 17, 2024
364713f
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Apr 17, 2024
91521fc
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 17, 2024
988e985
chore(ramps): cleans up some code based on review comments
georgeweiler Apr 18, 2024
ba291c7
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Apr 18, 2024
9de918e
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 18, 2024
4e18dbf
chore(ramps): updates mock-send-state to use up to date list of buyab…
georgeweiler Apr 18, 2024
3afb831
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Apr 18, 2024
7048723
chore: fixes ramp api test
georgeweiler Apr 18, 2024
62b1e54
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 19, 2024
bf646c7
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Apr 19, 2024
69fb2f8
chore: fixes network interface issues
georgeweiler Apr 19, 2024
1d29388
chore: fix lint issue
georgeweiler Apr 19, 2024
2d84d11
chore: updates privacy snapshot for e2e tests
georgeweiler Apr 19, 2024
48fe591
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 19, 2024
13ac2b7
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 22, 2024
707f387
chore: use set instead of append for url params
georgeweiler Apr 22, 2024
e8bbf4f
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Apr 22, 2024
04b5c8f
feat(ramps): adds more defensible code to protect against corrupted r…
georgeweiler Apr 22, 2024
c1d8b09
chore: add https://on-ramp-content.uat-api.cx.metamask.io/ to privacy…
georgeweiler Apr 22, 2024
f938618
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Apr 22, 2024
0091f86
chore: fixes ramps api test
georgeweiler Apr 22, 2024
debd520
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Apr 22, 2024
bb7a204
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler May 1, 2024
48c028a
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler May 7, 2024
c193631
chore: adds ramp api to privact snapshot
georgeweiler May 10, 2024
81858cf
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler May 10, 2024
2a8cc16
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 10, 2024
75f0806
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 10, 2024
142d6ad
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 14, 2024
1497a38
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 14, 2024
0d26083
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 14, 2024
a9d8eec
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 15, 2024
29fe0bf
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 15, 2024
b2f55c3
Merge branch 'develop' into ramps-buyable-networks
nikoferro May 16, 2024
a5b3403
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 16, 2024
5825434
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 16, 2024
c977225
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 17, 2024
0303f25
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler May 17, 2024
ca784bf
chore: removes require-actual from routes component test
georgeweiler May 17, 2024
8862e20
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler May 17, 2024
c08abf9
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 20, 2024
53606d7
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 20, 2024
4cb8b13
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 21, 2024
3331cbc
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 21, 2024
a9cfbf2
Merge branch 'develop' into ramps-buyable-networks
georgeweiler May 21, 2024
4450851
Merge branch 'develop' into ramps-buyable-networks
wachunei May 22, 2024
d75e639
Merge branch 'develop' into ramps-buyable-networks
wachunei May 24, 2024
19d0c7a
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Jun 18, 2024
335e99e
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Jun 18, 2024
52088d3
chore(ramps): removes previously deleted files
georgeweiler Jun 18, 2024
e4312d6
chore(ramps): fixes linting errors after rebasing with develop branch
georgeweiler Jun 18, 2024
8782836
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Jun 19, 2024
fc643ab
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
71ebebc
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
c9b1dab
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
379a2d8
chore(ramps): adds build gate comment to import that failed linting
georgeweiler Jun 20, 2024
29fa2e6
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Jun 20, 2024
6ede0cd
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
8565acd
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
fb2de48
chore(ramps): adds more build gate comments to import that failed lin…
georgeweiler Jun 20, 2024
e18e3f5
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Jun 20, 2024
9abd7f2
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
6cb9380
chore(ramps): adds more build gate comments to import that failed lin…
georgeweiler Jun 20, 2024
d6e03ff
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Jun 20, 2024
ef42cf6
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 20, 2024
242d3b9
chore(ramps): adds more build gate comments to import that failed lin…
georgeweiler Jun 20, 2024
9fef50a
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Jun 20, 2024
530eab0
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
df96b09
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
cf96285
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
800793f
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
7c09dc0
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
6403c53
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
7e8f644
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
dd07da1
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
49737ac
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
2e2dc80
chore(ramps): fixes linting errors after rebasing with develop branch
georgeweiler Jun 21, 2024
030af03
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
87515c9
Merge branch 'develop' into ramps-buyable-networks
georgeweiler Jun 21, 2024
e66e77c
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Jun 24, 2024
b637252
fix(ramps): use jest.mocked instead of suppressing TS error
georgeweiler Jun 24, 2024
ee44685
Merge branch 'ramps-buyable-networks' of https://github.com/MetaMask/…
georgeweiler Jun 24, 2024
a53b8b2
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Jun 26, 2024
13bdc3b
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Jun 27, 2024
ba2eefa
feat(ramps): do not make requests to ramp api if basic functionality …
georgeweiler Jun 27, 2024
1c56c3f
Merge branch 'develop' of https://github.com/MetaMask/metamask-extens…
georgeweiler Jun 27, 2024
7ee6250
fix: resolves mmi e2e test error
georgeweiler Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ env:
# Enables the notifications feature within the build:
- NOTIFICATIONS: ''

- METAMASK_RAMP_API_CONTENT_BASE_URL: https://on-ramp-content.api.cx.metamask.io

###
# Meta variables
###
Expand Down
2 changes: 2 additions & 0 deletions privacy-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"phishing-detection.api.cx.metamask.io",
"portfolio.metamask.io",
"price.api.cx.metamask.io",
"on-ramp-content.api.cx.metamask.io",
"on-ramp-content.uat-api.cx.metamask.io",
"proxy.api.cx.metamask.io",
"raw.githubusercontent.com",
"registry.npmjs.org",
Expand Down
118 changes: 0 additions & 118 deletions shared/constants/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,6 @@ export type RPCDefinition = {
rpcPrefs: RPCPreferences;
};

/**
* For each chain that we support fiat onramps for, we provide a set of
* configuration options that help for initializing the connectiong to the
* onramp providers.
*/
type BuyableChainSettings = {
/**
* The native currency for the given chain
*/
nativeCurrency: CurrencySymbol | TestNetworkCurrencySymbol;
/**
* The network name or identifier
*/
network: string;
};

/**
* Throughout the extension we set the current provider by referencing its
* "type", which can be any of the values in the below object. These values
Expand Down Expand Up @@ -908,108 +892,6 @@ export const UNSUPPORTED_RPC_METHODS = new Set([

export const IPFS_DEFAULT_GATEWAY_URL = 'dweb.link';

// The first item in transakCurrencies must be the
// default crypto currency for the network
const BUYABLE_CHAIN_ETHEREUM_NETWORK_NAME = 'ethereum';

export const BUYABLE_CHAINS_MAP: {
[K in Exclude<
ChainId,
| typeof CHAIN_IDS.LOCALHOST
| typeof CHAIN_IDS.OPTIMISM_TESTNET
| typeof CHAIN_IDS.OPTIMISM_GOERLI
| typeof CHAIN_IDS.BASE_TESTNET
| typeof CHAIN_IDS.OPBNB_TESTNET
| typeof CHAIN_IDS.OPBNB
| typeof CHAIN_IDS.BSC_TESTNET
| typeof CHAIN_IDS.POLYGON_TESTNET
| typeof CHAIN_IDS.AVALANCHE_TESTNET
| typeof CHAIN_IDS.FANTOM_TESTNET
| typeof CHAIN_IDS.MOONBEAM_TESTNET
| typeof CHAIN_IDS.LINEA_GOERLI
| typeof CHAIN_IDS.LINEA_SEPOLIA
| typeof CHAIN_IDS.GOERLI
| typeof CHAIN_IDS.SEPOLIA
| typeof CHAIN_IDS.GNOSIS
| typeof CHAIN_IDS.AURORA
| typeof CHAIN_IDS.ARBITRUM_GOERLI
| typeof CHAIN_IDS.BLAST
| typeof CHAIN_IDS.FILECOIN
| typeof CHAIN_IDS.POLYGON_ZKEVM
| typeof CHAIN_IDS.SCROLL
| typeof CHAIN_IDS.SCROLL_SEPOLIA
| typeof CHAIN_IDS.WETHIO
| typeof CHAIN_IDS.CHZ
| typeof CHAIN_IDS.NUMBERS
| typeof CHAIN_IDS.SEI
>]: BuyableChainSettings;
} = {
[CHAIN_IDS.MAINNET]: {
nativeCurrency: CURRENCY_SYMBOLS.ETH,
network: BUYABLE_CHAIN_ETHEREUM_NETWORK_NAME,
},
[CHAIN_IDS.BSC]: {
nativeCurrency: CURRENCY_SYMBOLS.BNB,
network: 'bsc',
},
[CHAIN_IDS.POLYGON]: {
nativeCurrency: CURRENCY_SYMBOLS.MATIC,
network: 'polygon',
},
[CHAIN_IDS.AVALANCHE]: {
nativeCurrency: CURRENCY_SYMBOLS.AVALANCHE,
network: 'avaxcchain',
},
[CHAIN_IDS.FANTOM]: {
nativeCurrency: CURRENCY_SYMBOLS.FANTOM,
network: 'fantom',
},
[CHAIN_IDS.CELO]: {
nativeCurrency: CURRENCY_SYMBOLS.CELO,
network: 'celo',
},
[CHAIN_IDS.OPTIMISM]: {
nativeCurrency: CURRENCY_SYMBOLS.ETH,
network: 'optimism',
},
[CHAIN_IDS.ARBITRUM]: {
nativeCurrency: CURRENCY_SYMBOLS.ARBITRUM,
network: 'arbitrum',
},
[CHAIN_IDS.CRONOS]: {
nativeCurrency: CURRENCY_SYMBOLS.CRONOS,
network: 'cronos',
},
[CHAIN_IDS.MOONBEAM]: {
nativeCurrency: CURRENCY_SYMBOLS.GLIMMER,
network: 'moonbeam',
},
[CHAIN_IDS.MOONRIVER]: {
nativeCurrency: CURRENCY_SYMBOLS.MOONRIVER,
network: 'moonriver',
},
[CHAIN_IDS.HARMONY]: {
nativeCurrency: CURRENCY_SYMBOLS.ONE,
network: 'harmony',
},
[CHAIN_IDS.PALM]: {
nativeCurrency: CURRENCY_SYMBOLS.PALM,
network: 'palm',
},
[CHAIN_IDS.LINEA_MAINNET]: {
nativeCurrency: CURRENCY_SYMBOLS.ETH,
network: 'linea',
},
[CHAIN_IDS.ZKSYNC_ERA]: {
nativeCurrency: CURRENCY_SYMBOLS.ETH,
network: 'zksync',
},
[CHAIN_IDS.BASE]: {
nativeCurrency: CURRENCY_SYMBOLS.ETH,
network: 'base',
},
};

export const FEATURED_RPCS: RPCDefinition[] = [
{
chainId: CHAIN_IDS.ARBITRUM,
Expand Down
137 changes: 137 additions & 0 deletions test/data/mock-send-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,143 @@
],
"swapsState": {}
},
"ramps": {
"buyableChains": [
{
"active": true,
"chainId": 1,
"chainName": "Ethereum Mainnet",
"shortName": "Ethereum",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 10,
"chainName": "Optimism Mainnet",
"shortName": "Optimism",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 25,
"chainName": "Cronos Mainnet",
"shortName": "Cronos",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 56,
"chainName": "BNB Chain Mainnet",
"shortName": "BNB Chain",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 100,
"chainName": "Gnosis Mainnet",
"shortName": "Gnosis",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 137,
"chainName": "Polygon Mainnet",
"shortName": "Polygon",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 250,
"chainName": "Fantom Mainnet",
"shortName": "Fantom",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 324,
"chainName": "zkSync Era Mainnet",
"shortName": "zkSync Era",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 1101,
"chainName": "Polygon zkEVM",
"shortName": "Polygon zkEVM",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 1284,
"chainName": "Moonbeam Mainnet",
"shortName": "Moonbeam",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 1285,
"chainName": "Moonriver Mainnet",
"shortName": "Moonriver",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 8453,
"chainName": "Base Mainnet",
"shortName": "Base",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 42161,
"chainName": "Arbitrum Mainnet",
"shortName": "Arbitrum",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 42220,
"chainName": "Celo Mainnet",
"shortName": "Celo",
"nativeTokenSupported": false
},
{
"active": true,
"chainId": 43114,
"chainName": "Avalanche C-Chain Mainnet",
"shortName": "Avalanche C-Chain",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 59144,
"chainName": "Linea",
"shortName": "Linea",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 1313161554,
"chainName": "Aurora Mainnet",
"shortName": "Aurora",
"nativeTokenSupported": false
},
{
"active": true,
"chainId": 1666600000,
"chainName": "Harmony Mainnet (Shard 0)",
"shortName": "Harmony (Shard 0)",
"nativeTokenSupported": true
},
{
"active": true,
"chainId": 11297108109,
"chainName": "Palm Mainnet",
"shortName": "Palm",
"nativeTokenSupported": false
}
]
},
"send": {
"amountMode": "INPUT",
"currentTransactionUUID": "1-tx",
Expand Down
Loading