Phase 8 — Garuda Prime Integration¶
SDK dan konfigurasi untuk menghubungkan aplikasi Garuda Prime ke Garuda Chain — tanpa perlu hosting/VPS dulu.
Prasyarat Lokal¶
npm run dev:stack # Anvil + deploy + API + Explorer
npm run dev:stack:status # Cek status
| Service | URL |
|---|---|
| RPC Devnet | http://localhost:8545 |
| Explorer | http://localhost:3000 |
| API | http://localhost:4000 |
| Chain ID | 8844 |
SDK¶
Package: @garuda-chain/sdk
npm run sdk:build
npm run prime:config # Tampilkan config semua app
Quick Start¶
import { createGarudaClient, createPrimeClient, switchToGarudaChain } from "@garuda-chain/sdk";
// Client dengan semua contract address devnet
const client = createGarudaClient("devnet");
const block = await client.getBlockNumber();
// Client khusus satu app Garuda Prime
const payClient = createPrimeClient("payhub", "devnet", { privateKey: "0x..." });
await payClient.internalTransfer("0x...", "10", "invoice-001");
// MetaMask — tambah network
await switchToGarudaChain(window.ethereum, "devnet");
Mapping Aplikasi Garuda Prime¶
| App | Contract | SDK Methods |
|---|---|---|
| Garuda Prime Wallet | GAT | getBalance, transferGAT |
| Garuda Pay Hub | GAT, PayHub, Treasury | internalTransfer, merchantPayment |
| Garuda Prime Marketplace | NFT Marketplace, MultiToken | — |
| Garuda Prime Invest | Treasury, Governance | vote |
| Garuda Prime Staking | Staking, Validators | stakeFlexible, claimValidatorRewards |
| Garuda Prime Merchant | PayHub | merchantPayment |
| Garuda Prime NFT | NFT, Identity | registerDID |
| Garuda Identity | Identity | registerDID |
| Garuda Governance | Governance, Treasury | vote |
| Validator Program | Validators, Staking | registerValidator, getValidators |
Network per Environment¶
| Network | Chain ID | RPC (dev) | RPC (production) |
|---|---|---|---|
| Devnet | 8844 | localhost:8545 | — |
| Private Testnet | 8845 | localhost:8540 | — |
| Public Testnet | 8847 | localhost:8555 | rpc.testnet.garudachain.id |
| Mainnet | 8846 | — | rpc.garudachain.id |
Setelah VPS siap, ganti network di SDK:
const client = createGarudaClient("mainnet");
Pastikan chain/deployments/mainnet.json sudah diisi address contract setelah deploy mainnet.
Wallet Add Chain (MetaMask)¶
{
"chainId": "0x2284",
"chainName": "Garuda Chain Devnet",
"nativeCurrency": { "name": "Garuda Asset Token", "symbol": "GAT", "decimals": 18 },
"rpcUrls": ["http://localhost:8545"],
"blockExplorerUrls": ["http://localhost:3000"]
}
Gunakan getWalletAddChainParams("mainnet") untuk production.
Alur Integrasi per App¶
1. Garuda Prime Wallet¶
switchToGarudaChain(provider, network)createGarudaClient(network)— baca saldo GAT- Production: Chain ID 8846
2. Garuda Pay Hub¶
createPrimeClient("payhub", network)- Merchant:
merchantPayment(merchantAddr, amount, orderId) - P2P:
internalTransfer(to, amount, memo)
3. Garuda Prime Staking¶
createPrimeClient("staking", network)stakeFlexible("1000")— flexible stake- Validator:
registerValidator(moniker, website, stake, commission)
Deploy Ulang Devnet¶
Setiap restart Anvil, contract hilang — deploy ulang:
npm run contracts:deploy:devnet
# atau
npm run dev:stack:deploy
Registry tersimpan di chain/deployments/devnet.json.
Checklist Sebelum Go-Live¶
- [ ] Deploy contract mainnet (
npm run contracts:deploy:mainnet) - [ ] Update
chain/deployments/mainnet.json - [ ] Rebuild SDK (
npm run sdk:build) - [ ] Point semua Garuda Prime apps ke
createGarudaClient("mainnet") - [ ] Upload Coming Soon / full stack ke VPS
- [ ] Verifikasi DNS (
npm run prod:verify-dns)
Next¶
Hosting ditunda sampai semua siap. Lanjut lokal:
- Integrasi app Garuda Prime satu per satu
- Testnet Docker (npm run public:up) saat Docker Desktop aktif
- Mainnet deploy dari mesin aman + hardware wallet