- Introduced Aggregator.sol for Chainlink-compatible oracle functionality, including round-based updates and access control. - Added OracleWithCCIP.sol to extend Aggregator with CCIP cross-chain messaging capabilities. - Created .gitmodules to include OpenZeppelin contracts as a submodule. - Developed a comprehensive deployment guide in NEXT_STEPS_COMPLETE_GUIDE.md for Phase 2 and smart contract deployment. - Implemented Vite configuration for the orchestration portal, supporting both Vue and React frameworks. - Added server-side logic for the Multi-Cloud Orchestration Portal, including API endpoints for environment management and monitoring. - Created scripts for resource import and usage validation across non-US regions. - Added tests for CCIP error handling and integration to ensure robust functionality. - Included various new files and directories for the orchestration portal and deployment scripts.
135 lines
2.7 KiB
Markdown
135 lines
2.7 KiB
Markdown
# MetaMask Quick Start for ChainID 138
|
|
|
|
Quick reference for adding ChainID 138 to MetaMask and adding tokens.
|
|
|
|
## Add Network to MetaMask
|
|
|
|
### Method 1: Using the SDK
|
|
|
|
```typescript
|
|
import { addOrSwitchNetwork } from '@defi-oracle/metamask-sdk';
|
|
|
|
await addOrSwitchNetwork();
|
|
```
|
|
|
|
### Method 2: Using wallet_addEthereumChain
|
|
|
|
```javascript
|
|
await window.ethereum.request({
|
|
method: 'wallet_addEthereumChain',
|
|
params: [{
|
|
chainId: '0x8a',
|
|
chainName: 'DeFi Oracle Meta Mainnet',
|
|
nativeCurrency: {
|
|
name: 'Ether',
|
|
symbol: 'ETH',
|
|
decimals: 18
|
|
},
|
|
rpcUrls: ['https://rpc.d-bis.org'],
|
|
blockExplorerUrls: ['https://explorer.d-bis.org']
|
|
}]
|
|
});
|
|
```
|
|
|
|
### Method 3: Using Chainlist
|
|
|
|
1. Visit [chainlist.org](https://chainlist.org)
|
|
2. Search for "ChainID 138" or "DeFi Oracle Meta"
|
|
3. Click "Add to MetaMask"
|
|
|
|
### Method 4: Switch to ChainID 138
|
|
|
|
```javascript
|
|
await window.ethereum.request({
|
|
method: 'wallet_switchEthereumChain',
|
|
params: [{ chainId: '0x8a' }]
|
|
});
|
|
```
|
|
|
|
## Add Token to MetaMask
|
|
|
|
### Using the SDK
|
|
|
|
```typescript
|
|
import { addToken } from '@defi-oracle/metamask-sdk';
|
|
|
|
await addToken(
|
|
'0xYourTokenAddress',
|
|
'WETH',
|
|
18,
|
|
'https://explorer.d-bis.org/images/tokens/weth.png'
|
|
);
|
|
```
|
|
|
|
### Using wallet_watchAsset (EIP-747)
|
|
|
|
```javascript
|
|
await window.ethereum.request({
|
|
method: 'wallet_watchAsset',
|
|
params: {
|
|
type: 'ERC20',
|
|
options: {
|
|
address: '0xYourTokenAddress',
|
|
symbol: 'WETH',
|
|
decimals: 18,
|
|
image: 'https://explorer.d-bis.org/images/tokens/weth.png'
|
|
}
|
|
}
|
|
});
|
|
```
|
|
|
|
## Network Information
|
|
|
|
- **ChainID**: 138 (0x8a)
|
|
- **Chain Name**: DeFi Oracle Meta Mainnet
|
|
- **Native Currency**: ETH (18 decimals)
|
|
- **RPC URL**: `https://rpc.d-bis.org`
|
|
- **Block Explorer**: `https://explorer.d-bis.org`
|
|
|
|
## Common Tokens
|
|
|
|
### WETH (Wrapped Ether)
|
|
|
|
- **Address**: `0x...` (Update after deployment)
|
|
- **Symbol**: WETH
|
|
- **Decimals**: 18
|
|
|
|
## Troubleshooting
|
|
|
|
### MetaMask not detected
|
|
|
|
```javascript
|
|
if (typeof window.ethereum === 'undefined') {
|
|
alert('Please install MetaMask');
|
|
window.open('https://metamask.io/download/', '_blank');
|
|
}
|
|
```
|
|
|
|
### Network already added
|
|
|
|
If the network is already added, use `wallet_switchEthereumChain` instead:
|
|
|
|
```javascript
|
|
try {
|
|
await window.ethereum.request({
|
|
method: 'wallet_switchEthereumChain',
|
|
params: [{ chainId: '0x8a' }]
|
|
});
|
|
} catch (error) {
|
|
// Network not added, add it
|
|
if (error.code === 4902) {
|
|
await window.ethereum.request({
|
|
method: 'wallet_addEthereumChain',
|
|
params: [/* network metadata */]
|
|
});
|
|
}
|
|
}
|
|
```
|
|
|
|
## Links
|
|
|
|
- [MetaMask Documentation](https://docs.metamask.io)
|
|
- [Chainlist](https://chainlist.org/chain/138)
|
|
- [Explorer](https://explorer.d-bis.org)
|
|
|