mantle-agent-kit-sdk 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +401 -0
- package/dist/index.cjs +247 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +629 -550
- package/dist/index.d.ts +629 -550
- package/dist/index.js +246 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,9 @@ const txHash = await agent.sendTransaction(
|
|
|
44
44
|
| **mETH Protocol** | Mainnet | Liquid staking token |
|
|
45
45
|
| **PikePerps** | Testnet | Perpetual futures trading (up to 100x) |
|
|
46
46
|
| **Squid Router** | Mainnet | Cross-chain swaps via Axelar |
|
|
47
|
+
| **Pyth Network** | Both | Real-time price oracles (80+ assets) |
|
|
48
|
+
| **Token Launchpad** | Both | Deploy ERC20 tokens & RWAs |
|
|
49
|
+
| **NFT Launchpad** | Both | Deploy & mint ERC721 NFT collections |
|
|
47
50
|
|
|
48
51
|
## API Reference
|
|
49
52
|
|
|
@@ -356,6 +359,402 @@ const txHash = await agent.crossChainSwapViaSquid(
|
|
|
356
359
|
|
|
357
360
|
---
|
|
358
361
|
|
|
362
|
+
### Pyth Network - Price Oracles
|
|
363
|
+
|
|
364
|
+
Real-time price feeds for 80+ assets including crypto, forex, commodities, and equities.
|
|
365
|
+
|
|
366
|
+
**All Pyth functions accept three input types:**
|
|
367
|
+
- **Pair name**: `"ETH/USD"`, `"BTC/USD"`, `"MNT/USD"`
|
|
368
|
+
- **Token address**: `"0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2"` (USDC on Mantle)
|
|
369
|
+
- **Price feed ID**: `"0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace"`
|
|
370
|
+
|
|
371
|
+
#### Get Single Price
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
// Using pair name
|
|
375
|
+
const price = await agent.pythGetPrice("ETH/USD");
|
|
376
|
+
|
|
377
|
+
// Using token address (USDC on Mantle)
|
|
378
|
+
const usdcPrice = await agent.pythGetPrice("0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2");
|
|
379
|
+
|
|
380
|
+
// Using mETH token address
|
|
381
|
+
const methPrice = await agent.pythGetPrice("0xcDA86A272531e8640cD7F1a92c01839911B90bb0");
|
|
382
|
+
|
|
383
|
+
// Returns: PythPriceResponse
|
|
384
|
+
// {
|
|
385
|
+
// priceFeedId: string, // "0xff61491a..."
|
|
386
|
+
// pair: string, // "ETH/USD"
|
|
387
|
+
// price: string, // Raw price (e.g., "345000000000")
|
|
388
|
+
// confidence: string, // Confidence interval
|
|
389
|
+
// exponent: number, // Price exponent (e.g., -8)
|
|
390
|
+
// publishTime: number, // Unix timestamp
|
|
391
|
+
// formattedPrice: string // Human readable (e.g., "3450.00")
|
|
392
|
+
// }
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
#### Get EMA Price
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
const emaPrice = await agent.pythGetEmaPrice("ETH/USD");
|
|
399
|
+
// Also accepts token addresses
|
|
400
|
+
const emaByAddress = await agent.pythGetEmaPrice("0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2");
|
|
401
|
+
// Returns: PythPriceResponse (same structure as above)
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
#### Get Token Price by Address
|
|
405
|
+
|
|
406
|
+
Pass any token contract address and get full price details:
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
const price = await agent.pythGetTokenPrice("0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2");
|
|
410
|
+
|
|
411
|
+
// Returns: PythTokenPriceResponse
|
|
412
|
+
// {
|
|
413
|
+
// tokenAddress: "0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2",
|
|
414
|
+
// tokenSymbol: "USDC",
|
|
415
|
+
// pair: "USDC/USD",
|
|
416
|
+
// priceFeedId: "0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
417
|
+
// priceUsd: "1.00",
|
|
418
|
+
// confidence: "50000",
|
|
419
|
+
// exponent: -8,
|
|
420
|
+
// publishTime: 1704700800,
|
|
421
|
+
// lastUpdated: "2024-01-08T12:00:00.000Z"
|
|
422
|
+
// }
|
|
423
|
+
|
|
424
|
+
// More examples
|
|
425
|
+
const methPrice = await agent.pythGetTokenPrice("0xcDA86A272531e8640cD7F1a92c01839911B90bb0"); // mETH
|
|
426
|
+
const wethPrice = await agent.pythGetTokenPrice("0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111"); // WETH
|
|
427
|
+
const wmntPrice = await agent.pythGetTokenPrice("0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8"); // WMNT
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
#### Get Multiple Prices
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
// Mix pair names and token addresses
|
|
434
|
+
const prices = await agent.pythGetMultiplePrices([
|
|
435
|
+
"BTC/USD", // pair name
|
|
436
|
+
"ETH/USD", // pair name
|
|
437
|
+
"0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2", // USDC address
|
|
438
|
+
"0xcDA86A272531e8640cD7F1a92c01839911B90bb0", // mETH address
|
|
439
|
+
]);
|
|
440
|
+
// Returns: PythPriceResponse[]
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### Get Supported Price Feeds
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
const feeds = agent.pythGetSupportedPriceFeeds();
|
|
447
|
+
// Returns: Record<string, string>
|
|
448
|
+
// {
|
|
449
|
+
// "BTC/USD": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
|
|
450
|
+
// "ETH/USD": "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
451
|
+
// ... 80+ more
|
|
452
|
+
// }
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
#### Get Supported Token Addresses
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
const addresses = agent.pythGetSupportedTokenAddresses();
|
|
459
|
+
// Returns: Record<string, string>
|
|
460
|
+
// {
|
|
461
|
+
// "0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2": "USDC/USD",
|
|
462
|
+
// "0xcDA86A272531e8640cD7F1a92c01839911B90bb0": "mETH/USD",
|
|
463
|
+
// "0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8": "MNT/USD",
|
|
464
|
+
// ... more Mantle tokens
|
|
465
|
+
// }
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
#### Check Price Feed Exists
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
// Works with pair names or token addresses
|
|
472
|
+
const exists = await agent.pythPriceFeedExists("ETH/USD");
|
|
473
|
+
const existsByAddress = await agent.pythPriceFeedExists("0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2");
|
|
474
|
+
// Returns: boolean
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
#### Supported Token Addresses (Mantle Network)
|
|
478
|
+
|
|
479
|
+
| Token | Address | Price Feed |
|
|
480
|
+
|-------|---------|------------|
|
|
481
|
+
| WMNT | `0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8` | MNT/USD |
|
|
482
|
+
| WETH | `0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111` | ETH/USD |
|
|
483
|
+
| USDC | `0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2` | USDC/USD |
|
|
484
|
+
| USDT | `0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE` | USDT/USD |
|
|
485
|
+
| mETH | `0xcDA86A272531e8640cD7F1a92c01839911B90bb0` | mETH/USD |
|
|
486
|
+
| WBTC | `0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2` | WBTC/USD |
|
|
487
|
+
| FBTC | `0xc96de26018a54d51c097160568752c4e3bd6c364` | BTC/USD |
|
|
488
|
+
| PENDLE | `0xf83bcc06D6A4A5682adeCA11CF9500f67bFe61AE` | PENDLE/USD |
|
|
489
|
+
|
|
490
|
+
#### Supported Asset Categories
|
|
491
|
+
|
|
492
|
+
| Category | Examples |
|
|
493
|
+
|----------|----------|
|
|
494
|
+
| **Crypto (50+)** | BTC, ETH, SOL, BNB, XRP, ADA, DOGE, AVAX, LINK, UNI, AAVE... |
|
|
495
|
+
| **Layer 2** | ARB, OP, MNT, STRK, IMX |
|
|
496
|
+
| **DeFi** | AAVE, CRV, MKR, SNX, LDO, GMX, PENDLE |
|
|
497
|
+
| **Stablecoins** | USDC, USDT, DAI, FRAX, BUSD |
|
|
498
|
+
| **LST Tokens** | stETH, wstETH, cbETH, rETH, mETH |
|
|
499
|
+
| **Meme Coins** | SHIB, PEPE, BONK, WIF, FLOKI |
|
|
500
|
+
| **Forex** | EUR/USD, GBP/USD, JPY/USD |
|
|
501
|
+
| **Commodities** | XAU (Gold), XAG (Silver), WTI, BRENT |
|
|
502
|
+
| **Equities** | AAPL, NVDA, TSLA, MSFT, GOOGL, AMZN |
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
### Token Launchpad
|
|
507
|
+
|
|
508
|
+
Deploy ERC20 tokens and RWA (Real World Asset) tokens with supply minted to your address.
|
|
509
|
+
|
|
510
|
+
#### Deploy Standard Token
|
|
511
|
+
|
|
512
|
+
```typescript
|
|
513
|
+
const result = await agent.deployStandardToken(
|
|
514
|
+
name: string, // e.g., "My Token"
|
|
515
|
+
symbol: string, // e.g., "MTK"
|
|
516
|
+
supply: string // Human readable, e.g., "1000000" (1M tokens)
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
// Returns: TokenDeploymentResult
|
|
520
|
+
// {
|
|
521
|
+
// tokenAddress: string, // Deployed contract address
|
|
522
|
+
// txHash: string, // Transaction hash
|
|
523
|
+
// name: string,
|
|
524
|
+
// symbol: string,
|
|
525
|
+
// decimals: number, // Always 18
|
|
526
|
+
// totalSupply: string, // Supply in wei
|
|
527
|
+
// mintedTo: string, // Your wallet address
|
|
528
|
+
// tokenType: "standard"
|
|
529
|
+
// }
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
#### Deploy RWA Token
|
|
533
|
+
|
|
534
|
+
```typescript
|
|
535
|
+
const result = await agent.deployRWAToken(
|
|
536
|
+
name: string, // e.g., "Manhattan Property Token"
|
|
537
|
+
symbol: string, // e.g., "MPT"
|
|
538
|
+
supply: string, // Fractional shares, e.g., "10000"
|
|
539
|
+
assetType: string, // "Real Estate" | "Commodities" | "Securities" | "Art"
|
|
540
|
+
assetId?: string // External reference, e.g., "PROP-NYC-001"
|
|
541
|
+
);
|
|
542
|
+
|
|
543
|
+
// Returns: TokenDeploymentResult
|
|
544
|
+
// {
|
|
545
|
+
// tokenAddress: string,
|
|
546
|
+
// txHash: string,
|
|
547
|
+
// name: string,
|
|
548
|
+
// symbol: string,
|
|
549
|
+
// decimals: number,
|
|
550
|
+
// totalSupply: string,
|
|
551
|
+
// mintedTo: string,
|
|
552
|
+
// tokenType: "rwa",
|
|
553
|
+
// assetType: string, // "Real Estate"
|
|
554
|
+
// assetId: string // "PROP-NYC-001"
|
|
555
|
+
// }
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
#### Generic Token Deployment
|
|
559
|
+
|
|
560
|
+
```typescript
|
|
561
|
+
const result = await agent.deployToken(
|
|
562
|
+
name: string,
|
|
563
|
+
symbol: string,
|
|
564
|
+
supply: string,
|
|
565
|
+
tokenType?: "standard" | "rwa", // default: "standard"
|
|
566
|
+
assetType?: string, // For RWA only
|
|
567
|
+
assetId?: string // For RWA only
|
|
568
|
+
);
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
#### Get Token Info
|
|
572
|
+
|
|
573
|
+
```typescript
|
|
574
|
+
const info = await agent.getTokenInfo(
|
|
575
|
+
tokenAddress: Address,
|
|
576
|
+
holder?: Address // Optional: get balance for this address
|
|
577
|
+
);
|
|
578
|
+
|
|
579
|
+
// Returns: TokenInfo
|
|
580
|
+
// {
|
|
581
|
+
// address: string,
|
|
582
|
+
// name: string,
|
|
583
|
+
// symbol: string,
|
|
584
|
+
// decimals: number,
|
|
585
|
+
// totalSupply: string,
|
|
586
|
+
// balance?: string // If holder provided
|
|
587
|
+
// }
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
#### Get Token Balance
|
|
591
|
+
|
|
592
|
+
```typescript
|
|
593
|
+
const balance = await agent.getTokenBalance(
|
|
594
|
+
tokenAddress: Address,
|
|
595
|
+
holder?: Address // Defaults to agent address
|
|
596
|
+
);
|
|
597
|
+
// Returns: string (balance in wei)
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
#### Transfer Tokens
|
|
601
|
+
|
|
602
|
+
```typescript
|
|
603
|
+
const txHash = await agent.transferToken(
|
|
604
|
+
tokenAddress: Address,
|
|
605
|
+
to: Address,
|
|
606
|
+
amount: string // Amount in wei
|
|
607
|
+
);
|
|
608
|
+
// Returns: Hex (transaction hash)
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
### NFT Launchpad
|
|
614
|
+
|
|
615
|
+
Deploy ERC721 NFT collections and mint NFTs.
|
|
616
|
+
|
|
617
|
+
#### Deploy NFT Collection
|
|
618
|
+
|
|
619
|
+
```typescript
|
|
620
|
+
const result = await agent.deployNFTCollection({
|
|
621
|
+
name: string, // e.g., "My NFT Collection"
|
|
622
|
+
symbol: string, // e.g., "MNFT"
|
|
623
|
+
baseURI: string, // e.g., "ipfs://QmXXX/"
|
|
624
|
+
maxSupply?: number // 0 for unlimited
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
// Returns: NFTCollectionDeploymentResult
|
|
628
|
+
// {
|
|
629
|
+
// collectionAddress: string,
|
|
630
|
+
// txHash: string,
|
|
631
|
+
// name: string,
|
|
632
|
+
// symbol: string,
|
|
633
|
+
// baseURI: string,
|
|
634
|
+
// maxSupply: number,
|
|
635
|
+
// deployer: string
|
|
636
|
+
// }
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
#### Deploy with Preset
|
|
640
|
+
|
|
641
|
+
```typescript
|
|
642
|
+
const result = await agent.deployNFTCollectionWithPreset(
|
|
643
|
+
preset: "pfp" | "art" | "membership" | "unlimited",
|
|
644
|
+
name: string,
|
|
645
|
+
symbol: string,
|
|
646
|
+
baseURI: string
|
|
647
|
+
);
|
|
648
|
+
// Presets: pfp=10000, art=1000, membership=100, unlimited=0
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
#### Mint NFT
|
|
652
|
+
|
|
653
|
+
```typescript
|
|
654
|
+
const result = await agent.mintNFT(
|
|
655
|
+
collectionAddress: Address,
|
|
656
|
+
to?: Address // Defaults to agent address
|
|
657
|
+
);
|
|
658
|
+
|
|
659
|
+
// Returns: NFTMintResult
|
|
660
|
+
// {
|
|
661
|
+
// txHash: string,
|
|
662
|
+
// tokenId: string,
|
|
663
|
+
// collectionAddress: string,
|
|
664
|
+
// to: string
|
|
665
|
+
// }
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
#### Batch Mint
|
|
669
|
+
|
|
670
|
+
```typescript
|
|
671
|
+
const result = await agent.batchMintNFT(
|
|
672
|
+
collectionAddress: Address,
|
|
673
|
+
to: Address,
|
|
674
|
+
quantity: number
|
|
675
|
+
);
|
|
676
|
+
|
|
677
|
+
// Returns:
|
|
678
|
+
// {
|
|
679
|
+
// txHash: Hex,
|
|
680
|
+
// startTokenId: string,
|
|
681
|
+
// quantity: number
|
|
682
|
+
// }
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
#### Get Collection Info
|
|
686
|
+
|
|
687
|
+
```typescript
|
|
688
|
+
const info = await agent.getNFTCollectionInfo(
|
|
689
|
+
collectionAddress: Address,
|
|
690
|
+
holder?: Address
|
|
691
|
+
);
|
|
692
|
+
|
|
693
|
+
// Returns: NFTCollectionInfo
|
|
694
|
+
// {
|
|
695
|
+
// address: string,
|
|
696
|
+
// name: string,
|
|
697
|
+
// symbol: string,
|
|
698
|
+
// totalSupply: string,
|
|
699
|
+
// balanceOf?: string // If holder provided
|
|
700
|
+
// }
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
#### Get Token Info
|
|
704
|
+
|
|
705
|
+
```typescript
|
|
706
|
+
const info = await agent.getNFTTokenInfo(
|
|
707
|
+
collectionAddress: Address,
|
|
708
|
+
tokenId: string
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
// Returns: NFTTokenInfo
|
|
712
|
+
// {
|
|
713
|
+
// collectionAddress: string,
|
|
714
|
+
// tokenId: string,
|
|
715
|
+
// owner: string,
|
|
716
|
+
// tokenURI: string
|
|
717
|
+
// }
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
#### Transfer NFT
|
|
721
|
+
|
|
722
|
+
```typescript
|
|
723
|
+
// Standard transfer
|
|
724
|
+
const txHash = await agent.transferNFT(
|
|
725
|
+
collectionAddress: Address,
|
|
726
|
+
to: Address,
|
|
727
|
+
tokenId: string
|
|
728
|
+
);
|
|
729
|
+
|
|
730
|
+
// Safe transfer (checks recipient)
|
|
731
|
+
const txHash = await agent.safeTransferNFT(
|
|
732
|
+
collectionAddress: Address,
|
|
733
|
+
to: Address,
|
|
734
|
+
tokenId: string
|
|
735
|
+
);
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
#### Approve NFT
|
|
739
|
+
|
|
740
|
+
```typescript
|
|
741
|
+
// Approve single NFT
|
|
742
|
+
const txHash = await agent.approveNFT(
|
|
743
|
+
collectionAddress: Address,
|
|
744
|
+
approved: Address,
|
|
745
|
+
tokenId: string
|
|
746
|
+
);
|
|
747
|
+
|
|
748
|
+
// Approve all NFTs in collection
|
|
749
|
+
const txHash = await agent.setApprovalForAllNFT(
|
|
750
|
+
collectionAddress: Address,
|
|
751
|
+
operator: Address,
|
|
752
|
+
approved: boolean
|
|
753
|
+
);
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
---
|
|
757
|
+
|
|
359
758
|
## Configuration
|
|
360
759
|
|
|
361
760
|
### Environment Variables
|
|
@@ -415,6 +814,7 @@ const result = await demoAgent.swapOnUniswap(tokenA, tokenB, amount);
|
|
|
415
814
|
|
|
416
815
|
| Protocol | Contract | Address |
|
|
417
816
|
|----------|----------|---------|
|
|
817
|
+
| **Pyth Network** | Oracle | `0xA2aa501b19aff244D90cc15a4Cf739D2725B5729` |
|
|
418
818
|
| **mETH** | Token | `0xcDA86A272531e8640cD7F1a92c01839911B90bb0` |
|
|
419
819
|
| **WETH** | Token | `0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111` |
|
|
420
820
|
| **WMNT** | Token | `0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8` |
|
|
@@ -429,6 +829,7 @@ const result = await demoAgent.swapOnUniswap(tokenA, tokenB, amount);
|
|
|
429
829
|
|
|
430
830
|
| Protocol | Contract | Address |
|
|
431
831
|
|----------|----------|---------|
|
|
832
|
+
| **Pyth Network** | Oracle | `0x98046Bd286715D3B0BC227Dd7a956b83D8978603` |
|
|
432
833
|
| **PikePerps** | PerpetualTrading | `0x8081b646f349c049f2d5e8a400057d411dd657bd` |
|
|
433
834
|
| **PikePerps** | BondingCurveMarket | `0x93b268325A9862645c82b32229f3B52264750Ca2` |
|
|
434
835
|
|