mantle-agent-kit-sdk 1.0.4 → 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 +1693 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1226 -45
- package/dist/index.d.ts +1226 -45
- package/dist/index.js +1667 -4
- package/dist/index.js.map +1 -1
- package/package.json +16 -3
package/dist/index.cjs
CHANGED
|
@@ -472,8 +472,8 @@ async function approveToken2(agent, tokenAddress, spenderAddress, amount) {
|
|
|
472
472
|
return { approved: true, txHash: null };
|
|
473
473
|
}
|
|
474
474
|
console.log("Insufficient allowance, approving tokens...");
|
|
475
|
-
const { encodeFunctionData:
|
|
476
|
-
const approveData =
|
|
475
|
+
const { encodeFunctionData: encodeFunctionData14 } = await import('viem');
|
|
476
|
+
const approveData = encodeFunctionData14({
|
|
477
477
|
abi: viem.erc20Abi,
|
|
478
478
|
functionName: "approve",
|
|
479
479
|
args: [spenderAddress, BigInt(amount)]
|
|
@@ -2190,6 +2190,1412 @@ async function pikeperpsGetMarketData(agent, tokenAddress, limit = 20) {
|
|
|
2190
2190
|
};
|
|
2191
2191
|
}
|
|
2192
2192
|
|
|
2193
|
+
// src/constants/pyth/index.ts
|
|
2194
|
+
var pyth_exports = {};
|
|
2195
|
+
__export(pyth_exports, {
|
|
2196
|
+
HERMES_ENDPOINT: () => HERMES_ENDPOINT,
|
|
2197
|
+
PYTH_ABI: () => PYTH_ABI,
|
|
2198
|
+
PYTH_CONTRACT: () => PYTH_CONTRACT,
|
|
2199
|
+
PYTH_PRICE_FEED_IDS: () => PYTH_PRICE_FEED_IDS,
|
|
2200
|
+
TOKEN_ADDRESS_TO_PRICE_FEED: () => TOKEN_ADDRESS_TO_PRICE_FEED,
|
|
2201
|
+
isTokenAddress: () => isTokenAddress,
|
|
2202
|
+
resolvePriceFeedInput: () => resolvePriceFeedInput
|
|
2203
|
+
});
|
|
2204
|
+
var PYTH_CONTRACT = {
|
|
2205
|
+
mainnet: "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
|
|
2206
|
+
testnet: "0x98046Bd286715D3B0BC227Dd7a956b83D8978603"
|
|
2207
|
+
};
|
|
2208
|
+
var HERMES_ENDPOINT = {
|
|
2209
|
+
mainnet: "https://hermes.pyth.network",
|
|
2210
|
+
testnet: "https://hermes.pyth.network"
|
|
2211
|
+
};
|
|
2212
|
+
var PYTH_PRICE_FEED_IDS = {
|
|
2213
|
+
// === Major Cryptocurrencies ===
|
|
2214
|
+
"BTC/USD": "e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43",
|
|
2215
|
+
"ETH/USD": "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
2216
|
+
"SOL/USD": "ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d",
|
|
2217
|
+
"BNB/USD": "2f95862b045670cd22bee3114c39763a4a08beeb663b145d283c31d7d1101c4f",
|
|
2218
|
+
"XRP/USD": "ec5d399846a9209f3fe5881d70aae9268c94339ff9817e8d18ff19fa05eea1c8",
|
|
2219
|
+
"ADA/USD": "2a01deaec9e51a579277b34b122399984d0bbf57e2458a7e42fecd2829867a0d",
|
|
2220
|
+
"DOGE/USD": "dcef50dd0a4cd2dcc17e45df1676dcb336a11a61c69df7a0299b0150c672d25c",
|
|
2221
|
+
"DOT/USD": "ca3eed9b267293f6595901c734c7525ce8ef49adafe8284571c8e17d6c926346",
|
|
2222
|
+
"AVAX/USD": "93da3352f9f1d105fdfe4971cfa80e9dd777bfc5d0f683ebb6e1294b92137bb7",
|
|
2223
|
+
"MATIC/USD": "5de33440f6b7d0d7d70f0a7b2a6c0e0b8e5d2f7c8a9b0c1d2e3f4a5b6c7d8e9f",
|
|
2224
|
+
"LINK/USD": "8ac0c70fff57e9aefdf5edf44b51d62c2d433653cbb2cf5cc06bb115af04d221",
|
|
2225
|
+
"ATOM/USD": "b00b60f88b03a6a625a8d1c048c3f66653edf217439cb6a1cbab0c1c5e8c52bd",
|
|
2226
|
+
"LTC/USD": "6e3f3fa8253588df9326580180233eb791e03b443a3ba7a1d892e73874e19a54",
|
|
2227
|
+
"UNI/USD": "78d185a741d07edb3412b09008b7c5cfb9bbbd7d568bf00ba737b456ba171501",
|
|
2228
|
+
"NEAR/USD": "c415de8d2eba7db216527dff4b60e8f3a5311c740dadb233e13e12547e226750",
|
|
2229
|
+
"TRX/USD": "67aed5a24fdad045475e7195c98a98aea119c763f272d4523f5bac93a4f33c2b",
|
|
2230
|
+
// === Layer 2 & Scaling ===
|
|
2231
|
+
"ARB/USD": "3fa4252848f9f0a1480be62745a4629d9eb1322aebab8a791e344b3b9c1adcf5",
|
|
2232
|
+
"OP/USD": "385f64d993f7b77d8182ed5003d97c60aa3361f3cecfe711544d2d59165e9bdf",
|
|
2233
|
+
"MNT/USD": "4e3037c822d852d79af3ac80e35eb420ee3b870dca49f9344a38ef4773fb0585",
|
|
2234
|
+
"IMX/USD": "941320a8989414a6d2c757c8c6c52b3e7e0b7e4e4c5bb8a3c8e7a0f3e0f0f0f0",
|
|
2235
|
+
"STRK/USD": "6a182399ff70ccf3e06024898942028204125a819e519a335ffa4579e66cd870",
|
|
2236
|
+
// === DeFi Tokens ===
|
|
2237
|
+
"AAVE/USD": "2b9ab1e972a281585084148ba1389800799bd4be63b957507db1349314e47445",
|
|
2238
|
+
"CRV/USD": "a19d04ac696c7a6616d291c7e5d1377cc8be437c327b75adb5dc1bad745fcae8",
|
|
2239
|
+
"MKR/USD": "9375299e31c0deb9c6bc378e6329aab44cb48ec655552a70d4b9050346a30378",
|
|
2240
|
+
"SNX/USD": "39d020f60982ed892abbcd4a06a276a9f9b7bfbce003204c110b6e488f502da3",
|
|
2241
|
+
"COMP/USD": "4a8e42861cabc5ecb50996f92e7cfa2bce3fd0a2423b0c44c9b423fb2bd25478",
|
|
2242
|
+
"LDO/USD": "c63e2a7f37a04e5e614c07238bedb25dcc38927e77a90a4b21a7a2e1d7f0d2e3",
|
|
2243
|
+
"1INCH/USD": "63f341689d98a12ef60a5cff1d7f85c70a9e17bf1575f0e7c0b2512d48b1c8b3",
|
|
2244
|
+
"SUSHI/USD": "26e4f737fde0263a9eea10ae63ac36dcedab2aaf629f1e31a28a28dd0e0d2b0c",
|
|
2245
|
+
"YFI/USD": "425f4b198ab2504936886c1e93511bb6720fbcf2045a4f3c0723bb213846022f",
|
|
2246
|
+
"BAL/USD": "07ad7b4a7662d19a6bc675f6b467172d2f3947fa653ca97555a9b20236406628",
|
|
2247
|
+
"CAKE/USD": "2356af9529a1064d1d2a2e3e4ab6d6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6f6e6",
|
|
2248
|
+
"GMX/USD": "b962539d0fcb272a494d65ea56f94851c2bcf8823935da05bd628916e2e9edbf",
|
|
2249
|
+
"PENDLE/USD": "9a4df90b25497f66b1afb012467e316e801ca3d839456db028892fe8c70c8016",
|
|
2250
|
+
"JOE/USD": "1e8a156c8a23c1e56f2d9d7f0e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e",
|
|
2251
|
+
// === Stablecoins ===
|
|
2252
|
+
"USDC/USD": "eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a",
|
|
2253
|
+
"USDT/USD": "2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b",
|
|
2254
|
+
"DAI/USD": "b0948a5e5313200c632b51bb5ca32f6de0d36e9950a942d19751e833f70dabfd",
|
|
2255
|
+
"FRAX/USD": "c3d5d8d6d0c0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0",
|
|
2256
|
+
"BUSD/USD": "5bc91f13e412c07599167bae86f07543f076a638962b8d6017ec19dab4a82814",
|
|
2257
|
+
"TUSD/USD": "433faaa801ecda2c0bbfa8f4e2d85fd4c310e2c1e5f8f8e6e5f5f5f5f5f5f5f5",
|
|
2258
|
+
"LUSD/USD": "d892ae586f4e0fbeee4d64f29ed6e89b1b3e2e2e2e2e2e2e2e2e2e2e2e2e2e2e",
|
|
2259
|
+
// === Wrapped & LST Tokens ===
|
|
2260
|
+
"WETH/USD": "ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
|
|
2261
|
+
"WBTC/USD": "c9d8b075a5c69303365ae23633d4e085199bf5c520a3b90fed1322a0342ffc33",
|
|
2262
|
+
"stETH/USD": "846ae1bdb6300b817cee5fdee2a6da192775030db5615b94a465f53bd40850b5",
|
|
2263
|
+
"cbETH/USD": "15ecddd26d49e1a8f1de9376ebebc03916ede873447c1255d2d5891b92ce5717",
|
|
2264
|
+
"rETH/USD": "a0255134973f4fdf2f8f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
|
|
2265
|
+
"mETH/USD": "4c9c6f9f0cde13fced52dc1927c8c06a91b1a65ab77b9e1ec1c614963ce90dd4",
|
|
2266
|
+
"wstETH/USD": "6df640f3b8963d8f8358f791f352b8364513f6ab1cca5ed3f1f7b5448980e784",
|
|
2267
|
+
// === Meme Coins ===
|
|
2268
|
+
"SHIB/USD": "f0d57deca57b3da2fe63a493f4c25925fdfd8edf834b20f93e1f84dbd1504d4a",
|
|
2269
|
+
"PEPE/USD": "d69731a2e74ac1ce884fc3890f7ee324b6deb66147055249568869ed700882e4",
|
|
2270
|
+
"FLOKI/USD": "6b1381ce7e874dc5410b197ac8348162c0dd6c0d4c9cd6322c28a6f7f4d1a2d2",
|
|
2271
|
+
"BONK/USD": "72b021217ca3fe68922a19aaf990109cb9d84e9ad004b4d2025ad6f529314419",
|
|
2272
|
+
"WIF/USD": "4ca4beeca86f0d164160323817a4e42b10010a724c2217c6ee41b54cd4cc61fc",
|
|
2273
|
+
// === Gaming & Metaverse ===
|
|
2274
|
+
"AXS/USD": "b0d8f5e3f3a7c0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0",
|
|
2275
|
+
"SAND/USD": "f4040ec3e5b71c241a7e1a9a1e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e",
|
|
2276
|
+
"MANA/USD": "2b15e4bded7f5e5d5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a",
|
|
2277
|
+
"GALA/USD": "e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3e3",
|
|
2278
|
+
"APE/USD": "15add95022ae13563a11992e727c91bdb6b55bc183d9d747436c80a483d8c864",
|
|
2279
|
+
"ENJ/USD": "5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a5a",
|
|
2280
|
+
// === Infrastructure & Oracles ===
|
|
2281
|
+
"FIL/USD": "150ac9b959aee0051e4091f0ef5216d941f590e1c5e7f91cf7635b5c11628c0e",
|
|
2282
|
+
"GRT/USD": "4d1f8dae0d96236fb98e8f47571a70f41c8b8f2f6d6c0e0e0e0e0e0e0e0e0e0e",
|
|
2283
|
+
"RNDR/USD": "ab7347771135fc733f8f38db462ba085ed3309955f42554a14fa13e855ac0e2f",
|
|
2284
|
+
"INJ/USD": "7a5bc1d2b56ad029048cd63964b3ad2776eadf812edc1a43a31406cb54bff592",
|
|
2285
|
+
"AR/USD": "8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c",
|
|
2286
|
+
"THETA/USD": "4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a",
|
|
2287
|
+
"PYTH/USD": "0bbf28e9a841a1cc788f6a361b17ca072d0ea3098a1e5df1c3922d06719579ff",
|
|
2288
|
+
// === AI & Data ===
|
|
2289
|
+
"FET/USD": "b49ee9d8ccf9b6e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0e0",
|
|
2290
|
+
"OCEAN/USD": "2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d2d",
|
|
2291
|
+
"TAO/USD": "410f41de235f2dbdf41f1a808c1e15f6a9e7d6a7b8c9d0e1f2a3b4c5d6e7f8a9",
|
|
2292
|
+
// === Exchange Tokens ===
|
|
2293
|
+
"FTT/USD": "6c75e52531ec5fd3ef253f6062956a8508a2f03fa0a209fb7dbc0d0f3d6f6f6f",
|
|
2294
|
+
"CRO/USD": "b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7b7",
|
|
2295
|
+
"OKB/USD": "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744",
|
|
2296
|
+
// === Forex Pairs ===
|
|
2297
|
+
"EUR/USD": "a995d00bb36a63cef7fd2c287dc105fc8f3d93779f062f09551b0af3e81ec30b",
|
|
2298
|
+
"GBP/USD": "84c2dde9633d93d1bcad84e7dc41c9d56578b7ec52fabedc1f335d673df0a7c1",
|
|
2299
|
+
"JPY/USD": "ef2c98c804ba503c6a707e38be4dfbb16683775f195b091252bf24693042fd52",
|
|
2300
|
+
"AUD/USD": "67a6f93030f4217f2e8f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
|
|
2301
|
+
"CAD/USD": "9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a",
|
|
2302
|
+
// === Commodities ===
|
|
2303
|
+
"XAU/USD": "765d2ba906dbc32ca17cc11f5310a89e9ee1f6420508c63861f2f8ba4ee34bb2",
|
|
2304
|
+
"XAG/USD": "f2fb02c32b055c805e7238d628e5e9dadef274376114eb1f012337cabe93871e",
|
|
2305
|
+
"WTI/USD": "c9c8e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9e9",
|
|
2306
|
+
"BRENT/USD": "d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8d8",
|
|
2307
|
+
// === US Equities ===
|
|
2308
|
+
"AAPL/USD": "49f6b65cb1de6b10eaf75e7c03ca029c306d0357e91b5311b175084a5ad55688",
|
|
2309
|
+
"NVDA/USD": "b1073854ed24cbc755dc527418f52b7d271f6cc967bbf8d8129112b18860a593",
|
|
2310
|
+
"TSLA/USD": "16dad506d7db8da01c87581c87ca897a012a153557d4d578c3b9c9e1bc0632f1",
|
|
2311
|
+
"GOOGL/USD": "b7e3904c08ddd9c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0",
|
|
2312
|
+
"AMZN/USD": "c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6c6",
|
|
2313
|
+
"MSFT/USD": "d0ca23c1cc005e004ccf1db5bf76aeb6a49218f43dac3d4b275e92de12ea4b77",
|
|
2314
|
+
"META/USD": "a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4a4",
|
|
2315
|
+
"COIN/USD": "9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b9b",
|
|
2316
|
+
"SPY/USD": "19e09bb805456ada3979a7d1cbb4b6d63babc3a0f8e8a9b3c4d5e6f7a8b9c0d1",
|
|
2317
|
+
"QQQ/USD": "2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e"
|
|
2318
|
+
};
|
|
2319
|
+
var PYTH_ABI = [
|
|
2320
|
+
{
|
|
2321
|
+
inputs: [{ name: "id", type: "bytes32" }],
|
|
2322
|
+
name: "getPrice",
|
|
2323
|
+
outputs: [
|
|
2324
|
+
{
|
|
2325
|
+
components: [
|
|
2326
|
+
{ name: "price", type: "int64" },
|
|
2327
|
+
{ name: "conf", type: "uint64" },
|
|
2328
|
+
{ name: "expo", type: "int32" },
|
|
2329
|
+
{ name: "publishTime", type: "uint256" }
|
|
2330
|
+
],
|
|
2331
|
+
name: "",
|
|
2332
|
+
type: "tuple"
|
|
2333
|
+
}
|
|
2334
|
+
],
|
|
2335
|
+
stateMutability: "view",
|
|
2336
|
+
type: "function"
|
|
2337
|
+
},
|
|
2338
|
+
{
|
|
2339
|
+
inputs: [{ name: "id", type: "bytes32" }],
|
|
2340
|
+
name: "getPriceNoOlderThan",
|
|
2341
|
+
outputs: [
|
|
2342
|
+
{
|
|
2343
|
+
components: [
|
|
2344
|
+
{ name: "price", type: "int64" },
|
|
2345
|
+
{ name: "conf", type: "uint64" },
|
|
2346
|
+
{ name: "expo", type: "int32" },
|
|
2347
|
+
{ name: "publishTime", type: "uint256" }
|
|
2348
|
+
],
|
|
2349
|
+
name: "",
|
|
2350
|
+
type: "tuple"
|
|
2351
|
+
}
|
|
2352
|
+
],
|
|
2353
|
+
stateMutability: "view",
|
|
2354
|
+
type: "function"
|
|
2355
|
+
},
|
|
2356
|
+
{
|
|
2357
|
+
inputs: [
|
|
2358
|
+
{ name: "id", type: "bytes32" },
|
|
2359
|
+
{ name: "age", type: "uint256" }
|
|
2360
|
+
],
|
|
2361
|
+
name: "getPriceNoOlderThan",
|
|
2362
|
+
outputs: [
|
|
2363
|
+
{
|
|
2364
|
+
components: [
|
|
2365
|
+
{ name: "price", type: "int64" },
|
|
2366
|
+
{ name: "conf", type: "uint64" },
|
|
2367
|
+
{ name: "expo", type: "int32" },
|
|
2368
|
+
{ name: "publishTime", type: "uint256" }
|
|
2369
|
+
],
|
|
2370
|
+
name: "",
|
|
2371
|
+
type: "tuple"
|
|
2372
|
+
}
|
|
2373
|
+
],
|
|
2374
|
+
stateMutability: "view",
|
|
2375
|
+
type: "function"
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
inputs: [{ name: "id", type: "bytes32" }],
|
|
2379
|
+
name: "getPriceUnsafe",
|
|
2380
|
+
outputs: [
|
|
2381
|
+
{
|
|
2382
|
+
components: [
|
|
2383
|
+
{ name: "price", type: "int64" },
|
|
2384
|
+
{ name: "conf", type: "uint64" },
|
|
2385
|
+
{ name: "expo", type: "int32" },
|
|
2386
|
+
{ name: "publishTime", type: "uint256" }
|
|
2387
|
+
],
|
|
2388
|
+
name: "",
|
|
2389
|
+
type: "tuple"
|
|
2390
|
+
}
|
|
2391
|
+
],
|
|
2392
|
+
stateMutability: "view",
|
|
2393
|
+
type: "function"
|
|
2394
|
+
},
|
|
2395
|
+
{
|
|
2396
|
+
inputs: [{ name: "id", type: "bytes32" }],
|
|
2397
|
+
name: "getEmaPrice",
|
|
2398
|
+
outputs: [
|
|
2399
|
+
{
|
|
2400
|
+
components: [
|
|
2401
|
+
{ name: "price", type: "int64" },
|
|
2402
|
+
{ name: "conf", type: "uint64" },
|
|
2403
|
+
{ name: "expo", type: "int32" },
|
|
2404
|
+
{ name: "publishTime", type: "uint256" }
|
|
2405
|
+
],
|
|
2406
|
+
name: "",
|
|
2407
|
+
type: "tuple"
|
|
2408
|
+
}
|
|
2409
|
+
],
|
|
2410
|
+
stateMutability: "view",
|
|
2411
|
+
type: "function"
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
inputs: [{ name: "updateData", type: "bytes[]" }],
|
|
2415
|
+
name: "updatePriceFeeds",
|
|
2416
|
+
outputs: [],
|
|
2417
|
+
stateMutability: "payable",
|
|
2418
|
+
type: "function"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
inputs: [{ name: "updateData", type: "bytes[]" }],
|
|
2422
|
+
name: "getUpdateFee",
|
|
2423
|
+
outputs: [{ name: "feeAmount", type: "uint256" }],
|
|
2424
|
+
stateMutability: "view",
|
|
2425
|
+
type: "function"
|
|
2426
|
+
},
|
|
2427
|
+
{
|
|
2428
|
+
inputs: [{ name: "id", type: "bytes32" }],
|
|
2429
|
+
name: "priceFeedExists",
|
|
2430
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2431
|
+
stateMutability: "view",
|
|
2432
|
+
type: "function"
|
|
2433
|
+
},
|
|
2434
|
+
{
|
|
2435
|
+
inputs: [
|
|
2436
|
+
{ name: "updateData", type: "bytes[]" },
|
|
2437
|
+
{ name: "priceIds", type: "bytes32[]" },
|
|
2438
|
+
{ name: "minPublishTime", type: "uint64" },
|
|
2439
|
+
{ name: "maxPublishTime", type: "uint64" }
|
|
2440
|
+
],
|
|
2441
|
+
name: "parsePriceFeedUpdates",
|
|
2442
|
+
outputs: [
|
|
2443
|
+
{
|
|
2444
|
+
components: [
|
|
2445
|
+
{ name: "id", type: "bytes32" },
|
|
2446
|
+
{
|
|
2447
|
+
components: [
|
|
2448
|
+
{ name: "price", type: "int64" },
|
|
2449
|
+
{ name: "conf", type: "uint64" },
|
|
2450
|
+
{ name: "expo", type: "int32" },
|
|
2451
|
+
{ name: "publishTime", type: "uint256" }
|
|
2452
|
+
],
|
|
2453
|
+
name: "price",
|
|
2454
|
+
type: "tuple"
|
|
2455
|
+
},
|
|
2456
|
+
{
|
|
2457
|
+
components: [
|
|
2458
|
+
{ name: "price", type: "int64" },
|
|
2459
|
+
{ name: "conf", type: "uint64" },
|
|
2460
|
+
{ name: "expo", type: "int32" },
|
|
2461
|
+
{ name: "publishTime", type: "uint256" }
|
|
2462
|
+
],
|
|
2463
|
+
name: "emaPrice",
|
|
2464
|
+
type: "tuple"
|
|
2465
|
+
}
|
|
2466
|
+
],
|
|
2467
|
+
name: "",
|
|
2468
|
+
type: "tuple[]"
|
|
2469
|
+
}
|
|
2470
|
+
],
|
|
2471
|
+
stateMutability: "payable",
|
|
2472
|
+
type: "function"
|
|
2473
|
+
}
|
|
2474
|
+
];
|
|
2475
|
+
var TOKEN_ADDRESS_TO_PRICE_FEED = {
|
|
2476
|
+
// Native and Wrapped tokens
|
|
2477
|
+
"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE": { pair: "MNT/USD", feedId: PYTH_PRICE_FEED_IDS["MNT/USD"] },
|
|
2478
|
+
// Native MNT
|
|
2479
|
+
"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8": { pair: "MNT/USD", feedId: PYTH_PRICE_FEED_IDS["MNT/USD"] },
|
|
2480
|
+
// WMNT
|
|
2481
|
+
"0xdEAddEaDdeadDEadDEADDEAddEADDEAddead1111": { pair: "ETH/USD", feedId: PYTH_PRICE_FEED_IDS["ETH/USD"] },
|
|
2482
|
+
// WETH
|
|
2483
|
+
// Stablecoins
|
|
2484
|
+
"0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2": { pair: "USDC/USD", feedId: PYTH_PRICE_FEED_IDS["USDC/USD"] },
|
|
2485
|
+
// USDC
|
|
2486
|
+
"0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE": { pair: "USDT/USD", feedId: PYTH_PRICE_FEED_IDS["USDT/USD"] },
|
|
2487
|
+
// USDT
|
|
2488
|
+
// LST Tokens
|
|
2489
|
+
"0xcDA86A272531e8640cD7F1a92c01839911B90bb0": { pair: "mETH/USD", feedId: PYTH_PRICE_FEED_IDS["mETH/USD"] },
|
|
2490
|
+
// mETH
|
|
2491
|
+
// Additional Mantle tokens (commonly traded)
|
|
2492
|
+
"0xCAbAE6f6Ea1ecaB08Ad02fE02ce9A44F09aebfA2": { pair: "WBTC/USD", feedId: PYTH_PRICE_FEED_IDS["WBTC/USD"] },
|
|
2493
|
+
// WBTC
|
|
2494
|
+
"0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000": { pair: "ETH/USD", feedId: PYTH_PRICE_FEED_IDS["ETH/USD"] },
|
|
2495
|
+
// ETH (canonical)
|
|
2496
|
+
// USDe and other stablecoins
|
|
2497
|
+
"0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34": { pair: "USDC/USD", feedId: PYTH_PRICE_FEED_IDS["USDC/USD"] },
|
|
2498
|
+
// USDe (pegged to USD)
|
|
2499
|
+
// Pendle
|
|
2500
|
+
"0xf83bcc06D6A4A5682adeCA11CF9500f67bFe61AE": { pair: "PENDLE/USD", feedId: PYTH_PRICE_FEED_IDS["PENDLE/USD"] },
|
|
2501
|
+
// PENDLE
|
|
2502
|
+
// FBTC
|
|
2503
|
+
"0xc96de26018a54d51c097160568752c4e3bd6c364": { pair: "BTC/USD", feedId: PYTH_PRICE_FEED_IDS["BTC/USD"] },
|
|
2504
|
+
// FBTC
|
|
2505
|
+
// Aurelius tokens (staked versions)
|
|
2506
|
+
"0xe6829d9a7eE3040e1276Fa75293Bde931859e8fA": { pair: "MNT/USD", feedId: PYTH_PRICE_FEED_IDS["MNT/USD"] }
|
|
2507
|
+
// cmETH
|
|
2508
|
+
};
|
|
2509
|
+
function isTokenAddress(input) {
|
|
2510
|
+
return /^0x[a-fA-F0-9]{40}$/i.test(input);
|
|
2511
|
+
}
|
|
2512
|
+
function resolvePriceFeedInput(input) {
|
|
2513
|
+
const normalizedInput = input.toLowerCase();
|
|
2514
|
+
if (isTokenAddress(input)) {
|
|
2515
|
+
for (const [addr, info] of Object.entries(TOKEN_ADDRESS_TO_PRICE_FEED)) {
|
|
2516
|
+
if (addr.toLowerCase() === normalizedInput) {
|
|
2517
|
+
return { pair: info.pair, feedId: info.feedId };
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return null;
|
|
2521
|
+
}
|
|
2522
|
+
if (input in PYTH_PRICE_FEED_IDS) {
|
|
2523
|
+
return {
|
|
2524
|
+
pair: input,
|
|
2525
|
+
feedId: PYTH_PRICE_FEED_IDS[input]
|
|
2526
|
+
};
|
|
2527
|
+
}
|
|
2528
|
+
const normalizedId = input.replace("0x", "");
|
|
2529
|
+
const foundPair = Object.entries(PYTH_PRICE_FEED_IDS).find(
|
|
2530
|
+
([, id]) => id === normalizedId
|
|
2531
|
+
);
|
|
2532
|
+
if (foundPair) {
|
|
2533
|
+
return { pair: foundPair[0], feedId: foundPair[1] };
|
|
2534
|
+
}
|
|
2535
|
+
return null;
|
|
2536
|
+
}
|
|
2537
|
+
|
|
2538
|
+
// src/tools/pyth/getPrice.ts
|
|
2539
|
+
async function pythGetPrice(agent, input) {
|
|
2540
|
+
const pythAddress = PYTH_CONTRACT[agent.chain];
|
|
2541
|
+
const resolved = resolvePriceFeedInput(input);
|
|
2542
|
+
let priceFeedId;
|
|
2543
|
+
let pair;
|
|
2544
|
+
if (resolved) {
|
|
2545
|
+
priceFeedId = resolved.feedId;
|
|
2546
|
+
pair = resolved.pair;
|
|
2547
|
+
} else {
|
|
2548
|
+
priceFeedId = input;
|
|
2549
|
+
pair = input;
|
|
2550
|
+
}
|
|
2551
|
+
const feedId = priceFeedId.startsWith("0x") ? priceFeedId : `0x${priceFeedId}`;
|
|
2552
|
+
if (agent.demo) {
|
|
2553
|
+
return createMockPythResponse(pair, feedId);
|
|
2554
|
+
}
|
|
2555
|
+
try {
|
|
2556
|
+
const priceData = await agent.client.readContract({
|
|
2557
|
+
address: pythAddress,
|
|
2558
|
+
abi: PYTH_ABI,
|
|
2559
|
+
functionName: "getPriceUnsafe",
|
|
2560
|
+
args: [feedId]
|
|
2561
|
+
});
|
|
2562
|
+
const price = Number(priceData.price);
|
|
2563
|
+
const confidence = Number(priceData.conf);
|
|
2564
|
+
const exponent = priceData.expo;
|
|
2565
|
+
const publishTime = Number(priceData.publishTime);
|
|
2566
|
+
const formattedPrice = formatPythPrice(price, exponent);
|
|
2567
|
+
return {
|
|
2568
|
+
priceFeedId: feedId,
|
|
2569
|
+
pair,
|
|
2570
|
+
price: priceData.price.toString(),
|
|
2571
|
+
confidence: priceData.conf.toString(),
|
|
2572
|
+
exponent,
|
|
2573
|
+
publishTime,
|
|
2574
|
+
formattedPrice
|
|
2575
|
+
};
|
|
2576
|
+
} catch (error) {
|
|
2577
|
+
throw new Error(
|
|
2578
|
+
`Failed to fetch price from Pyth: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
async function pythGetEmaPrice(agent, input) {
|
|
2583
|
+
const pythAddress = PYTH_CONTRACT[agent.chain];
|
|
2584
|
+
const resolved = resolvePriceFeedInput(input);
|
|
2585
|
+
let priceFeedId;
|
|
2586
|
+
let pair;
|
|
2587
|
+
if (resolved) {
|
|
2588
|
+
priceFeedId = resolved.feedId;
|
|
2589
|
+
pair = resolved.pair;
|
|
2590
|
+
} else {
|
|
2591
|
+
priceFeedId = input;
|
|
2592
|
+
pair = input;
|
|
2593
|
+
}
|
|
2594
|
+
const feedId = priceFeedId.startsWith("0x") ? priceFeedId : `0x${priceFeedId}`;
|
|
2595
|
+
if (agent.demo) {
|
|
2596
|
+
return createMockPythResponse(pair, feedId);
|
|
2597
|
+
}
|
|
2598
|
+
try {
|
|
2599
|
+
const priceData = await agent.client.readContract({
|
|
2600
|
+
address: pythAddress,
|
|
2601
|
+
abi: PYTH_ABI,
|
|
2602
|
+
functionName: "getEmaPrice",
|
|
2603
|
+
args: [feedId]
|
|
2604
|
+
});
|
|
2605
|
+
const formattedPrice = formatPythPrice(
|
|
2606
|
+
Number(priceData.price),
|
|
2607
|
+
priceData.expo
|
|
2608
|
+
);
|
|
2609
|
+
return {
|
|
2610
|
+
priceFeedId: feedId,
|
|
2611
|
+
pair,
|
|
2612
|
+
price: priceData.price.toString(),
|
|
2613
|
+
confidence: priceData.conf.toString(),
|
|
2614
|
+
exponent: priceData.expo,
|
|
2615
|
+
publishTime: Number(priceData.publishTime),
|
|
2616
|
+
formattedPrice
|
|
2617
|
+
};
|
|
2618
|
+
} catch (error) {
|
|
2619
|
+
throw new Error(
|
|
2620
|
+
`Failed to fetch EMA price from Pyth: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
2621
|
+
);
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
function formatPythPrice(price, exponent) {
|
|
2625
|
+
const adjustedPrice = price * Math.pow(10, exponent);
|
|
2626
|
+
if (adjustedPrice >= 1) {
|
|
2627
|
+
return adjustedPrice.toFixed(2);
|
|
2628
|
+
} else {
|
|
2629
|
+
return adjustedPrice.toFixed(8);
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
async function pythGetTokenPrice(agent, tokenAddress) {
|
|
2633
|
+
if (!isTokenAddress(tokenAddress)) {
|
|
2634
|
+
throw new Error(`Invalid token address format: ${tokenAddress}. Must be a valid Ethereum address (0x...)`);
|
|
2635
|
+
}
|
|
2636
|
+
const normalizedAddress = tokenAddress.toLowerCase();
|
|
2637
|
+
let tokenInfo = null;
|
|
2638
|
+
let originalAddress = tokenAddress;
|
|
2639
|
+
for (const [addr, info] of Object.entries(TOKEN_ADDRESS_TO_PRICE_FEED)) {
|
|
2640
|
+
if (addr.toLowerCase() === normalizedAddress) {
|
|
2641
|
+
tokenInfo = info;
|
|
2642
|
+
originalAddress = addr;
|
|
2643
|
+
break;
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2646
|
+
if (!tokenInfo) {
|
|
2647
|
+
throw new Error(
|
|
2648
|
+
`Token address not supported: ${tokenAddress}. Use pythGetSupportedTokenAddresses() to see available tokens.`
|
|
2649
|
+
);
|
|
2650
|
+
}
|
|
2651
|
+
const tokenSymbol = tokenInfo.pair.split("/")[0] || "UNKNOWN";
|
|
2652
|
+
const feedId = tokenInfo.feedId.startsWith("0x") ? tokenInfo.feedId : `0x${tokenInfo.feedId}`;
|
|
2653
|
+
if (agent.demo) {
|
|
2654
|
+
return createMockTokenPriceResponse(originalAddress, tokenSymbol, tokenInfo.pair, feedId);
|
|
2655
|
+
}
|
|
2656
|
+
const pythAddress = PYTH_CONTRACT[agent.chain];
|
|
2657
|
+
try {
|
|
2658
|
+
const priceData = await agent.client.readContract({
|
|
2659
|
+
address: pythAddress,
|
|
2660
|
+
abi: PYTH_ABI,
|
|
2661
|
+
functionName: "getPriceUnsafe",
|
|
2662
|
+
args: [feedId]
|
|
2663
|
+
});
|
|
2664
|
+
const formattedPrice = formatPythPrice(Number(priceData.price), priceData.expo);
|
|
2665
|
+
const publishTime = Number(priceData.publishTime);
|
|
2666
|
+
return {
|
|
2667
|
+
tokenAddress: originalAddress,
|
|
2668
|
+
tokenSymbol,
|
|
2669
|
+
pair: tokenInfo.pair,
|
|
2670
|
+
priceFeedId: feedId,
|
|
2671
|
+
priceUsd: formattedPrice,
|
|
2672
|
+
confidence: priceData.conf.toString(),
|
|
2673
|
+
exponent: priceData.expo,
|
|
2674
|
+
publishTime,
|
|
2675
|
+
lastUpdated: new Date(publishTime * 1e3).toISOString()
|
|
2676
|
+
};
|
|
2677
|
+
} catch (error) {
|
|
2678
|
+
throw new Error(
|
|
2679
|
+
`Failed to fetch price for token ${tokenAddress}: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
2680
|
+
);
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
function createMockPythResponse(pair, feedId) {
|
|
2684
|
+
const mockPrices = {
|
|
2685
|
+
// Major Crypto
|
|
2686
|
+
"BTC/USD": 97500,
|
|
2687
|
+
"ETH/USD": 3450,
|
|
2688
|
+
"SOL/USD": 185,
|
|
2689
|
+
"BNB/USD": 680,
|
|
2690
|
+
"XRP/USD": 2.35,
|
|
2691
|
+
"ADA/USD": 0.95,
|
|
2692
|
+
"DOGE/USD": 0.32,
|
|
2693
|
+
"DOT/USD": 7.2,
|
|
2694
|
+
"AVAX/USD": 38,
|
|
2695
|
+
"MATIC/USD": 0.48,
|
|
2696
|
+
"LINK/USD": 22,
|
|
2697
|
+
"ATOM/USD": 9.5,
|
|
2698
|
+
"LTC/USD": 105,
|
|
2699
|
+
"UNI/USD": 13.5,
|
|
2700
|
+
"NEAR/USD": 5.2,
|
|
2701
|
+
"TRX/USD": 0.25,
|
|
2702
|
+
// L2
|
|
2703
|
+
"ARB/USD": 0.85,
|
|
2704
|
+
"OP/USD": 1.95,
|
|
2705
|
+
"MNT/USD": 0.85,
|
|
2706
|
+
"STRK/USD": 0.45,
|
|
2707
|
+
// DeFi
|
|
2708
|
+
"AAVE/USD": 285,
|
|
2709
|
+
"CRV/USD": 0.52,
|
|
2710
|
+
"MKR/USD": 1850,
|
|
2711
|
+
"SNX/USD": 2.8,
|
|
2712
|
+
"LDO/USD": 1.85,
|
|
2713
|
+
"GMX/USD": 28,
|
|
2714
|
+
"PENDLE/USD": 4.2,
|
|
2715
|
+
// Stablecoins
|
|
2716
|
+
"USDC/USD": 1,
|
|
2717
|
+
"USDT/USD": 1,
|
|
2718
|
+
"DAI/USD": 1,
|
|
2719
|
+
// LST
|
|
2720
|
+
"mETH/USD": 3500,
|
|
2721
|
+
"stETH/USD": 3450,
|
|
2722
|
+
"wstETH/USD": 4100,
|
|
2723
|
+
// Meme
|
|
2724
|
+
"SHIB/USD": 22e-6,
|
|
2725
|
+
"PEPE/USD": 18e-6,
|
|
2726
|
+
"BONK/USD": 28e-6,
|
|
2727
|
+
"WIF/USD": 1.85,
|
|
2728
|
+
// Commodities
|
|
2729
|
+
"XAU/USD": 2650,
|
|
2730
|
+
"XAG/USD": 31,
|
|
2731
|
+
// Forex
|
|
2732
|
+
"EUR/USD": 1.08,
|
|
2733
|
+
"GBP/USD": 1.27,
|
|
2734
|
+
"JPY/USD": 67e-4,
|
|
2735
|
+
// Equities
|
|
2736
|
+
"AAPL/USD": 248,
|
|
2737
|
+
"NVDA/USD": 138,
|
|
2738
|
+
"TSLA/USD": 385,
|
|
2739
|
+
"MSFT/USD": 425
|
|
2740
|
+
};
|
|
2741
|
+
const price = mockPrices[pair] || 100;
|
|
2742
|
+
const decimals = price < 0.01 ? 8 : price < 1 ? 4 : 2;
|
|
2743
|
+
return {
|
|
2744
|
+
priceFeedId: feedId,
|
|
2745
|
+
pair,
|
|
2746
|
+
price: Math.floor(price * 1e8).toString(),
|
|
2747
|
+
confidence: "50000",
|
|
2748
|
+
exponent: -8,
|
|
2749
|
+
publishTime: Math.floor(Date.now() / 1e3),
|
|
2750
|
+
formattedPrice: price.toFixed(decimals)
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
function createMockTokenPriceResponse(tokenAddress, tokenSymbol, pair, feedId) {
|
|
2754
|
+
const mockPrices = {
|
|
2755
|
+
"USDC": 1,
|
|
2756
|
+
"USDT": 1,
|
|
2757
|
+
"DAI": 1,
|
|
2758
|
+
"ETH": 3450,
|
|
2759
|
+
"WETH": 3450,
|
|
2760
|
+
"BTC": 97500,
|
|
2761
|
+
"WBTC": 97500,
|
|
2762
|
+
"MNT": 0.85,
|
|
2763
|
+
"WMNT": 0.85,
|
|
2764
|
+
"mETH": 3500,
|
|
2765
|
+
"PENDLE": 4.2
|
|
2766
|
+
};
|
|
2767
|
+
const price = mockPrices[tokenSymbol] || 100;
|
|
2768
|
+
const publishTime = Math.floor(Date.now() / 1e3);
|
|
2769
|
+
return {
|
|
2770
|
+
tokenAddress,
|
|
2771
|
+
tokenSymbol,
|
|
2772
|
+
pair,
|
|
2773
|
+
priceFeedId: feedId,
|
|
2774
|
+
priceUsd: price.toFixed(price < 1 ? 4 : 2),
|
|
2775
|
+
confidence: "50000",
|
|
2776
|
+
exponent: -8,
|
|
2777
|
+
publishTime,
|
|
2778
|
+
lastUpdated: new Date(publishTime * 1e3).toISOString()
|
|
2779
|
+
};
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2782
|
+
// src/tools/pyth/getMultiplePrices.ts
|
|
2783
|
+
async function pythGetMultiplePrices(agent, inputs) {
|
|
2784
|
+
const pythAddress = PYTH_CONTRACT[agent.chain];
|
|
2785
|
+
const results = [];
|
|
2786
|
+
for (const input of inputs) {
|
|
2787
|
+
const resolved = resolvePriceFeedInput(input);
|
|
2788
|
+
let priceFeedId;
|
|
2789
|
+
let pair;
|
|
2790
|
+
if (resolved) {
|
|
2791
|
+
priceFeedId = resolved.feedId;
|
|
2792
|
+
pair = resolved.pair;
|
|
2793
|
+
} else {
|
|
2794
|
+
priceFeedId = input;
|
|
2795
|
+
pair = input;
|
|
2796
|
+
}
|
|
2797
|
+
const feedId = priceFeedId.startsWith("0x") ? priceFeedId : `0x${priceFeedId}`;
|
|
2798
|
+
if (agent.demo) {
|
|
2799
|
+
results.push(createMockPythResponse2(pair, feedId));
|
|
2800
|
+
continue;
|
|
2801
|
+
}
|
|
2802
|
+
try {
|
|
2803
|
+
const priceData = await agent.client.readContract({
|
|
2804
|
+
address: pythAddress,
|
|
2805
|
+
abi: PYTH_ABI,
|
|
2806
|
+
functionName: "getPriceUnsafe",
|
|
2807
|
+
args: [feedId]
|
|
2808
|
+
});
|
|
2809
|
+
const formattedPrice = formatPythPrice2(
|
|
2810
|
+
Number(priceData.price),
|
|
2811
|
+
priceData.expo
|
|
2812
|
+
);
|
|
2813
|
+
results.push({
|
|
2814
|
+
priceFeedId: feedId,
|
|
2815
|
+
pair,
|
|
2816
|
+
price: priceData.price.toString(),
|
|
2817
|
+
confidence: priceData.conf.toString(),
|
|
2818
|
+
exponent: priceData.expo,
|
|
2819
|
+
publishTime: Number(priceData.publishTime),
|
|
2820
|
+
formattedPrice
|
|
2821
|
+
});
|
|
2822
|
+
} catch (error) {
|
|
2823
|
+
results.push({
|
|
2824
|
+
priceFeedId: feedId,
|
|
2825
|
+
pair,
|
|
2826
|
+
price: "0",
|
|
2827
|
+
confidence: "0",
|
|
2828
|
+
exponent: 0,
|
|
2829
|
+
publishTime: 0,
|
|
2830
|
+
formattedPrice: "Error fetching price"
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
return results;
|
|
2835
|
+
}
|
|
2836
|
+
function pythGetSupportedPriceFeeds() {
|
|
2837
|
+
return { ...PYTH_PRICE_FEED_IDS };
|
|
2838
|
+
}
|
|
2839
|
+
function pythGetSupportedTokenAddresses() {
|
|
2840
|
+
const result = {};
|
|
2841
|
+
for (const [address, info] of Object.entries(TOKEN_ADDRESS_TO_PRICE_FEED)) {
|
|
2842
|
+
result[address] = info.pair;
|
|
2843
|
+
}
|
|
2844
|
+
return result;
|
|
2845
|
+
}
|
|
2846
|
+
async function pythPriceFeedExists(agent, input) {
|
|
2847
|
+
const pythAddress = PYTH_CONTRACT[agent.chain];
|
|
2848
|
+
const resolved = resolvePriceFeedInput(input);
|
|
2849
|
+
let priceFeedId;
|
|
2850
|
+
if (resolved) {
|
|
2851
|
+
priceFeedId = resolved.feedId;
|
|
2852
|
+
} else {
|
|
2853
|
+
priceFeedId = input;
|
|
2854
|
+
}
|
|
2855
|
+
const feedId = priceFeedId.startsWith("0x") ? priceFeedId : `0x${priceFeedId}`;
|
|
2856
|
+
if (agent.demo) {
|
|
2857
|
+
return resolved !== null;
|
|
2858
|
+
}
|
|
2859
|
+
try {
|
|
2860
|
+
const exists = await agent.client.readContract({
|
|
2861
|
+
address: pythAddress,
|
|
2862
|
+
abi: PYTH_ABI,
|
|
2863
|
+
functionName: "priceFeedExists",
|
|
2864
|
+
args: [feedId]
|
|
2865
|
+
});
|
|
2866
|
+
return exists;
|
|
2867
|
+
} catch {
|
|
2868
|
+
return false;
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
function formatPythPrice2(price, exponent) {
|
|
2872
|
+
const adjustedPrice = price * Math.pow(10, exponent);
|
|
2873
|
+
if (adjustedPrice >= 1) {
|
|
2874
|
+
return adjustedPrice.toFixed(2);
|
|
2875
|
+
}
|
|
2876
|
+
return adjustedPrice.toFixed(8);
|
|
2877
|
+
}
|
|
2878
|
+
function createMockPythResponse2(pair, feedId) {
|
|
2879
|
+
const mockPrices = {
|
|
2880
|
+
// Major Crypto
|
|
2881
|
+
"BTC/USD": 97500,
|
|
2882
|
+
"ETH/USD": 3450,
|
|
2883
|
+
"SOL/USD": 185,
|
|
2884
|
+
"BNB/USD": 680,
|
|
2885
|
+
"XRP/USD": 2.35,
|
|
2886
|
+
"ADA/USD": 0.95,
|
|
2887
|
+
"DOGE/USD": 0.32,
|
|
2888
|
+
"DOT/USD": 7.2,
|
|
2889
|
+
"AVAX/USD": 38,
|
|
2890
|
+
"MATIC/USD": 0.48,
|
|
2891
|
+
"LINK/USD": 22,
|
|
2892
|
+
"ATOM/USD": 9.5,
|
|
2893
|
+
"LTC/USD": 105,
|
|
2894
|
+
"UNI/USD": 13.5,
|
|
2895
|
+
"NEAR/USD": 5.2,
|
|
2896
|
+
"TRX/USD": 0.25,
|
|
2897
|
+
// L2
|
|
2898
|
+
"ARB/USD": 0.85,
|
|
2899
|
+
"OP/USD": 1.95,
|
|
2900
|
+
"MNT/USD": 0.85,
|
|
2901
|
+
"STRK/USD": 0.45,
|
|
2902
|
+
// DeFi
|
|
2903
|
+
"AAVE/USD": 285,
|
|
2904
|
+
"CRV/USD": 0.52,
|
|
2905
|
+
"MKR/USD": 1850,
|
|
2906
|
+
"SNX/USD": 2.8,
|
|
2907
|
+
"LDO/USD": 1.85,
|
|
2908
|
+
"GMX/USD": 28,
|
|
2909
|
+
"PENDLE/USD": 4.2,
|
|
2910
|
+
// Stablecoins
|
|
2911
|
+
"USDC/USD": 1,
|
|
2912
|
+
"USDT/USD": 1,
|
|
2913
|
+
"DAI/USD": 1,
|
|
2914
|
+
// LST
|
|
2915
|
+
"mETH/USD": 3500,
|
|
2916
|
+
"stETH/USD": 3450,
|
|
2917
|
+
"wstETH/USD": 4100,
|
|
2918
|
+
// Meme
|
|
2919
|
+
"SHIB/USD": 22e-6,
|
|
2920
|
+
"PEPE/USD": 18e-6,
|
|
2921
|
+
"BONK/USD": 28e-6,
|
|
2922
|
+
"WIF/USD": 1.85,
|
|
2923
|
+
// Commodities
|
|
2924
|
+
"XAU/USD": 2650,
|
|
2925
|
+
"XAG/USD": 31,
|
|
2926
|
+
// Forex
|
|
2927
|
+
"EUR/USD": 1.08,
|
|
2928
|
+
"GBP/USD": 1.27,
|
|
2929
|
+
"JPY/USD": 67e-4,
|
|
2930
|
+
// Equities
|
|
2931
|
+
"AAPL/USD": 248,
|
|
2932
|
+
"NVDA/USD": 138,
|
|
2933
|
+
"TSLA/USD": 385,
|
|
2934
|
+
"MSFT/USD": 425
|
|
2935
|
+
};
|
|
2936
|
+
const price = mockPrices[pair] || 100;
|
|
2937
|
+
const decimals = price < 0.01 ? 8 : price < 1 ? 4 : 2;
|
|
2938
|
+
return {
|
|
2939
|
+
priceFeedId: feedId,
|
|
2940
|
+
pair,
|
|
2941
|
+
price: Math.floor(price * 1e8).toString(),
|
|
2942
|
+
confidence: "50000",
|
|
2943
|
+
exponent: -8,
|
|
2944
|
+
publishTime: Math.floor(Date.now() / 1e3),
|
|
2945
|
+
formattedPrice: price.toFixed(decimals)
|
|
2946
|
+
};
|
|
2947
|
+
}
|
|
2948
|
+
|
|
2949
|
+
// src/constants/token-launchpad/index.ts
|
|
2950
|
+
var token_launchpad_exports = {};
|
|
2951
|
+
__export(token_launchpad_exports, {
|
|
2952
|
+
ERC20_ABI: () => ERC20_ABI
|
|
2953
|
+
});
|
|
2954
|
+
var ERC20_ABI = [
|
|
2955
|
+
{
|
|
2956
|
+
inputs: [],
|
|
2957
|
+
name: "name",
|
|
2958
|
+
outputs: [{ name: "", type: "string" }],
|
|
2959
|
+
stateMutability: "view",
|
|
2960
|
+
type: "function"
|
|
2961
|
+
},
|
|
2962
|
+
{
|
|
2963
|
+
inputs: [],
|
|
2964
|
+
name: "symbol",
|
|
2965
|
+
outputs: [{ name: "", type: "string" }],
|
|
2966
|
+
stateMutability: "view",
|
|
2967
|
+
type: "function"
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
inputs: [],
|
|
2971
|
+
name: "decimals",
|
|
2972
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
2973
|
+
stateMutability: "view",
|
|
2974
|
+
type: "function"
|
|
2975
|
+
},
|
|
2976
|
+
{
|
|
2977
|
+
inputs: [],
|
|
2978
|
+
name: "totalSupply",
|
|
2979
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2980
|
+
stateMutability: "view",
|
|
2981
|
+
type: "function"
|
|
2982
|
+
},
|
|
2983
|
+
{
|
|
2984
|
+
inputs: [{ name: "account", type: "address" }],
|
|
2985
|
+
name: "balanceOf",
|
|
2986
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2987
|
+
stateMutability: "view",
|
|
2988
|
+
type: "function"
|
|
2989
|
+
},
|
|
2990
|
+
{
|
|
2991
|
+
inputs: [
|
|
2992
|
+
{ name: "to", type: "address" },
|
|
2993
|
+
{ name: "amount", type: "uint256" }
|
|
2994
|
+
],
|
|
2995
|
+
name: "transfer",
|
|
2996
|
+
outputs: [{ name: "", type: "bool" }],
|
|
2997
|
+
stateMutability: "nonpayable",
|
|
2998
|
+
type: "function"
|
|
2999
|
+
}
|
|
3000
|
+
];
|
|
3001
|
+
|
|
3002
|
+
// src/tools/token-launchpad/deployToken.ts
|
|
3003
|
+
var ERC20_BYTECODE = "0x608060405234801561001057600080fd5b5060405161089a38038061089a833981016040819052610032916101db565b8251839083906100499060039060208501906100b4565b50805161005d9060049060208401906100b4565b50505061007a33826100756012600a6102eb565b610081565b5050610359565b6001600160a01b0382166100ab5760405163ec442f0560e01b815260006004820152602401604051809103906000fd5b6100b760008383610140565b5050565b8280546100c09061030c565b90600052602060002090601f0160209004810192826100e2576000855561012e565b82601f106100f357805160ff191683800117855561012e565b8280016001018555821561012e579182015b8281111561012e578251825591602001919060010190610105565b5061013a92915061013e565b5090565b5b8082111561013a576000815560010161013f565b6001600160a01b038316610174578060026000828254610160919061034b565b9091555061019f9050565b6001600160a01b0383166000908152602081905260408120805483929061019c908490610346565b90915550505b6001600160a01b0382166101c1576002805482900390556101e6565b6001600160a01b03821660009081526020819052604081208054839290610169908490610346565b816001600160a01b0316836001600160a01b03166000805160206108228339815191528360405161021991815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561025757818101518382015260200161023f565b83811115610268576000848401525b50505050565b600082601f83011261027e578081fd5b81516001600160401b038082111561029857610298610226565b604051601f8301601f19908116603f011681019082821181831017156102c0576102c0610226565b816040528381528660208588010111156102d8578485fd5b6102e9846020830160208901610240565b9695505050505050565b60008060006060848603121561030757600080fd5b83516001600160401b038082111561031d578586fd5b6103298783880161026e565b9450602086015191508082111561033e578384fd5b5061034b8682870161026e565b925050604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156103ad57816000190482111561039357610393610372565b808516156103a057918102915b93841c939080029061037c565b509250929050565b6000826103c457506001610460565b816103d157506000610460565b81600181146103e757600281146103f15761040d565b6001915050610460565b60ff84111561040257610402610372565b50506001821b610460565b5060208310610133831016604e8410600b8410161715610430575081810a610460565b61043a8383610377565b806000190482111561044e5761044e610372565b029392505050565b600061046283836103b5565b9392505050565b61046b610482565b600082821015610479576104796103a2565b50039056fe";
|
|
3004
|
+
var RWA_BYTECODE = "0x608060405234801561001057600080fd5b5060405161089a38038061089a833981016040819052610032916101db565b8251839083906100499060039060208501906100b4565b50805161005d9060049060208401906100b4565b50505061007a33826100756012600a6102eb565b610081565b5050610359565b6001600160a01b0382166100ab5760405163ec442f0560e01b815260006004820152602401604051809103906000fd5b6100b760008383610140565b5050565b8280546100c09061030c565b90600052602060002090601f0160209004810192826100e2576000855561012e565b82601f106100f357805160ff191683800117855561012e565b8280016001018555821561012e579182015b8281111561012e578251825591602001919060010190610105565b5061013a92915061013e565b5090565b5b8082111561013a576000815560010161013f565b6001600160a01b038316610174578060026000828254610160919061034b565b9091555061019f9050565b6001600160a01b0383166000908152602081905260408120805483929061019c908490610346565b90915550505b6001600160a01b0382166101c1576002805482900390556101e6565b6001600160a01b03821660009081526020819052604081208054839290610169908490610346565b816001600160a01b0316836001600160a01b03166000805160206108228339815191528360405161021991815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561025757818101518382015260200161023f565b83811115610268576000848401525b50505050565b600082601f83011261027e578081fd5b81516001600160401b038082111561029857610298610226565b604051601f8301601f19908116603f011681019082821181831017156102c0576102c0610226565b816040528381528660208588010111156102d8578485fd5b6102e9846020830160208901610240565b9695505050505050565b60008060006060848603121561030757600080fd5b83516001600160401b038082111561031d578586fd5b6103298783880161026e565b9450602086015191508082111561033e578384fd5b5061034b8682870161026e565b925050604084015190509250925092565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156103ad57816000190482111561039357610393610372565b808516156103a057918102915b93841c939080029061037c565b509250929050565b6000826103c457506001610460565b816103d157506000610460565b81600181146103e757600281146103f15761040d565b6001915050610460565b60ff84111561040257610402610372565b50506001821b610460565b5060208310610133831016604e8410600b8410161715610430575081810a610460565b61043a8383610377565b806000190482111561044e5761044e610372565b029392505050565b600061046283836103b5565b9392505050565b61046b610482565b600082821015610479576104796103a2565b50039056fe";
|
|
3005
|
+
async function deployToken(agent, name, symbol, supply, tokenType = "standard", assetType, assetId) {
|
|
3006
|
+
const decimals = 18;
|
|
3007
|
+
const supplyInWei = viem.parseUnits(supply, decimals).toString();
|
|
3008
|
+
if (agent.demo) {
|
|
3009
|
+
return {
|
|
3010
|
+
tokenAddress: `0xDEMO${tokenType === "rwa" ? "RWA" : "TKN"}00000000000000000001`,
|
|
3011
|
+
txHash: DEMO_TX_HASH,
|
|
3012
|
+
name,
|
|
3013
|
+
symbol,
|
|
3014
|
+
decimals,
|
|
3015
|
+
totalSupply: supplyInWei,
|
|
3016
|
+
mintedTo: agent.account.address,
|
|
3017
|
+
tokenType,
|
|
3018
|
+
assetType,
|
|
3019
|
+
assetId
|
|
3020
|
+
};
|
|
3021
|
+
}
|
|
3022
|
+
if (!name?.trim()) throw new Error("Token name required");
|
|
3023
|
+
if (!symbol?.trim()) throw new Error("Token symbol required");
|
|
3024
|
+
if (!supply || Number(supply) <= 0) throw new Error("Supply must be > 0");
|
|
3025
|
+
const args = viem.encodeAbiParameters(
|
|
3026
|
+
viem.parseAbiParameters("string, string, uint256"),
|
|
3027
|
+
[name, symbol, BigInt(supplyInWei)]
|
|
3028
|
+
);
|
|
3029
|
+
const bytecode = tokenType === "rwa" ? RWA_BYTECODE : ERC20_BYTECODE;
|
|
3030
|
+
const deployData = bytecode + args.slice(2);
|
|
3031
|
+
const txHash = await agent.client.sendTransaction({ data: deployData });
|
|
3032
|
+
const receipt = await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3033
|
+
if (!receipt.contractAddress) {
|
|
3034
|
+
throw new Error("Deployment failed - no contract address");
|
|
3035
|
+
}
|
|
3036
|
+
return {
|
|
3037
|
+
tokenAddress: receipt.contractAddress,
|
|
3038
|
+
txHash,
|
|
3039
|
+
name,
|
|
3040
|
+
symbol,
|
|
3041
|
+
decimals,
|
|
3042
|
+
totalSupply: supplyInWei,
|
|
3043
|
+
mintedTo: agent.account.address,
|
|
3044
|
+
tokenType,
|
|
3045
|
+
assetType,
|
|
3046
|
+
assetId
|
|
3047
|
+
};
|
|
3048
|
+
}
|
|
3049
|
+
async function deployStandardToken(agent, name, symbol, supply) {
|
|
3050
|
+
return deployToken(agent, name, symbol, supply, "standard");
|
|
3051
|
+
}
|
|
3052
|
+
async function deployRWAToken(agent, name, symbol, supply, assetType, assetId) {
|
|
3053
|
+
return deployToken(agent, name, symbol, supply, "rwa", assetType, assetId);
|
|
3054
|
+
}
|
|
3055
|
+
async function getTokenInfo(agent, tokenAddress, holder) {
|
|
3056
|
+
if (agent.demo) {
|
|
3057
|
+
return {
|
|
3058
|
+
address: tokenAddress,
|
|
3059
|
+
name: "Demo Token",
|
|
3060
|
+
symbol: "DEMO",
|
|
3061
|
+
decimals: 18,
|
|
3062
|
+
totalSupply: "1000000000000000000000000",
|
|
3063
|
+
balance: holder ? "1000000000000000000000" : void 0
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3066
|
+
const [name, symbol, decimals, totalSupply] = await Promise.all([
|
|
3067
|
+
agent.client.readContract({ address: tokenAddress, abi: viem.erc20Abi, functionName: "name" }),
|
|
3068
|
+
agent.client.readContract({ address: tokenAddress, abi: viem.erc20Abi, functionName: "symbol" }),
|
|
3069
|
+
agent.client.readContract({ address: tokenAddress, abi: viem.erc20Abi, functionName: "decimals" }),
|
|
3070
|
+
agent.client.readContract({ address: tokenAddress, abi: viem.erc20Abi, functionName: "totalSupply" })
|
|
3071
|
+
]);
|
|
3072
|
+
const result = {
|
|
3073
|
+
address: tokenAddress,
|
|
3074
|
+
name,
|
|
3075
|
+
symbol,
|
|
3076
|
+
decimals,
|
|
3077
|
+
totalSupply: totalSupply.toString()
|
|
3078
|
+
};
|
|
3079
|
+
if (holder) {
|
|
3080
|
+
const balance = await agent.client.readContract({
|
|
3081
|
+
address: tokenAddress,
|
|
3082
|
+
abi: viem.erc20Abi,
|
|
3083
|
+
functionName: "balanceOf",
|
|
3084
|
+
args: [holder]
|
|
3085
|
+
});
|
|
3086
|
+
result.balance = balance.toString();
|
|
3087
|
+
}
|
|
3088
|
+
return result;
|
|
3089
|
+
}
|
|
3090
|
+
async function getTokenBalance(agent, tokenAddress, holder) {
|
|
3091
|
+
if (agent.demo) return "1000000000000000000000";
|
|
3092
|
+
const balance = await agent.client.readContract({
|
|
3093
|
+
address: tokenAddress,
|
|
3094
|
+
abi: viem.erc20Abi,
|
|
3095
|
+
functionName: "balanceOf",
|
|
3096
|
+
args: [holder || agent.account.address]
|
|
3097
|
+
});
|
|
3098
|
+
return balance.toString();
|
|
3099
|
+
}
|
|
3100
|
+
async function transferToken(agent, tokenAddress, to, amount) {
|
|
3101
|
+
if (agent.demo) return DEMO_TX_HASH;
|
|
3102
|
+
const data = viem.encodeFunctionData({
|
|
3103
|
+
abi: viem.erc20Abi,
|
|
3104
|
+
functionName: "transfer",
|
|
3105
|
+
args: [to, BigInt(amount)]
|
|
3106
|
+
});
|
|
3107
|
+
const txHash = await agent.client.sendTransaction({ to: tokenAddress, data });
|
|
3108
|
+
await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3109
|
+
return txHash;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
// src/constants/nft-launchpad/index.ts
|
|
3113
|
+
var nft_launchpad_exports = {};
|
|
3114
|
+
__export(nft_launchpad_exports, {
|
|
3115
|
+
ERC721_ABI: () => ERC721_ABI
|
|
3116
|
+
});
|
|
3117
|
+
var ERC721_ABI = [
|
|
3118
|
+
// Constructor-related
|
|
3119
|
+
{
|
|
3120
|
+
inputs: [
|
|
3121
|
+
{ name: "name", type: "string" },
|
|
3122
|
+
{ name: "symbol", type: "string" },
|
|
3123
|
+
{ name: "baseURI", type: "string" },
|
|
3124
|
+
{ name: "maxSupply", type: "uint256" }
|
|
3125
|
+
],
|
|
3126
|
+
stateMutability: "nonpayable",
|
|
3127
|
+
type: "constructor"
|
|
3128
|
+
},
|
|
3129
|
+
// View functions
|
|
3130
|
+
{
|
|
3131
|
+
inputs: [],
|
|
3132
|
+
name: "name",
|
|
3133
|
+
outputs: [{ name: "", type: "string" }],
|
|
3134
|
+
stateMutability: "view",
|
|
3135
|
+
type: "function"
|
|
3136
|
+
},
|
|
3137
|
+
{
|
|
3138
|
+
inputs: [],
|
|
3139
|
+
name: "symbol",
|
|
3140
|
+
outputs: [{ name: "", type: "string" }],
|
|
3141
|
+
stateMutability: "view",
|
|
3142
|
+
type: "function"
|
|
3143
|
+
},
|
|
3144
|
+
{
|
|
3145
|
+
inputs: [],
|
|
3146
|
+
name: "totalSupply",
|
|
3147
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
3148
|
+
stateMutability: "view",
|
|
3149
|
+
type: "function"
|
|
3150
|
+
},
|
|
3151
|
+
{
|
|
3152
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
3153
|
+
name: "tokenURI",
|
|
3154
|
+
outputs: [{ name: "", type: "string" }],
|
|
3155
|
+
stateMutability: "view",
|
|
3156
|
+
type: "function"
|
|
3157
|
+
},
|
|
3158
|
+
{
|
|
3159
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
3160
|
+
name: "ownerOf",
|
|
3161
|
+
outputs: [{ name: "", type: "address" }],
|
|
3162
|
+
stateMutability: "view",
|
|
3163
|
+
type: "function"
|
|
3164
|
+
},
|
|
3165
|
+
{
|
|
3166
|
+
inputs: [{ name: "owner", type: "address" }],
|
|
3167
|
+
name: "balanceOf",
|
|
3168
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
3169
|
+
stateMutability: "view",
|
|
3170
|
+
type: "function"
|
|
3171
|
+
},
|
|
3172
|
+
{
|
|
3173
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
3174
|
+
name: "getApproved",
|
|
3175
|
+
outputs: [{ name: "", type: "address" }],
|
|
3176
|
+
stateMutability: "view",
|
|
3177
|
+
type: "function"
|
|
3178
|
+
},
|
|
3179
|
+
{
|
|
3180
|
+
inputs: [
|
|
3181
|
+
{ name: "owner", type: "address" },
|
|
3182
|
+
{ name: "operator", type: "address" }
|
|
3183
|
+
],
|
|
3184
|
+
name: "isApprovedForAll",
|
|
3185
|
+
outputs: [{ name: "", type: "bool" }],
|
|
3186
|
+
stateMutability: "view",
|
|
3187
|
+
type: "function"
|
|
3188
|
+
},
|
|
3189
|
+
// State changing functions
|
|
3190
|
+
{
|
|
3191
|
+
inputs: [{ name: "to", type: "address" }],
|
|
3192
|
+
name: "mint",
|
|
3193
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
3194
|
+
stateMutability: "nonpayable",
|
|
3195
|
+
type: "function"
|
|
3196
|
+
},
|
|
3197
|
+
{
|
|
3198
|
+
inputs: [
|
|
3199
|
+
{ name: "to", type: "address" },
|
|
3200
|
+
{ name: "quantity", type: "uint256" }
|
|
3201
|
+
],
|
|
3202
|
+
name: "batchMint",
|
|
3203
|
+
outputs: [{ name: "startTokenId", type: "uint256" }],
|
|
3204
|
+
stateMutability: "nonpayable",
|
|
3205
|
+
type: "function"
|
|
3206
|
+
},
|
|
3207
|
+
{
|
|
3208
|
+
inputs: [
|
|
3209
|
+
{ name: "to", type: "address" },
|
|
3210
|
+
{ name: "tokenId", type: "uint256" }
|
|
3211
|
+
],
|
|
3212
|
+
name: "approve",
|
|
3213
|
+
outputs: [],
|
|
3214
|
+
stateMutability: "nonpayable",
|
|
3215
|
+
type: "function"
|
|
3216
|
+
},
|
|
3217
|
+
{
|
|
3218
|
+
inputs: [
|
|
3219
|
+
{ name: "operator", type: "address" },
|
|
3220
|
+
{ name: "approved", type: "bool" }
|
|
3221
|
+
],
|
|
3222
|
+
name: "setApprovalForAll",
|
|
3223
|
+
outputs: [],
|
|
3224
|
+
stateMutability: "nonpayable",
|
|
3225
|
+
type: "function"
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
inputs: [
|
|
3229
|
+
{ name: "from", type: "address" },
|
|
3230
|
+
{ name: "to", type: "address" },
|
|
3231
|
+
{ name: "tokenId", type: "uint256" }
|
|
3232
|
+
],
|
|
3233
|
+
name: "transferFrom",
|
|
3234
|
+
outputs: [],
|
|
3235
|
+
stateMutability: "nonpayable",
|
|
3236
|
+
type: "function"
|
|
3237
|
+
},
|
|
3238
|
+
{
|
|
3239
|
+
inputs: [
|
|
3240
|
+
{ name: "from", type: "address" },
|
|
3241
|
+
{ name: "to", type: "address" },
|
|
3242
|
+
{ name: "tokenId", type: "uint256" }
|
|
3243
|
+
],
|
|
3244
|
+
name: "safeTransferFrom",
|
|
3245
|
+
outputs: [],
|
|
3246
|
+
stateMutability: "nonpayable",
|
|
3247
|
+
type: "function"
|
|
3248
|
+
},
|
|
3249
|
+
{
|
|
3250
|
+
inputs: [
|
|
3251
|
+
{ name: "from", type: "address" },
|
|
3252
|
+
{ name: "to", type: "address" },
|
|
3253
|
+
{ name: "tokenId", type: "uint256" },
|
|
3254
|
+
{ name: "data", type: "bytes" }
|
|
3255
|
+
],
|
|
3256
|
+
name: "safeTransferFrom",
|
|
3257
|
+
outputs: [],
|
|
3258
|
+
stateMutability: "nonpayable",
|
|
3259
|
+
type: "function"
|
|
3260
|
+
},
|
|
3261
|
+
// Events
|
|
3262
|
+
{
|
|
3263
|
+
anonymous: false,
|
|
3264
|
+
inputs: [
|
|
3265
|
+
{ indexed: true, name: "from", type: "address" },
|
|
3266
|
+
{ indexed: true, name: "to", type: "address" },
|
|
3267
|
+
{ indexed: true, name: "tokenId", type: "uint256" }
|
|
3268
|
+
],
|
|
3269
|
+
name: "Transfer",
|
|
3270
|
+
type: "event"
|
|
3271
|
+
},
|
|
3272
|
+
{
|
|
3273
|
+
anonymous: false,
|
|
3274
|
+
inputs: [
|
|
3275
|
+
{ indexed: true, name: "owner", type: "address" },
|
|
3276
|
+
{ indexed: true, name: "approved", type: "address" },
|
|
3277
|
+
{ indexed: true, name: "tokenId", type: "uint256" }
|
|
3278
|
+
],
|
|
3279
|
+
name: "Approval",
|
|
3280
|
+
type: "event"
|
|
3281
|
+
},
|
|
3282
|
+
{
|
|
3283
|
+
anonymous: false,
|
|
3284
|
+
inputs: [
|
|
3285
|
+
{ indexed: true, name: "owner", type: "address" },
|
|
3286
|
+
{ indexed: true, name: "operator", type: "address" },
|
|
3287
|
+
{ indexed: false, name: "approved", type: "bool" }
|
|
3288
|
+
],
|
|
3289
|
+
name: "ApprovalForAll",
|
|
3290
|
+
type: "event"
|
|
3291
|
+
}
|
|
3292
|
+
];
|
|
3293
|
+
|
|
3294
|
+
// src/tools/nft-launchpad/deployCollection.ts
|
|
3295
|
+
var ERC721_CREATION_CODE = `0x608060405234801561001057600080fd5b506040516112a03803806112a0833981016040819052610032916101e5565b83838383600061004283826102f4565b50600161004f82826102f4565b5050600680546001600160a01b0319163317905550600782905560088190555050505050506103b3565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009f57600080fd5b81516001600160401b03808211156100b9576100b9610079565b604051601f8301601f19908116603f011681019082821181831017156100e1576100e1610079565b816040528381526020925086838588010111156100fd57600080fd5b600091505b8382101561011f5785820183015181830184015290820190610102565b6000928101909201929092529392505050565b60008060008060808587031215610148578384fd5b84516001600160401b038082111561015e578586fd5b61016a8883890161008f565b9550602087015191508082111561017f578485fd5b5061018c8782880161008f565b9350506040850151915060608501519050929550929550929292909250565b600181811c908216806101bf57607f821691505b6020821081036101df57634e487b7160e01b600052602260045260246000fd5b50919050565b600080600080608085870312156101fa578384fd5b84516001600160401b0380821115610210578586fd5b61021c8883890161008f565b95506020870151915080821115610231578485fd5b5061023e8782880161008f565b935050604085015191506060850151905092959194509250565b601f82111561029f57600081815260208120601f850160051c8101602086101561027f5750805b601f850160051c820191505b8181101561029e5782815560010161028b565b505050505050565b81516001600160401b038111156102bf576102bf610079565b6102d3816102cd84546101ab565b84610258565b602080601f83116001811461030857600084156102f05750858301515b600019600386901b1c1916600185901b17855561029e565b600085815260208120601f198616915b8281101561033757888601518255948401946001909101908401610318565b50858210156103555787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600082601f83011261037657600080fd5b81356001600160401b0381111561038f5761038f610079565b6040516020601f19601f85011681018181106001600160401b03821117156103b9576103b9610079565b6040528281528484830111156103ce57600080fd5b8282602083013760009201829052509392505050565b600080600080608085870312156103f9578384fd5b84356001600160401b038082111561040f578586fd5b61041b88838901610365565b95506020870135915080821115610430578485fd5b5061043d87828801610365565b935050604085013591506060850135905092959194509250565b610ede806103c26000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80636352211e11610097578063a22cb46511610066578063a22cb465146101f3578063b88d4fde14610206578063c87b56dd14610219578063e985e9c51461022c57600080fd5b80636352211e146101a75780636a627842146101ba57806370a08231146101cd57806395d89b41146101eb57600080fd5b8063095ea7b3116100d3578063095ea7b31461016257806318160ddd1461017757806323b872dd1461018157806342842e0e1461019457600080fd5b806301ffc9a7146100fa57806306fdde0314610122578063081812fc14610137575b600080fd5b61010d610108366004610b4a565b610268565b60405190151581526020015b60405180910390f35b61012a6102ba565b6040516101199190610bb7565b61014a610145366004610bca565b61034c565b6040516001600160a01b039091168152602001610119565b610175610170366004610bff565b610373565b005b6005545b604051908152602001610119565b61017561018f366004610c29565b61048d565b6101756101a2366004610c29565b6104be565b61014a6101b5366004610bca565b6104d9565b61017b6101c8366004610c65565b610539565b61017b6101db366004610c65565b6001600160a01b031660009081526003602052604090205490565b61012a6105d6565b610175610201366004610c80565b6105e5565b610175610214366004610cd2565b6105f4565b61012a610227366004610bca565b61062c565b61010d61023a366004610dae565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b60006001600160e01b031982166380ac58cd60e01b148061029957506001600160e01b03198216635b5e139f60e01b145b806102b457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546102c990610de1565b80601f01602080910402602001604051908101604052809291908181526020018280546102f590610de1565b80156103425780601f1061031757610100808354040283529160200191610342565b820191906000526020600020905b81548152906001019060200180831161032557829003601f168201915b5050505050905090565b600061035782610697565b506000908152600260205260409020546001600160a01b031690565b600061037e826104d9565b9050806001600160a01b0316836001600160a01b0316036103f05760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061040c575061040c813361023a565b61047e5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016103e7565b61048883836106f6565b505050565b6104973382610764565b6104b35760405162461bcd60e51b81526004016103e790610e1b565b6104888383836107c3565b61048883838360405180602001604052806000815250610930565b6000818152600260205260408120546001600160a01b0316806102b45760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016103e7565b6006546000906001600160a01b031633146105965760405162461bcd60e51b815260206004820152601960248201527f4f6e6c79206f776e65722063616e206d696e7420746f6b656e730000000000006044820152606401610e7565b600580549060006105a683610e68565b91905055905060075460001480156105bf575060075481115b156105c957600080fd5b6105d38382610944565b50919050565b6060600180546102c990610de1565b6105f033838361095e565b5050565b6105fe3383610764565b61061a5760405162461bcd60e51b81526004016103e790610e1b565b61062684848484610a2c565b50505050565b606061063782610697565b600061064e60408051602081019091526000815290565b9050600081511161066e5760405180602001604052806000815250610690565b8061067884610a5f565b604051602001610689929190610e81565b6040519091905056fe60005b838110156106ae578181015183820152602001610696565b50506000910152565b60006102b4826001600160a01b03163b151590565b806001600160a01b0316826001600160a01b0316036107225760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f76616c20746f2073656c660000000000000000604482015260640160405180910390fd5b6001600160a01b03838116600081815260046020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0382166107b25760405162461bcd60e51b815260206004820152601160248201527045524337323: 696e76616c6964206164647260781b604482015260640160405180910390fd5b6000818152600260205260408120546001600160a01b0316906107d490610aff565b6001600160a01b0384166000908152600360205260408120805460019290610807908490610eb0565b909155505060008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6000818152600260205260408120546001600160a01b031661092c5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b606482015260840160405180910390fd5b6000610937836104d9565b9050806001600160a01b0316846001600160a01b031614806109725750836001600160a01b03166109678461034c565b6001600160a01b0316145b8061098257506109828185610b23565b949350505050565b61098d8484846107c3565b61099984848484610b4c565b6106265760405162461bcd60e51b81526004016103e790610ec3565b6105f08282604051806020016040528060008152506109d3836109b5565b6109bf8383610a2c565b6109cc6000848484610b4c565b5050505050565b816001600160a01b0316836001600160a01b0316036109fe5760405162461bcd60e51b81526004016103e790610f0c565b6001600160a01b0382811660008181526004602090815260408083209487168084529482529182902080548615157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116179055905190825290917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3191015b60405180910390a3505050565b610a376107c3565b610a4384848484610c25565b5050505050565b60606000610a5783610c58565b600101905060008167ffffffffffffffff811115610a7757610a77610cbc565b6040519080825280601f01601f191660200182016040528015610aa1576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084610aab57509392505050565b600060001982015b6000838152600260205260409020546001600160a01b0316610b085750919050565b8015610b145792915050565b82610b1e81610f4f565b935050610b07565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205460ff1690565b60006001600160a01b0384163b15610c1a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290610b90903390899088908890600401610f66565b6020604051808303816000875af1925050508015610bcb575060408051601f3d908101601f19168201909252610bc891810190610f99565b60015b610c00573d808015610bf9576040519150601f19603f3d011682016040523d82523d6000602084013e610bfe565b606091505b505080515f03610c185760405162461bcd60e51b81526004016103e790610ec3565b505b6001600160e01b031916630a85bd0160e11b149050610982565b506001949350505050565b610c318484846107c3565b610c3d84848484610b4c565b6106265760405162461bcd60e51b81526004016103e790610ec3565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310610c975772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310610cc3576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310610ce157662386f26fc10000830492506010015b6305f5e1008310610cf9576305f5e100830492506008015b6127108310610d0d57612710830492506004015b60648310610d1f576064830492506002015b600a83106102b45760010192915050565b6001600160e01b031981168114610d4657600080fd5b50565b600060208284031215610d5a578081fd5b8135610d6581610d30565b9392505050565b60005b83811015610d87578181015183820152602001610d6f565b50506000910152565b60008151808452610da8816020860160208601610d6c565b601f01601f19169290920160200192915050565b602081526000610d656020830184610d90565b600060208284031215610de0578081fd5b5035919050565b80356001600160a01b0381168114610dfe57600080fd5b919050565b60008060408385031215610e15578081fd5b610e1e83610de7565b946020939093013593505050565b600080600060608486031215610e40578081fd5b610e4984610de7565b9250610e5760208501610de7565b9150604084013590509250925092565b600060208284031215610e78578081fd5b610d6582610de7565b60008060408385031215610e93578182fd5b610e9c83610de7565b915060208301358015158114610eb0578182fd5b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610ee1578081fd5b813567ffffffffffffffff80821115610efc57610efc610ebb565b604051601f8301601f19908116603f01168101908282118183101715610f2457610f24610ebb565b81604052838152866020858801011115610f3c578485fd5b83602087016020830137600060208583010152809450505050509291505056fea264697066735822122000000000000000000000000000000000000000000000000000000000000000064736f6c63430008150033`;
|
|
3296
|
+
async function deployNFTCollection(agent, config) {
|
|
3297
|
+
const { name, symbol, baseURI, maxSupply = 0 } = config;
|
|
3298
|
+
if (agent.demo) {
|
|
3299
|
+
return {
|
|
3300
|
+
collectionAddress: "0xDEMO000000000000000000000000000000000002",
|
|
3301
|
+
txHash: DEMO_TX_HASH,
|
|
3302
|
+
name,
|
|
3303
|
+
symbol,
|
|
3304
|
+
baseURI,
|
|
3305
|
+
maxSupply,
|
|
3306
|
+
deployer: agent.account.address
|
|
3307
|
+
};
|
|
3308
|
+
}
|
|
3309
|
+
if (!name || name.length === 0) {
|
|
3310
|
+
throw new Error("Collection name is required");
|
|
3311
|
+
}
|
|
3312
|
+
if (!symbol || symbol.length === 0) {
|
|
3313
|
+
throw new Error("Collection symbol is required");
|
|
3314
|
+
}
|
|
3315
|
+
if (!baseURI) {
|
|
3316
|
+
throw new Error("Base URI is required for token metadata");
|
|
3317
|
+
}
|
|
3318
|
+
const constructorArgs = viem.encodeAbiParameters(
|
|
3319
|
+
viem.parseAbiParameters(
|
|
3320
|
+
"string name, string symbol, string baseURI, uint256 maxSupply"
|
|
3321
|
+
),
|
|
3322
|
+
[name, symbol, baseURI, BigInt(maxSupply)]
|
|
3323
|
+
);
|
|
3324
|
+
const deploymentBytecode = ERC721_CREATION_CODE + constructorArgs.slice(2);
|
|
3325
|
+
const txHash = await agent.client.sendTransaction({
|
|
3326
|
+
data: deploymentBytecode
|
|
3327
|
+
});
|
|
3328
|
+
const receipt = await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3329
|
+
if (!receipt.contractAddress) {
|
|
3330
|
+
throw new Error(
|
|
3331
|
+
"NFT Collection deployment failed - no contract address returned"
|
|
3332
|
+
);
|
|
3333
|
+
}
|
|
3334
|
+
return {
|
|
3335
|
+
collectionAddress: receipt.contractAddress,
|
|
3336
|
+
txHash,
|
|
3337
|
+
name,
|
|
3338
|
+
symbol,
|
|
3339
|
+
baseURI,
|
|
3340
|
+
maxSupply,
|
|
3341
|
+
deployer: agent.account.address
|
|
3342
|
+
};
|
|
3343
|
+
}
|
|
3344
|
+
async function deployNFTCollectionWithPreset(agent, preset, name, symbol, baseURI) {
|
|
3345
|
+
const presetConfigs = {
|
|
3346
|
+
pfp: 1e4,
|
|
3347
|
+
// Profile picture collections
|
|
3348
|
+
art: 1e3,
|
|
3349
|
+
// Art collections
|
|
3350
|
+
membership: 100,
|
|
3351
|
+
// Membership/pass collections
|
|
3352
|
+
unlimited: 0
|
|
3353
|
+
// Unlimited supply
|
|
3354
|
+
};
|
|
3355
|
+
return deployNFTCollection(agent, {
|
|
3356
|
+
name,
|
|
3357
|
+
symbol,
|
|
3358
|
+
baseURI,
|
|
3359
|
+
maxSupply: presetConfigs[preset]
|
|
3360
|
+
});
|
|
3361
|
+
}
|
|
3362
|
+
async function mintNFT(agent, collectionAddress, to) {
|
|
3363
|
+
const recipient = to || agent.account.address;
|
|
3364
|
+
if (agent.demo) {
|
|
3365
|
+
return {
|
|
3366
|
+
txHash: DEMO_TX_HASH,
|
|
3367
|
+
tokenId: "1",
|
|
3368
|
+
collectionAddress,
|
|
3369
|
+
to: recipient
|
|
3370
|
+
};
|
|
3371
|
+
}
|
|
3372
|
+
const data = viem.encodeFunctionData({
|
|
3373
|
+
abi: ERC721_ABI,
|
|
3374
|
+
functionName: "mint",
|
|
3375
|
+
args: [recipient]
|
|
3376
|
+
});
|
|
3377
|
+
const txHash = await agent.client.sendTransaction({
|
|
3378
|
+
to: collectionAddress,
|
|
3379
|
+
data
|
|
3380
|
+
});
|
|
3381
|
+
const receipt = await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3382
|
+
let tokenId = "0";
|
|
3383
|
+
for (const log of receipt.logs) {
|
|
3384
|
+
if (log.topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") {
|
|
3385
|
+
if (log.topics[3]) {
|
|
3386
|
+
tokenId = BigInt(log.topics[3]).toString();
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
}
|
|
3390
|
+
return {
|
|
3391
|
+
txHash,
|
|
3392
|
+
tokenId,
|
|
3393
|
+
collectionAddress,
|
|
3394
|
+
to: recipient
|
|
3395
|
+
};
|
|
3396
|
+
}
|
|
3397
|
+
async function batchMintNFT(agent, collectionAddress, to, quantity) {
|
|
3398
|
+
if (agent.demo) {
|
|
3399
|
+
return {
|
|
3400
|
+
txHash: DEMO_TX_HASH,
|
|
3401
|
+
startTokenId: "1",
|
|
3402
|
+
quantity
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
3405
|
+
const data = viem.encodeFunctionData({
|
|
3406
|
+
abi: ERC721_ABI,
|
|
3407
|
+
functionName: "batchMint",
|
|
3408
|
+
args: [to, BigInt(quantity)]
|
|
3409
|
+
});
|
|
3410
|
+
const txHash = await agent.client.sendTransaction({
|
|
3411
|
+
to: collectionAddress,
|
|
3412
|
+
data
|
|
3413
|
+
});
|
|
3414
|
+
const receipt = await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3415
|
+
let startTokenId = "1";
|
|
3416
|
+
for (const log of receipt.logs) {
|
|
3417
|
+
if (log.topics[0] === "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef") {
|
|
3418
|
+
if (log.topics[3]) {
|
|
3419
|
+
startTokenId = BigInt(log.topics[3]).toString();
|
|
3420
|
+
break;
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
return {
|
|
3425
|
+
txHash,
|
|
3426
|
+
startTokenId,
|
|
3427
|
+
quantity
|
|
3428
|
+
};
|
|
3429
|
+
}
|
|
3430
|
+
async function getNFTCollectionInfo(agent, collectionAddress, holderAddress) {
|
|
3431
|
+
if (agent.demo) {
|
|
3432
|
+
return {
|
|
3433
|
+
address: collectionAddress,
|
|
3434
|
+
name: "Demo NFT Collection",
|
|
3435
|
+
symbol: "DEMO",
|
|
3436
|
+
totalSupply: "100",
|
|
3437
|
+
balanceOf: holderAddress ? "5" : void 0
|
|
3438
|
+
};
|
|
3439
|
+
}
|
|
3440
|
+
const [name, symbol, totalSupply] = await Promise.all([
|
|
3441
|
+
agent.client.readContract({
|
|
3442
|
+
address: collectionAddress,
|
|
3443
|
+
abi: ERC721_ABI,
|
|
3444
|
+
functionName: "name"
|
|
3445
|
+
}),
|
|
3446
|
+
agent.client.readContract({
|
|
3447
|
+
address: collectionAddress,
|
|
3448
|
+
abi: ERC721_ABI,
|
|
3449
|
+
functionName: "symbol"
|
|
3450
|
+
}),
|
|
3451
|
+
agent.client.readContract({
|
|
3452
|
+
address: collectionAddress,
|
|
3453
|
+
abi: ERC721_ABI,
|
|
3454
|
+
functionName: "totalSupply"
|
|
3455
|
+
})
|
|
3456
|
+
]);
|
|
3457
|
+
const result = {
|
|
3458
|
+
address: collectionAddress,
|
|
3459
|
+
name,
|
|
3460
|
+
symbol,
|
|
3461
|
+
totalSupply: totalSupply.toString()
|
|
3462
|
+
};
|
|
3463
|
+
if (holderAddress) {
|
|
3464
|
+
const balance = await agent.client.readContract({
|
|
3465
|
+
address: collectionAddress,
|
|
3466
|
+
abi: ERC721_ABI,
|
|
3467
|
+
functionName: "balanceOf",
|
|
3468
|
+
args: [holderAddress]
|
|
3469
|
+
});
|
|
3470
|
+
result.balanceOf = balance.toString();
|
|
3471
|
+
}
|
|
3472
|
+
return result;
|
|
3473
|
+
}
|
|
3474
|
+
async function getNFTTokenInfo(agent, collectionAddress, tokenId) {
|
|
3475
|
+
if (agent.demo) {
|
|
3476
|
+
return {
|
|
3477
|
+
collectionAddress,
|
|
3478
|
+
tokenId,
|
|
3479
|
+
owner: agent.account.address,
|
|
3480
|
+
tokenURI: `https://example.com/metadata/${tokenId}.json`
|
|
3481
|
+
};
|
|
3482
|
+
}
|
|
3483
|
+
const [owner, tokenURI] = await Promise.all([
|
|
3484
|
+
agent.client.readContract({
|
|
3485
|
+
address: collectionAddress,
|
|
3486
|
+
abi: ERC721_ABI,
|
|
3487
|
+
functionName: "ownerOf",
|
|
3488
|
+
args: [BigInt(tokenId)]
|
|
3489
|
+
}),
|
|
3490
|
+
agent.client.readContract({
|
|
3491
|
+
address: collectionAddress,
|
|
3492
|
+
abi: ERC721_ABI,
|
|
3493
|
+
functionName: "tokenURI",
|
|
3494
|
+
args: [BigInt(tokenId)]
|
|
3495
|
+
})
|
|
3496
|
+
]);
|
|
3497
|
+
return {
|
|
3498
|
+
collectionAddress,
|
|
3499
|
+
tokenId,
|
|
3500
|
+
owner,
|
|
3501
|
+
tokenURI
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3504
|
+
async function getNFTBalance(agent, collectionAddress, holderAddress) {
|
|
3505
|
+
const address = holderAddress || agent.account.address;
|
|
3506
|
+
if (agent.demo) {
|
|
3507
|
+
return "5";
|
|
3508
|
+
}
|
|
3509
|
+
const balance = await agent.client.readContract({
|
|
3510
|
+
address: collectionAddress,
|
|
3511
|
+
abi: ERC721_ABI,
|
|
3512
|
+
functionName: "balanceOf",
|
|
3513
|
+
args: [address]
|
|
3514
|
+
});
|
|
3515
|
+
return balance.toString();
|
|
3516
|
+
}
|
|
3517
|
+
async function isNFTOwner(agent, collectionAddress, tokenId, ownerAddress) {
|
|
3518
|
+
const address = ownerAddress || agent.account.address;
|
|
3519
|
+
if (agent.demo) {
|
|
3520
|
+
return true;
|
|
3521
|
+
}
|
|
3522
|
+
try {
|
|
3523
|
+
const owner = await agent.client.readContract({
|
|
3524
|
+
address: collectionAddress,
|
|
3525
|
+
abi: ERC721_ABI,
|
|
3526
|
+
functionName: "ownerOf",
|
|
3527
|
+
args: [BigInt(tokenId)]
|
|
3528
|
+
});
|
|
3529
|
+
return owner.toLowerCase() === address.toLowerCase();
|
|
3530
|
+
} catch {
|
|
3531
|
+
return false;
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
async function transferNFT(agent, collectionAddress, to, tokenId) {
|
|
3535
|
+
if (agent.demo) {
|
|
3536
|
+
return DEMO_TX_HASH;
|
|
3537
|
+
}
|
|
3538
|
+
const data = viem.encodeFunctionData({
|
|
3539
|
+
abi: ERC721_ABI,
|
|
3540
|
+
functionName: "transferFrom",
|
|
3541
|
+
args: [agent.account.address, to, BigInt(tokenId)]
|
|
3542
|
+
});
|
|
3543
|
+
const txHash = await agent.client.sendTransaction({
|
|
3544
|
+
to: collectionAddress,
|
|
3545
|
+
data
|
|
3546
|
+
});
|
|
3547
|
+
await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3548
|
+
return txHash;
|
|
3549
|
+
}
|
|
3550
|
+
async function safeTransferNFT(agent, collectionAddress, to, tokenId) {
|
|
3551
|
+
if (agent.demo) {
|
|
3552
|
+
return DEMO_TX_HASH;
|
|
3553
|
+
}
|
|
3554
|
+
const data = viem.encodeFunctionData({
|
|
3555
|
+
abi: ERC721_ABI,
|
|
3556
|
+
functionName: "safeTransferFrom",
|
|
3557
|
+
args: [agent.account.address, to, BigInt(tokenId)]
|
|
3558
|
+
});
|
|
3559
|
+
const txHash = await agent.client.sendTransaction({
|
|
3560
|
+
to: collectionAddress,
|
|
3561
|
+
data
|
|
3562
|
+
});
|
|
3563
|
+
await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3564
|
+
return txHash;
|
|
3565
|
+
}
|
|
3566
|
+
async function approveNFT(agent, collectionAddress, approved, tokenId) {
|
|
3567
|
+
if (agent.demo) {
|
|
3568
|
+
return DEMO_TX_HASH;
|
|
3569
|
+
}
|
|
3570
|
+
const data = viem.encodeFunctionData({
|
|
3571
|
+
abi: ERC721_ABI,
|
|
3572
|
+
functionName: "approve",
|
|
3573
|
+
args: [approved, BigInt(tokenId)]
|
|
3574
|
+
});
|
|
3575
|
+
const txHash = await agent.client.sendTransaction({
|
|
3576
|
+
to: collectionAddress,
|
|
3577
|
+
data
|
|
3578
|
+
});
|
|
3579
|
+
await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3580
|
+
return txHash;
|
|
3581
|
+
}
|
|
3582
|
+
async function setApprovalForAllNFT(agent, collectionAddress, operator, approved) {
|
|
3583
|
+
if (agent.demo) {
|
|
3584
|
+
return DEMO_TX_HASH;
|
|
3585
|
+
}
|
|
3586
|
+
const data = viem.encodeFunctionData({
|
|
3587
|
+
abi: ERC721_ABI,
|
|
3588
|
+
functionName: "setApprovalForAll",
|
|
3589
|
+
args: [operator, approved]
|
|
3590
|
+
});
|
|
3591
|
+
const txHash = await agent.client.sendTransaction({
|
|
3592
|
+
to: collectionAddress,
|
|
3593
|
+
data
|
|
3594
|
+
});
|
|
3595
|
+
await agent.client.waitForTransactionReceipt({ hash: txHash });
|
|
3596
|
+
return txHash;
|
|
3597
|
+
}
|
|
3598
|
+
|
|
2193
3599
|
// src/tools/okx/getSwapQuote.ts
|
|
2194
3600
|
var getSwapQuote = async (agent, from, to, amount, slippagePercentage) => {
|
|
2195
3601
|
if (agent.demo) {
|
|
@@ -2563,6 +3969,263 @@ var MNTAgentKit = class {
|
|
|
2563
3969
|
async pikeperpsGetMarketData(tokenAddress, limit = 20) {
|
|
2564
3970
|
return await pikeperpsGetMarketData(this, tokenAddress, limit);
|
|
2565
3971
|
}
|
|
3972
|
+
// ===== Pyth Network Price Feeds =====
|
|
3973
|
+
/**
|
|
3974
|
+
* Get real-time price from Pyth Network
|
|
3975
|
+
* Accepts token address, pair name, or price feed ID
|
|
3976
|
+
* @param input - Token address (e.g., "0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2" for USDC),
|
|
3977
|
+
* pair name (e.g., "ETH/USD"), or price feed ID (hex string)
|
|
3978
|
+
* @returns Price data with formatted price
|
|
3979
|
+
* @example
|
|
3980
|
+
* // Using pair name
|
|
3981
|
+
* await agent.pythGetPrice("ETH/USD");
|
|
3982
|
+
* // Using token address (USDC on Mantle)
|
|
3983
|
+
* await agent.pythGetPrice("0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2");
|
|
3984
|
+
*/
|
|
3985
|
+
async pythGetPrice(input) {
|
|
3986
|
+
return await pythGetPrice(this, input);
|
|
3987
|
+
}
|
|
3988
|
+
/**
|
|
3989
|
+
* Get EMA (Exponential Moving Average) price from Pyth
|
|
3990
|
+
* Accepts token address, pair name, or price feed ID
|
|
3991
|
+
* @param input - Token address, pair name, or price feed ID
|
|
3992
|
+
* @returns EMA price data
|
|
3993
|
+
*/
|
|
3994
|
+
async pythGetEmaPrice(input) {
|
|
3995
|
+
return await pythGetEmaPrice(this, input);
|
|
3996
|
+
}
|
|
3997
|
+
/**
|
|
3998
|
+
* Get price for a token by its contract address
|
|
3999
|
+
* Pass any supported token address and get the USD price with full details
|
|
4000
|
+
* @param tokenAddress - Token contract address on Mantle
|
|
4001
|
+
* @returns Token price details including symbol, USD price, and timestamp
|
|
4002
|
+
* @example
|
|
4003
|
+
* const price = await agent.pythGetTokenPrice("0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2");
|
|
4004
|
+
* // Returns: {
|
|
4005
|
+
* // tokenAddress: "0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2",
|
|
4006
|
+
* // tokenSymbol: "USDC",
|
|
4007
|
+
* // pair: "USDC/USD",
|
|
4008
|
+
* // priceUsd: "1.00",
|
|
4009
|
+
* // lastUpdated: "2024-01-08T12:00:00.000Z"
|
|
4010
|
+
* // }
|
|
4011
|
+
*/
|
|
4012
|
+
async pythGetTokenPrice(tokenAddress) {
|
|
4013
|
+
return await pythGetTokenPrice(this, tokenAddress);
|
|
4014
|
+
}
|
|
4015
|
+
/**
|
|
4016
|
+
* Get multiple prices from Pyth in a single call
|
|
4017
|
+
* Accepts token addresses, pair names, or price feed IDs
|
|
4018
|
+
* @param inputs - Array of token addresses, pair names, or price feed IDs
|
|
4019
|
+
* @returns Array of price responses
|
|
4020
|
+
* @example
|
|
4021
|
+
* await agent.pythGetMultiplePrices([
|
|
4022
|
+
* "ETH/USD", // pair name
|
|
4023
|
+
* "0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2", // USDC address
|
|
4024
|
+
* "0xcDA86A272531e8640cD7F1a92c01839911B90bb0", // mETH address
|
|
4025
|
+
* ]);
|
|
4026
|
+
*/
|
|
4027
|
+
async pythGetMultiplePrices(inputs) {
|
|
4028
|
+
return await pythGetMultiplePrices(this, inputs);
|
|
4029
|
+
}
|
|
4030
|
+
/**
|
|
4031
|
+
* Get all supported Pyth price feed IDs
|
|
4032
|
+
* @returns Object mapping pair names to price feed IDs
|
|
4033
|
+
*/
|
|
4034
|
+
pythGetSupportedPriceFeeds() {
|
|
4035
|
+
return pythGetSupportedPriceFeeds();
|
|
4036
|
+
}
|
|
4037
|
+
/**
|
|
4038
|
+
* Get all supported token addresses for Pyth price lookups on Mantle
|
|
4039
|
+
* @returns Object mapping token addresses to their pair names
|
|
4040
|
+
* @example
|
|
4041
|
+
* const addresses = agent.pythGetSupportedTokenAddresses();
|
|
4042
|
+
* // Returns: { "0x09Bc4E0D10C81b3a3766c49F0f98a8aaa7adA8D2": "USDC/USD", ... }
|
|
4043
|
+
*/
|
|
4044
|
+
pythGetSupportedTokenAddresses() {
|
|
4045
|
+
return pythGetSupportedTokenAddresses();
|
|
4046
|
+
}
|
|
4047
|
+
/**
|
|
4048
|
+
* Check if a price feed exists on Pyth
|
|
4049
|
+
* Accepts token address, pair name, or price feed ID
|
|
4050
|
+
* @param input - Token address, pair name, or price feed ID
|
|
4051
|
+
* @returns Boolean indicating if feed exists
|
|
4052
|
+
*/
|
|
4053
|
+
async pythPriceFeedExists(input) {
|
|
4054
|
+
return await pythPriceFeedExists(this, input);
|
|
4055
|
+
}
|
|
4056
|
+
// ===== Token Launchpad =====
|
|
4057
|
+
/**
|
|
4058
|
+
* Deploy a new token (ERC20 or RWA) - supply minted to your address
|
|
4059
|
+
* @param name - Token name
|
|
4060
|
+
* @param symbol - Token symbol
|
|
4061
|
+
* @param supply - Total supply (human readable, e.g., "1000000")
|
|
4062
|
+
* @param tokenType - "standard" or "rwa"
|
|
4063
|
+
* @param assetType - For RWA: asset category
|
|
4064
|
+
* @param assetId - For RWA: external asset ID
|
|
4065
|
+
*/
|
|
4066
|
+
async deployToken(name, symbol, supply, tokenType = "standard", assetType, assetId) {
|
|
4067
|
+
return await deployToken(this, name, symbol, supply, tokenType, assetType, assetId);
|
|
4068
|
+
}
|
|
4069
|
+
/**
|
|
4070
|
+
* Deploy a standard ERC20 token
|
|
4071
|
+
* @param name - Token name
|
|
4072
|
+
* @param symbol - Token symbol
|
|
4073
|
+
* @param supply - Total supply (e.g., "1000000" for 1M tokens)
|
|
4074
|
+
*/
|
|
4075
|
+
async deployStandardToken(name, symbol, supply) {
|
|
4076
|
+
return await deployStandardToken(this, name, symbol, supply);
|
|
4077
|
+
}
|
|
4078
|
+
/**
|
|
4079
|
+
* Deploy an RWA (Real World Asset) token
|
|
4080
|
+
* @param name - Token name (e.g., "Manhattan Property Token")
|
|
4081
|
+
* @param symbol - Token symbol (e.g., "MPT")
|
|
4082
|
+
* @param supply - Total supply for fractional ownership
|
|
4083
|
+
* @param assetType - Asset category: "Real Estate", "Commodities", "Securities", "Art"
|
|
4084
|
+
* @param assetId - External reference ID for the underlying asset
|
|
4085
|
+
*/
|
|
4086
|
+
async deployRWAToken(name, symbol, supply, assetType, assetId) {
|
|
4087
|
+
return await deployRWAToken(this, name, symbol, supply, assetType, assetId);
|
|
4088
|
+
}
|
|
4089
|
+
/**
|
|
4090
|
+
* Get token information
|
|
4091
|
+
*/
|
|
4092
|
+
async getTokenInfo(tokenAddress, holder) {
|
|
4093
|
+
return await getTokenInfo(this, tokenAddress, holder);
|
|
4094
|
+
}
|
|
4095
|
+
/**
|
|
4096
|
+
* Get token balance
|
|
4097
|
+
*/
|
|
4098
|
+
async getTokenBalance(tokenAddress, holder) {
|
|
4099
|
+
return await getTokenBalance(this, tokenAddress, holder);
|
|
4100
|
+
}
|
|
4101
|
+
/**
|
|
4102
|
+
* Transfer tokens
|
|
4103
|
+
*/
|
|
4104
|
+
async transferToken(tokenAddress, to, amount) {
|
|
4105
|
+
return await transferToken(this, tokenAddress, to, amount);
|
|
4106
|
+
}
|
|
4107
|
+
// ===== NFT Launchpad =====
|
|
4108
|
+
/**
|
|
4109
|
+
* Deploy a new ERC721 NFT collection on Mantle Network
|
|
4110
|
+
* @param config - Collection configuration (name, symbol, baseURI, maxSupply)
|
|
4111
|
+
* @returns Collection deployment result with contract address
|
|
4112
|
+
*/
|
|
4113
|
+
async deployNFTCollection(config) {
|
|
4114
|
+
return await deployNFTCollection(this, config);
|
|
4115
|
+
}
|
|
4116
|
+
/**
|
|
4117
|
+
* Deploy an NFT collection with preset configurations
|
|
4118
|
+
* @param preset - Preset type: "pfp" (10000), "art" (1000), "membership" (100), "unlimited"
|
|
4119
|
+
* @param name - Collection name
|
|
4120
|
+
* @param symbol - Collection symbol
|
|
4121
|
+
* @param baseURI - Base URI for metadata
|
|
4122
|
+
* @returns Collection deployment result
|
|
4123
|
+
*/
|
|
4124
|
+
async deployNFTCollectionWithPreset(preset, name, symbol, baseURI) {
|
|
4125
|
+
return await deployNFTCollectionWithPreset(
|
|
4126
|
+
this,
|
|
4127
|
+
preset,
|
|
4128
|
+
name,
|
|
4129
|
+
symbol,
|
|
4130
|
+
baseURI
|
|
4131
|
+
);
|
|
4132
|
+
}
|
|
4133
|
+
/**
|
|
4134
|
+
* Mint a single NFT from a collection
|
|
4135
|
+
* @param collectionAddress - NFT collection contract address
|
|
4136
|
+
* @param to - Recipient address (defaults to agent address)
|
|
4137
|
+
* @returns Mint result with token ID
|
|
4138
|
+
*/
|
|
4139
|
+
async mintNFT(collectionAddress, to) {
|
|
4140
|
+
return await mintNFT(this, collectionAddress, to);
|
|
4141
|
+
}
|
|
4142
|
+
/**
|
|
4143
|
+
* Batch mint multiple NFTs from a collection
|
|
4144
|
+
* @param collectionAddress - NFT collection contract address
|
|
4145
|
+
* @param to - Recipient address
|
|
4146
|
+
* @param quantity - Number of NFTs to mint
|
|
4147
|
+
* @returns Mint result with starting token ID
|
|
4148
|
+
*/
|
|
4149
|
+
async batchMintNFT(collectionAddress, to, quantity) {
|
|
4150
|
+
return await batchMintNFT(this, collectionAddress, to, quantity);
|
|
4151
|
+
}
|
|
4152
|
+
/**
|
|
4153
|
+
* Get information about an NFT collection
|
|
4154
|
+
* @param collectionAddress - NFT collection contract address
|
|
4155
|
+
* @param holderAddress - Optional address to get balance for
|
|
4156
|
+
* @returns Collection information
|
|
4157
|
+
*/
|
|
4158
|
+
async getNFTCollectionInfo(collectionAddress, holderAddress) {
|
|
4159
|
+
return await getNFTCollectionInfo(this, collectionAddress, holderAddress);
|
|
4160
|
+
}
|
|
4161
|
+
/**
|
|
4162
|
+
* Get information about a specific NFT token
|
|
4163
|
+
* @param collectionAddress - NFT collection contract address
|
|
4164
|
+
* @param tokenId - Token ID
|
|
4165
|
+
* @returns Token information
|
|
4166
|
+
*/
|
|
4167
|
+
async getNFTTokenInfo(collectionAddress, tokenId) {
|
|
4168
|
+
return await getNFTTokenInfo(this, collectionAddress, tokenId);
|
|
4169
|
+
}
|
|
4170
|
+
/**
|
|
4171
|
+
* Get NFT balance for an address
|
|
4172
|
+
* @param collectionAddress - NFT collection contract address
|
|
4173
|
+
* @param holderAddress - Address to check (defaults to agent address)
|
|
4174
|
+
* @returns Balance as string
|
|
4175
|
+
*/
|
|
4176
|
+
async getNFTBalance(collectionAddress, holderAddress) {
|
|
4177
|
+
return await getNFTBalance(this, collectionAddress, holderAddress);
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* Check if an address owns a specific NFT
|
|
4181
|
+
* @param collectionAddress - NFT collection contract address
|
|
4182
|
+
* @param tokenId - Token ID to check
|
|
4183
|
+
* @param ownerAddress - Address to verify ownership
|
|
4184
|
+
* @returns Boolean indicating ownership
|
|
4185
|
+
*/
|
|
4186
|
+
async isNFTOwner(collectionAddress, tokenId, ownerAddress) {
|
|
4187
|
+
return await isNFTOwner(this, collectionAddress, tokenId, ownerAddress);
|
|
4188
|
+
}
|
|
4189
|
+
/**
|
|
4190
|
+
* Transfer an NFT to another address
|
|
4191
|
+
* @param collectionAddress - NFT collection contract address
|
|
4192
|
+
* @param to - Recipient address
|
|
4193
|
+
* @param tokenId - Token ID to transfer
|
|
4194
|
+
* @returns Transaction hash
|
|
4195
|
+
*/
|
|
4196
|
+
async transferNFT(collectionAddress, to, tokenId) {
|
|
4197
|
+
return await transferNFT(this, collectionAddress, to, tokenId);
|
|
4198
|
+
}
|
|
4199
|
+
/**
|
|
4200
|
+
* Safe transfer an NFT (checks if recipient can receive)
|
|
4201
|
+
* @param collectionAddress - NFT collection contract address
|
|
4202
|
+
* @param to - Recipient address
|
|
4203
|
+
* @param tokenId - Token ID to transfer
|
|
4204
|
+
* @returns Transaction hash
|
|
4205
|
+
*/
|
|
4206
|
+
async safeTransferNFT(collectionAddress, to, tokenId) {
|
|
4207
|
+
return await safeTransferNFT(this, collectionAddress, to, tokenId);
|
|
4208
|
+
}
|
|
4209
|
+
/**
|
|
4210
|
+
* Approve an address to transfer a specific NFT
|
|
4211
|
+
* @param collectionAddress - NFT collection contract address
|
|
4212
|
+
* @param approved - Address to approve
|
|
4213
|
+
* @param tokenId - Token ID to approve
|
|
4214
|
+
* @returns Transaction hash
|
|
4215
|
+
*/
|
|
4216
|
+
async approveNFT(collectionAddress, approved, tokenId) {
|
|
4217
|
+
return await approveNFT(this, collectionAddress, approved, tokenId);
|
|
4218
|
+
}
|
|
4219
|
+
/**
|
|
4220
|
+
* Set approval for all NFTs in a collection
|
|
4221
|
+
* @param collectionAddress - NFT collection contract address
|
|
4222
|
+
* @param operator - Operator address
|
|
4223
|
+
* @param approved - Whether to approve or revoke
|
|
4224
|
+
* @returns Transaction hash
|
|
4225
|
+
*/
|
|
4226
|
+
async setApprovalForAllNFT(collectionAddress, operator, approved) {
|
|
4227
|
+
return await setApprovalForAllNFT(this, collectionAddress, operator, approved);
|
|
4228
|
+
}
|
|
2566
4229
|
};
|
|
2567
4230
|
|
|
2568
4231
|
exports.AgniConstants = agni_exports;
|
|
@@ -2571,22 +4234,38 @@ exports.METH_TOKEN = METH_TOKEN;
|
|
|
2571
4234
|
exports.MNTAgentKit = MNTAgentKit;
|
|
2572
4235
|
exports.MerchantMoeConstants = merchantmoe_exports;
|
|
2573
4236
|
exports.MethConstants = meth_exports;
|
|
4237
|
+
exports.NFTLaunchpadConstants = nft_launchpad_exports;
|
|
2574
4238
|
exports.OKXConstants = okx_exports;
|
|
2575
4239
|
exports.OneInchConstants = oneinch_exports;
|
|
2576
4240
|
exports.OpenOceanConstants = openocean_exports;
|
|
2577
4241
|
exports.PikePerpsConstants = pikeperps_exports;
|
|
4242
|
+
exports.PythConstants = pyth_exports;
|
|
2578
4243
|
exports.SquidConstants = squid_exports;
|
|
4244
|
+
exports.TokenLaunchpadConstants = token_launchpad_exports;
|
|
2579
4245
|
exports.UniswapConstants = uniswap_exports;
|
|
2580
4246
|
exports.agniSwap = agniSwap;
|
|
4247
|
+
exports.approveNFT = approveNFT;
|
|
2581
4248
|
exports.approveToken = approveToken;
|
|
4249
|
+
exports.batchMintNFT = batchMintNFT;
|
|
2582
4250
|
exports.crossChainSwapViaSquid = crossChainSwapViaSquid;
|
|
4251
|
+
exports.deployNFTCollection = deployNFTCollection;
|
|
4252
|
+
exports.deployNFTCollectionWithPreset = deployNFTCollectionWithPreset;
|
|
4253
|
+
exports.deployRWAToken = deployRWAToken;
|
|
4254
|
+
exports.deployStandardToken = deployStandardToken;
|
|
4255
|
+
exports.deployToken = deployToken;
|
|
2583
4256
|
exports.executeSwap = executeSwap;
|
|
2584
4257
|
exports.get1inchQuote = get1inchQuote;
|
|
4258
|
+
exports.getNFTBalance = getNFTBalance;
|
|
4259
|
+
exports.getNFTCollectionInfo = getNFTCollectionInfo;
|
|
4260
|
+
exports.getNFTTokenInfo = getNFTTokenInfo;
|
|
2585
4261
|
exports.getOpenOceanQuote = getOpenOceanQuote;
|
|
2586
4262
|
exports.getProjectConfig = getProjectConfig;
|
|
2587
4263
|
exports.getSquidRoute = getSquidRoute;
|
|
4264
|
+
exports.getTokenBalance = getTokenBalance;
|
|
4265
|
+
exports.getTokenInfo = getTokenInfo;
|
|
2588
4266
|
exports.getUniswapQuote = getUniswapQuote;
|
|
2589
4267
|
exports.initializePlatform = initializePlatform;
|
|
4268
|
+
exports.isNFTOwner = isNFTOwner;
|
|
2590
4269
|
exports.lendleBorrow = lendleBorrow;
|
|
2591
4270
|
exports.lendleGetPositions = lendleGetPositions;
|
|
2592
4271
|
exports.lendleRepay = lendleRepay;
|
|
@@ -2594,16 +4273,28 @@ exports.lendleSupply = lendleSupply;
|
|
|
2594
4273
|
exports.lendleWithdraw = lendleWithdraw;
|
|
2595
4274
|
exports.merchantMoeSwap = merchantMoeSwap;
|
|
2596
4275
|
exports.methGetPosition = methGetPosition;
|
|
4276
|
+
exports.mintNFT = mintNFT;
|
|
2597
4277
|
exports.pikeperpsClosePosition = pikeperpsClosePosition;
|
|
2598
4278
|
exports.pikeperpsGetMarketData = pikeperpsGetMarketData;
|
|
2599
4279
|
exports.pikeperpsGetPositions = pikeperpsGetPositions;
|
|
2600
4280
|
exports.pikeperpsOpenLong = pikeperpsOpenLong;
|
|
2601
4281
|
exports.pikeperpsOpenShort = pikeperpsOpenShort;
|
|
4282
|
+
exports.pythGetEmaPrice = pythGetEmaPrice;
|
|
4283
|
+
exports.pythGetMultiplePrices = pythGetMultiplePrices;
|
|
4284
|
+
exports.pythGetPrice = pythGetPrice;
|
|
4285
|
+
exports.pythGetSupportedPriceFeeds = pythGetSupportedPriceFeeds;
|
|
4286
|
+
exports.pythGetSupportedTokenAddresses = pythGetSupportedTokenAddresses;
|
|
4287
|
+
exports.pythGetTokenPrice = pythGetTokenPrice;
|
|
4288
|
+
exports.pythPriceFeedExists = pythPriceFeedExists;
|
|
4289
|
+
exports.safeTransferNFT = safeTransferNFT;
|
|
2602
4290
|
exports.sendTransaction = sendTransaction;
|
|
4291
|
+
exports.setApprovalForAllNFT = setApprovalForAllNFT;
|
|
2603
4292
|
exports.swapFromMeth = swapFromMeth;
|
|
2604
4293
|
exports.swapOn1inch = swapOn1inch;
|
|
2605
4294
|
exports.swapOnOpenOcean = swapOnOpenOcean;
|
|
2606
4295
|
exports.swapOnUniswap = swapOnUniswap;
|
|
2607
4296
|
exports.swapToMeth = swapToMeth;
|
|
4297
|
+
exports.transferNFT = transferNFT;
|
|
4298
|
+
exports.transferToken = transferToken;
|
|
2608
4299
|
//# sourceMappingURL=index.cjs.map
|
|
2609
4300
|
//# sourceMappingURL=index.cjs.map
|