- 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.
170 lines
4.1 KiB
Markdown
170 lines
4.1 KiB
Markdown
# Tatum SDK Integration for ChainID 138
|
|
|
|
This directory contains the Tatum SDK integration for DeFi Oracle Meta Mainnet (ChainID 138).
|
|
|
|
## Overview
|
|
|
|
The Tatum SDK allows you to interact with ChainID 138 using a familiar SDK interface while all JSON-RPC traffic goes to your own RPC endpoints.
|
|
|
|
**Important Notes:**
|
|
- With custom RPC, **only RPC calls are redirected to your node**
|
|
- Tatum's cloud services (Notifications, Blockchain Data, etc.) **won't work** on unsupported/private chains
|
|
- Only raw JSON-RPC calls will work
|
|
- Transactions must be signed with `chainId: 138` (EIP-155)
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
cd sdk
|
|
npm install
|
|
```
|
|
|
|
## Configuration
|
|
|
|
1. Copy `.env.example` to `.env`:
|
|
```bash
|
|
cp .env.example .env
|
|
```
|
|
|
|
2. Update `.env` with your RPC endpoint:
|
|
```env
|
|
RPC_URL=http://your-rpc-endpoint:8545
|
|
WS_URL=ws://your-rpc-endpoint:8546
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Basic Connection Test
|
|
|
|
```bash
|
|
npm run test
|
|
```
|
|
|
|
### Run Examples
|
|
|
|
```bash
|
|
# Basic usage example
|
|
npm run example:basic
|
|
|
|
# Send transaction example
|
|
npm run example:transaction
|
|
|
|
# Deploy contract example
|
|
npm run example:contract
|
|
|
|
# Comprehensive smoke test
|
|
npm run smoke-test
|
|
```
|
|
|
|
### Programmatic Usage
|
|
|
|
```typescript
|
|
import { initTatumSDK, verifyConnection } from './tatum-client';
|
|
|
|
// Initialize Tatum SDK
|
|
const tatum = await initTatumSDK({
|
|
rpcUrl: 'http://localhost:8545',
|
|
verbose: true,
|
|
});
|
|
|
|
// Verify connection
|
|
const connectionInfo = await verifyConnection(tatum);
|
|
console.log('Chain ID:', connectionInfo.chainId);
|
|
console.log('Current Block:', connectionInfo.blockNumber);
|
|
|
|
// Make RPC calls
|
|
const blockNumber = await tatum.rpc.request('eth_blockNumber', []);
|
|
const gasPrice = await tatum.rpc.request('eth_gasPrice', []);
|
|
```
|
|
|
|
### Sending Transactions
|
|
|
|
```typescript
|
|
import { ethers } from 'ethers';
|
|
import { CHAIN_ID, DEFAULT_RPC_URL } from './config';
|
|
|
|
// Initialize provider with ChainID 138
|
|
const provider = new ethers.JsonRpcProvider(DEFAULT_RPC_URL, {
|
|
chainId: CHAIN_ID,
|
|
name: 'defi-oracle-mainnet',
|
|
});
|
|
|
|
// Create wallet
|
|
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
|
|
|
|
// Send transaction (must include chainId: 138)
|
|
const tx = await wallet.sendTransaction({
|
|
to: '0xRecipientAddress...',
|
|
value: ethers.parseEther('0.01'),
|
|
chainId: CHAIN_ID, // Important: Must be 138
|
|
});
|
|
|
|
await tx.wait();
|
|
```
|
|
|
|
## Examples
|
|
|
|
### Example 1: Basic Connection
|
|
|
|
See `src/examples/basic-usage.ts` for a complete example of connecting to ChainID 138 and querying chain data.
|
|
|
|
### Example 2: Send Transaction
|
|
|
|
See `src/examples/send-transaction.ts` for an example of sending a transaction with proper chainId.
|
|
|
|
### Example 3: Deploy Contract
|
|
|
|
See `src/examples/deploy-contract.ts` for an example of deploying and interacting with a smart contract.
|
|
|
|
## Verification Checklist
|
|
|
|
- [ ] RPC node is up and accessible at the configured URL
|
|
- [ ] ChainID is 138 (0x8a in hex)
|
|
- [ ] Tatum SDK initialized with custom `rpcUrl`
|
|
- [ ] Transactions signed with `chainId: 138`
|
|
- [ ] RPC calls are working correctly
|
|
|
|
## Troubleshooting
|
|
|
|
### Connection Issues
|
|
|
|
1. **RPC endpoint not responding**
|
|
- Verify RPC node is running
|
|
- Check firewall/network settings
|
|
- Verify RPC_URL in .env
|
|
|
|
2. **Chain ID mismatch**
|
|
- Verify genesis file has chainId: 138
|
|
- Check node configuration
|
|
- Ensure transactions use chainId: 138
|
|
|
|
3. **Transaction failures**
|
|
- Verify chainId is set to 138
|
|
- Check account has sufficient balance
|
|
- Verify gas price and limits
|
|
|
|
### Common Errors
|
|
|
|
- **"Chain ID mismatch"**: Ensure all transactions use `chainId: 138`
|
|
- **"RPC endpoint not reachable"**: Check network connectivity and firewall
|
|
- **"Insufficient balance"**: Fund the account with ETH
|
|
|
|
## Limitations
|
|
|
|
As mentioned in the Tatum documentation:
|
|
- Only RPC calls work with custom RPC endpoints
|
|
- Tatum's cloud services (Notifications, Blockchain Data) won't work
|
|
- No indexer support for private chains
|
|
- Only raw JSON-RPC is available
|
|
|
|
## References
|
|
|
|
- [Tatum SDK Documentation](https://docs.tatum.io/docs/configuration-options)
|
|
- [Ethereum JSON-RPC API](https://ethereum.org/developers/docs/apis/json-rpc/)
|
|
- [EIP-155: Simple replay attack protection](https://eips.ethereum.org/EIPS/eip-155)
|
|
|
|
## Support
|
|
|
|
For issues or questions, please open an issue on the project repository.
|
|
|