@alchemy/cli 0.9.0 → 0.9.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/dist/{auth-65X7EMCF.js → auth-6BBITIOZ.js} +2 -2
- package/dist/{chunk-WT4RGQLC.js → chunk-HGFU4JCS.js} +1 -1
- package/dist/{chunk-XCKUCXC6.js → chunk-L2WODD2D.js} +1 -1
- package/dist/{chunk-NMT7XH3C.js → chunk-P56HOTPV.js} +1 -1
- package/dist/{chunk-7ZSEELHZ.js → chunk-SIIZGMK5.js} +1 -1
- package/dist/{chunk-AJPOUEO6.js → chunk-TTWOBNJP.js} +1 -1
- package/dist/index.js +285 -23
- package/dist/{interactive-GVMPYXNJ.js → interactive-IBR6RN74.js} +3 -3
- package/dist/{onboarding-MDHVOUY3.js → onboarding-CW7XGRE4.js} +2 -2
- package/dist/{policy-prompt-PHVO6VRZ.js → policy-prompt-4BV5AWVV.js} +2 -2
- package/dist/{resolve-GBS26K44.js → resolve-FQ66OWT7.js} +1 -1
- package/package.json +1 -1
|
@@ -3,10 +3,10 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
|
3
3
|
import {
|
|
4
4
|
registerAuth,
|
|
5
5
|
selectAppAfterAuth
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-L2WODD2D.js";
|
|
7
7
|
import "./chunk-RGVM5SNE.js";
|
|
8
8
|
import "./chunk-75ICFV5K.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-SIIZGMK5.js";
|
|
10
10
|
import "./chunk-MV7O3XBG.js";
|
|
11
11
|
import "./chunk-GDLPBPG3.js";
|
|
12
12
|
import "./chunk-OVLQH6KL.js";
|
|
@@ -830,7 +830,7 @@ var AdminClient = class _AdminClient {
|
|
|
830
830
|
async createApp(opts) {
|
|
831
831
|
const resp = await this.request("POST", "/v1/apps", {
|
|
832
832
|
name: opts.name,
|
|
833
|
-
|
|
833
|
+
networkAllowlist: opts.networks,
|
|
834
834
|
...opts.description && { description: opts.description },
|
|
835
835
|
...opts.products && { products: opts.products }
|
|
836
836
|
});
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TTWOBNJP.js";
|
|
9
9
|
import {
|
|
10
10
|
registerAuth
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-L2WODD2D.js";
|
|
12
12
|
import {
|
|
13
13
|
openBrowser
|
|
14
14
|
} from "./chunk-RGVM5SNE.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
getSetupStatus,
|
|
19
19
|
isSetupComplete,
|
|
20
20
|
shouldRunOnboarding
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-P56HOTPV.js";
|
|
22
22
|
import {
|
|
23
23
|
isInteractiveAllowed
|
|
24
24
|
} from "./chunk-75ICFV5K.js";
|
|
@@ -54,12 +54,12 @@ import {
|
|
|
54
54
|
saveSession,
|
|
55
55
|
toAdminNetworkId,
|
|
56
56
|
updateSession
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-SIIZGMK5.js";
|
|
58
58
|
import {
|
|
59
59
|
getAvailableUpdate,
|
|
60
60
|
getUpdateStatus,
|
|
61
61
|
printUpdateNotice
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-HGFU4JCS.js";
|
|
63
63
|
import {
|
|
64
64
|
bold,
|
|
65
65
|
brand,
|
|
@@ -577,8 +577,8 @@ function registerConfig(program2) {
|
|
|
577
577
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set evm-gas-policy-id <id>`."
|
|
578
578
|
);
|
|
579
579
|
}
|
|
580
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
581
|
-
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-
|
|
580
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-4BV5AWVV.js");
|
|
581
|
+
const { resolveNetwork: resolveNetwork2 } = await import("./resolve-FQ66OWT7.js");
|
|
582
582
|
const network = resolveNetwork2(program2);
|
|
583
583
|
await selectOrCreatePolicy2({
|
|
584
584
|
flavor: "sponsorship",
|
|
@@ -632,8 +632,8 @@ function registerConfig(program2) {
|
|
|
632
632
|
"Interactive policy selection requires an interactive terminal. Pass an ID: `alchemy config set solana-fee-policy-id <id>`."
|
|
633
633
|
);
|
|
634
634
|
}
|
|
635
|
-
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-
|
|
636
|
-
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-
|
|
635
|
+
const { selectOrCreatePolicy: selectOrCreatePolicy2 } = await import("./policy-prompt-4BV5AWVV.js");
|
|
636
|
+
const { resolveSolanaNetwork: resolveSolanaNetwork2 } = await import("./resolve-FQ66OWT7.js");
|
|
637
637
|
const network = resolveSolanaNetwork2(program2);
|
|
638
638
|
await selectOrCreatePolicy2({
|
|
639
639
|
flavor: "solana",
|
|
@@ -691,7 +691,7 @@ function registerConfig(program2) {
|
|
|
691
691
|
printJSON(toMap(cfg));
|
|
692
692
|
return;
|
|
693
693
|
}
|
|
694
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
694
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-FQ66OWT7.js");
|
|
695
695
|
const validToken = resolveAuthToken2(cfg);
|
|
696
696
|
const authStatus = cfg.auth_token ? validToken ? `${green("\u2713")} authenticated${cfg.auth_token_expires_at ? ` ${dim(`(expires ${cfg.auth_token_expires_at})`)}` : ""}` : `${yellow("\u25C6")} expired${cfg.auth_token_expires_at ? ` ${dim(`(${cfg.auth_token_expires_at})`)}` : ""}` : dim("(not set) \u2014 run 'alchemy auth' to log in");
|
|
697
697
|
const pairs = [
|
|
@@ -5593,7 +5593,108 @@ import {
|
|
|
5593
5593
|
erc20Abi,
|
|
5594
5594
|
maxUint256
|
|
5595
5595
|
} from "viem";
|
|
5596
|
+
|
|
5597
|
+
// src/lib/token-registry.ts
|
|
5596
5598
|
var NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
5599
|
+
var REGISTRY = {
|
|
5600
|
+
"eth-mainnet": [
|
|
5601
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "Ether", isNative: true },
|
|
5602
|
+
{ symbol: "WETH", address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", decimals: 18, name: "Wrapped Ether" },
|
|
5603
|
+
{ symbol: "USDC", address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6, name: "USD Coin" },
|
|
5604
|
+
{ symbol: "USDT", address: "0xdAC17F958D2ee523a2206206994597C13D831ec7", decimals: 6, name: "Tether USD" },
|
|
5605
|
+
{ symbol: "DAI", address: "0x6B175474E89094C44Da98b954EedeAC495271d0F", decimals: 18, name: "Dai Stablecoin" },
|
|
5606
|
+
{ symbol: "WBTC", address: "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", decimals: 8, name: "Wrapped BTC" }
|
|
5607
|
+
],
|
|
5608
|
+
"base-mainnet": [
|
|
5609
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "Ether", isNative: true },
|
|
5610
|
+
{ symbol: "WETH", address: "0x4200000000000000000000000000000000000006", decimals: 18, name: "Wrapped Ether" },
|
|
5611
|
+
{ symbol: "USDC", address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", decimals: 6, name: "USD Coin" },
|
|
5612
|
+
{ symbol: "USDbC", address: "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", decimals: 6, name: "USD Base Coin (bridged)" },
|
|
5613
|
+
{ symbol: "DAI", address: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb", decimals: 18, name: "Dai Stablecoin" },
|
|
5614
|
+
{ symbol: "cbETH", address: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22", decimals: 18, name: "Coinbase Wrapped Staked ETH" }
|
|
5615
|
+
],
|
|
5616
|
+
"arb-mainnet": [
|
|
5617
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "Ether", isNative: true },
|
|
5618
|
+
{ symbol: "WETH", address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", decimals: 18, name: "Wrapped Ether" },
|
|
5619
|
+
{ symbol: "USDC", address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831", decimals: 6, name: "USD Coin" },
|
|
5620
|
+
{ symbol: "USDC.e", address: "0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", decimals: 6, name: "Bridged USD Coin (legacy)", aliases: ["USDCe"] },
|
|
5621
|
+
{ symbol: "USDT", address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", decimals: 6, name: "Tether USD" },
|
|
5622
|
+
{ symbol: "DAI", address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", decimals: 18, name: "Dai Stablecoin" },
|
|
5623
|
+
{ symbol: "WBTC", address: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", decimals: 8, name: "Wrapped BTC" },
|
|
5624
|
+
{ symbol: "ARB", address: "0x912CE59144191C1204E64559FE8253a0e49E6548", decimals: 18, name: "Arbitrum" }
|
|
5625
|
+
],
|
|
5626
|
+
"opt-mainnet": [
|
|
5627
|
+
{ symbol: "ETH", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "Ether", isNative: true },
|
|
5628
|
+
{ symbol: "WETH", address: "0x4200000000000000000000000000000000000006", decimals: 18, name: "Wrapped Ether" },
|
|
5629
|
+
{ symbol: "USDC", address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", decimals: 6, name: "USD Coin" },
|
|
5630
|
+
{ symbol: "USDC.e", address: "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", decimals: 6, name: "Bridged USD Coin (legacy)", aliases: ["USDCe"] },
|
|
5631
|
+
{ symbol: "USDT", address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58", decimals: 6, name: "Tether USD" },
|
|
5632
|
+
{ symbol: "DAI", address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", decimals: 18, name: "Dai Stablecoin" },
|
|
5633
|
+
{ symbol: "WBTC", address: "0x68f180fcCe6836688e9084f035309E29Bf0A2095", decimals: 8, name: "Wrapped BTC" },
|
|
5634
|
+
{ symbol: "OP", address: "0x4200000000000000000000000000000000000042", decimals: 18, name: "Optimism" }
|
|
5635
|
+
],
|
|
5636
|
+
"polygon-mainnet": [
|
|
5637
|
+
{ symbol: "POL", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "Polygon Ecosystem Token", isNative: true, aliases: ["MATIC"] },
|
|
5638
|
+
{ symbol: "WPOL", address: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", decimals: 18, name: "Wrapped POL", aliases: ["WMATIC"] },
|
|
5639
|
+
{ symbol: "USDC", address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", decimals: 6, name: "USD Coin" },
|
|
5640
|
+
{ symbol: "USDC.e", address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", decimals: 6, name: "Bridged USD Coin (legacy)", aliases: ["USDCe"] },
|
|
5641
|
+
{ symbol: "USDT", address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", decimals: 6, name: "Tether USD" },
|
|
5642
|
+
{ symbol: "DAI", address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", decimals: 18, name: "Dai Stablecoin" },
|
|
5643
|
+
{ symbol: "WETH", address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", decimals: 18, name: "Wrapped Ether" },
|
|
5644
|
+
{ symbol: "WBTC", address: "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6", decimals: 8, name: "Wrapped BTC" }
|
|
5645
|
+
],
|
|
5646
|
+
"bnb-mainnet": [
|
|
5647
|
+
{ symbol: "BNB", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "BNB", isNative: true },
|
|
5648
|
+
{ symbol: "WBNB", address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", decimals: 18, name: "Wrapped BNB" },
|
|
5649
|
+
{ symbol: "USDC", address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", decimals: 18, name: "Binance-Peg USD Coin" },
|
|
5650
|
+
{ symbol: "USDT", address: "0x55d398326f99059fF775485246999027B3197955", decimals: 18, name: "Binance-Peg Tether USD" },
|
|
5651
|
+
{ symbol: "DAI", address: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", decimals: 18, name: "Binance-Peg Dai Token" },
|
|
5652
|
+
{ symbol: "WETH", address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", decimals: 18, name: "Binance-Peg Ether" },
|
|
5653
|
+
{ symbol: "BTCB", address: "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c", decimals: 18, name: "Binance-Peg BTC" }
|
|
5654
|
+
],
|
|
5655
|
+
"avax-mainnet": [
|
|
5656
|
+
{ symbol: "AVAX", address: NATIVE_TOKEN_ADDRESS, decimals: 18, name: "Avalanche", isNative: true },
|
|
5657
|
+
{ symbol: "WAVAX", address: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", decimals: 18, name: "Wrapped AVAX" },
|
|
5658
|
+
{ symbol: "USDC", address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", decimals: 6, name: "USD Coin" },
|
|
5659
|
+
{ symbol: "USDC.e", address: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", decimals: 6, name: "Bridged USD Coin (legacy)", aliases: ["USDCe"] },
|
|
5660
|
+
{ symbol: "USDT", address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", decimals: 6, name: "Tether USD" },
|
|
5661
|
+
{ symbol: "USDT.e", address: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", decimals: 6, name: "Bridged Tether USD (legacy)", aliases: ["USDTe"] },
|
|
5662
|
+
{ symbol: "DAI.e", address: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", decimals: 18, name: "Bridged Dai Stablecoin" },
|
|
5663
|
+
{ symbol: "WETH.e", address: "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB", decimals: 18, name: "Bridged Wrapped Ether" }
|
|
5664
|
+
]
|
|
5665
|
+
};
|
|
5666
|
+
function normalize(symbol) {
|
|
5667
|
+
return symbol.trim().toUpperCase();
|
|
5668
|
+
}
|
|
5669
|
+
var INDEX_CACHE = /* @__PURE__ */ new Map();
|
|
5670
|
+
function indexFor(network) {
|
|
5671
|
+
const cached = INDEX_CACHE.get(network);
|
|
5672
|
+
if (cached) return cached;
|
|
5673
|
+
const entries = REGISTRY[network] ?? [];
|
|
5674
|
+
const index = /* @__PURE__ */ new Map();
|
|
5675
|
+
for (const entry of entries) {
|
|
5676
|
+
index.set(normalize(entry.symbol), entry);
|
|
5677
|
+
for (const alias of entry.aliases ?? []) {
|
|
5678
|
+
index.set(normalize(alias), entry);
|
|
5679
|
+
}
|
|
5680
|
+
}
|
|
5681
|
+
INDEX_CACHE.set(network, index);
|
|
5682
|
+
return index;
|
|
5683
|
+
}
|
|
5684
|
+
function getRegistryNetworks() {
|
|
5685
|
+
return Object.keys(REGISTRY).sort();
|
|
5686
|
+
}
|
|
5687
|
+
function listRegistryTokens(network) {
|
|
5688
|
+
return REGISTRY[network] ?? [];
|
|
5689
|
+
}
|
|
5690
|
+
function findRegistryToken(network, symbol) {
|
|
5691
|
+
return indexFor(network).get(normalize(symbol)) ?? null;
|
|
5692
|
+
}
|
|
5693
|
+
function registrySymbolSuggestions(network) {
|
|
5694
|
+
return listRegistryTokens(network).map((t) => t.symbol);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
// src/commands/approve.ts
|
|
5597
5698
|
function isNativeToken(address2) {
|
|
5598
5699
|
return address2.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
5599
5700
|
}
|
|
@@ -7638,10 +7739,9 @@ function normalizeQuoteError(err, flow) {
|
|
|
7638
7739
|
}
|
|
7639
7740
|
|
|
7640
7741
|
// src/commands/swap.ts
|
|
7641
|
-
var NATIVE_TOKEN_ADDRESS2 = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
7642
7742
|
var NATIVE_DECIMALS = 18;
|
|
7643
7743
|
function isNativeToken2(address2) {
|
|
7644
|
-
return address2.toLowerCase() ===
|
|
7744
|
+
return address2.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
7645
7745
|
}
|
|
7646
7746
|
function slippagePercentToBasisPoints(percent) {
|
|
7647
7747
|
return BigInt(Math.round(percent * 100));
|
|
@@ -7717,6 +7817,11 @@ function registerSwap(program2) {
|
|
|
7717
7817
|
quoteCmd.addHelpText(
|
|
7718
7818
|
"after",
|
|
7719
7819
|
`
|
|
7820
|
+
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
7821
|
+
(ETH, USDC, WETH, USDT, DAI, \u2026). Example:
|
|
7822
|
+
--from $(alchemy evm token ETH --address-only) \\
|
|
7823
|
+
--to $(alchemy evm token USDC --address-only -n eth-mainnet)
|
|
7824
|
+
|
|
7720
7825
|
Examples:
|
|
7721
7826
|
alchemy evm swap quote --from 0xEeee...EEeE --to 0xA0b8...USDC --amount 1.0 -n eth-mainnet
|
|
7722
7827
|
alchemy evm swap quote --from 0xUSDC --to 0xDAI --amount 100 --slippage 1.0`
|
|
@@ -7732,6 +7837,10 @@ Examples:
|
|
|
7732
7837
|
executeCmd.option("--gas-sponsored", "Enable gas sponsorship (env: ALCHEMY_EVM_GAS_SPONSORED)").option("--gas-policy-id <id>", "Gas policy ID for sponsorship (env: ALCHEMY_EVM_GAS_POLICY_ID)").addHelpText(
|
|
7733
7838
|
"after",
|
|
7734
7839
|
`
|
|
7840
|
+
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
7841
|
+
(ETH, USDC, WETH, USDT, DAI, \u2026). Run 'alchemy evm token list' to discover
|
|
7842
|
+
known symbols on the current network.
|
|
7843
|
+
|
|
7735
7844
|
Examples:
|
|
7736
7845
|
alchemy evm swap execute --from 0xEeee...EEeE --to 0xA0b8...USDC --amount 1.0 -n eth-mainnet
|
|
7737
7846
|
alchemy evm swap execute --from 0xUSDC --to 0xDAI --amount 100 --slippage 1.0
|
|
@@ -7894,6 +8003,153 @@ function extractQuoteData(quote) {
|
|
|
7894
8003
|
return { type };
|
|
7895
8004
|
}
|
|
7896
8005
|
|
|
8006
|
+
// src/commands/evm-token.ts
|
|
8007
|
+
function tokenJSON(token, network) {
|
|
8008
|
+
return {
|
|
8009
|
+
symbol: token.symbol,
|
|
8010
|
+
address: token.address,
|
|
8011
|
+
decimals: token.decimals,
|
|
8012
|
+
name: token.name,
|
|
8013
|
+
network,
|
|
8014
|
+
isNative: token.isNative === true,
|
|
8015
|
+
...token.aliases?.length ? { aliases: token.aliases } : {}
|
|
8016
|
+
};
|
|
8017
|
+
}
|
|
8018
|
+
function registerEvmToken(program2) {
|
|
8019
|
+
const cmd = program2.command("token").description(
|
|
8020
|
+
"Look up known token addresses by symbol (ETH, USDC, WETH, etc.)"
|
|
8021
|
+
).argument("[symbol]", "Token symbol (e.g. ETH, USDC, WETH)").option("--address-only", "Print only the resolved address (for scripting)").addHelpText(
|
|
8022
|
+
"after",
|
|
8023
|
+
`
|
|
8024
|
+
Symbols are matched case-insensitively. \`USDC\` resolves to the canonical
|
|
8025
|
+
Circle-issued token; \`USDC.e\` resolves to the legacy bridged variant where
|
|
8026
|
+
applicable. The native gas token (ETH, POL, BNB, AVAX, \u2026) resolves to the
|
|
8027
|
+
EIP-7528 native sentinel 0xEeee\u2026EEeE.
|
|
8028
|
+
|
|
8029
|
+
Examples:
|
|
8030
|
+
alchemy evm token ETH # uses current network
|
|
8031
|
+
alchemy evm token USDC -n base-mainnet
|
|
8032
|
+
alchemy evm token USDC.e -n arb-mainnet
|
|
8033
|
+
alchemy evm token USDC --address-only # prints just the 0x address
|
|
8034
|
+
alchemy --json evm token USDC | jq -r .address
|
|
8035
|
+
|
|
8036
|
+
alchemy evm token list # list tokens on current network
|
|
8037
|
+
alchemy evm token list --all # list tokens across all networks`
|
|
8038
|
+
).action(async (symbol, opts) => {
|
|
8039
|
+
try {
|
|
8040
|
+
if (!symbol) {
|
|
8041
|
+
if (opts.addressOnly) {
|
|
8042
|
+
throw errInvalidArgs(
|
|
8043
|
+
"--address-only requires a symbol. Example: alchemy evm token USDC --address-only"
|
|
8044
|
+
);
|
|
8045
|
+
}
|
|
8046
|
+
await runList(program2, {});
|
|
8047
|
+
return;
|
|
8048
|
+
}
|
|
8049
|
+
await runLookup(program2, symbol, opts);
|
|
8050
|
+
} catch (err) {
|
|
8051
|
+
exitWithError(err);
|
|
8052
|
+
}
|
|
8053
|
+
});
|
|
8054
|
+
cmd.command("list").description("List known token symbols and addresses").option("--all", "List tokens across all supported networks").action(async (opts) => {
|
|
8055
|
+
try {
|
|
8056
|
+
await runList(program2, opts);
|
|
8057
|
+
} catch (err) {
|
|
8058
|
+
exitWithError(err);
|
|
8059
|
+
}
|
|
8060
|
+
});
|
|
8061
|
+
}
|
|
8062
|
+
async function runLookup(program2, symbol, opts) {
|
|
8063
|
+
const network = resolveNetwork(program2);
|
|
8064
|
+
const token = findRegistryToken(network, symbol);
|
|
8065
|
+
if (!token) {
|
|
8066
|
+
const supported = registrySymbolSuggestions(network);
|
|
8067
|
+
if (supported.length === 0) {
|
|
8068
|
+
throw errInvalidArgs(
|
|
8069
|
+
`No token registry entries for network ${network}. Run 'alchemy evm token list --all' to see supported networks, or pass the raw 0x address.`
|
|
8070
|
+
);
|
|
8071
|
+
}
|
|
8072
|
+
throw errNotFound(
|
|
8073
|
+
`token symbol "${symbol}" on ${network}. Known symbols: ${supported.join(", ")}.`
|
|
8074
|
+
);
|
|
8075
|
+
}
|
|
8076
|
+
if (opts.addressOnly) {
|
|
8077
|
+
console.log(token.address);
|
|
8078
|
+
return;
|
|
8079
|
+
}
|
|
8080
|
+
if (isJSONMode()) {
|
|
8081
|
+
printJSON(tokenJSON(token, network));
|
|
8082
|
+
return;
|
|
8083
|
+
}
|
|
8084
|
+
const pairs = [
|
|
8085
|
+
["Symbol", green(token.symbol)],
|
|
8086
|
+
["Name", token.name],
|
|
8087
|
+
["Address", token.address],
|
|
8088
|
+
["Decimals", String(token.decimals)],
|
|
8089
|
+
["Network", network]
|
|
8090
|
+
];
|
|
8091
|
+
if (token.isNative) pairs.push(["Native", "yes"]);
|
|
8092
|
+
if (token.aliases?.length) pairs.push(["Aliases", token.aliases.join(", ")]);
|
|
8093
|
+
printKeyValue(pairs);
|
|
8094
|
+
}
|
|
8095
|
+
async function runList(program2, opts) {
|
|
8096
|
+
if (opts.all) {
|
|
8097
|
+
const data = getRegistryNetworks().map((network2) => ({
|
|
8098
|
+
network: network2,
|
|
8099
|
+
tokens: listRegistryTokens(network2)
|
|
8100
|
+
}));
|
|
8101
|
+
if (isJSONMode()) {
|
|
8102
|
+
printJSON(
|
|
8103
|
+
data.map(({ network: network2, tokens: tokens2 }) => ({
|
|
8104
|
+
network: network2,
|
|
8105
|
+
tokens: tokens2.map((t) => tokenJSON(t, network2))
|
|
8106
|
+
}))
|
|
8107
|
+
);
|
|
8108
|
+
return;
|
|
8109
|
+
}
|
|
8110
|
+
for (let i = 0; i < data.length; i++) {
|
|
8111
|
+
const { network: network2, tokens: tokens2 } = data[i];
|
|
8112
|
+
if (i > 0) console.log("");
|
|
8113
|
+
console.log(` ${green(network2)} ${dim(`(${tokens2.length} tokens)`)}`);
|
|
8114
|
+
printTokenTable(tokens2);
|
|
8115
|
+
}
|
|
8116
|
+
console.log(
|
|
8117
|
+
`
|
|
8118
|
+
${dim("Tip: pass -n/--network <net> to scope a lookup. Use 'alchemy evm token <SYMBOL>' to fetch a single address.")}`
|
|
8119
|
+
);
|
|
8120
|
+
return;
|
|
8121
|
+
}
|
|
8122
|
+
const network = resolveNetwork(program2);
|
|
8123
|
+
const tokens = listRegistryTokens(network);
|
|
8124
|
+
if (isJSONMode()) {
|
|
8125
|
+
printJSON({ network, tokens: tokens.map((t) => tokenJSON(t, network)) });
|
|
8126
|
+
return;
|
|
8127
|
+
}
|
|
8128
|
+
if (tokens.length === 0) {
|
|
8129
|
+
console.log(
|
|
8130
|
+
`
|
|
8131
|
+
${dim(`No registry entries for ${network}. Supported networks: ${getRegistryNetworks().join(", ")}.`)}`
|
|
8132
|
+
);
|
|
8133
|
+
return;
|
|
8134
|
+
}
|
|
8135
|
+
console.log(` ${green(network)} ${dim(`(${tokens.length} tokens)`)}`);
|
|
8136
|
+
printTokenTable(tokens);
|
|
8137
|
+
console.log(
|
|
8138
|
+
`
|
|
8139
|
+
${dim("Tip: 'alchemy evm token <SYMBOL>' resolves one symbol. Add --all to see every network.")}`
|
|
8140
|
+
);
|
|
8141
|
+
}
|
|
8142
|
+
function printTokenTable(tokens) {
|
|
8143
|
+
const rows = tokens.map((t) => [
|
|
8144
|
+
t.symbol,
|
|
8145
|
+
t.name,
|
|
8146
|
+
t.address,
|
|
8147
|
+
String(t.decimals),
|
|
8148
|
+
t.isNative ? "yes" : ""
|
|
8149
|
+
]);
|
|
8150
|
+
printTable(["Symbol", "Name", "Address", "Decimals", "Native"], rows);
|
|
8151
|
+
}
|
|
8152
|
+
|
|
7897
8153
|
// src/commands/trace.ts
|
|
7898
8154
|
function normalizeTraceMethod(method) {
|
|
7899
8155
|
if (method.startsWith("trace_")) return method;
|
|
@@ -7990,6 +8246,7 @@ function registerEvm(program2) {
|
|
|
7990
8246
|
registerEvmSend(cmd);
|
|
7991
8247
|
registerContract(cmd);
|
|
7992
8248
|
registerSwap(cmd);
|
|
8249
|
+
registerEvmToken(cmd);
|
|
7993
8250
|
registerApprove(cmd);
|
|
7994
8251
|
registerStatus(cmd);
|
|
7995
8252
|
registerNetwork(cmd);
|
|
@@ -8175,10 +8432,9 @@ function registerGasManager(program2) {
|
|
|
8175
8432
|
import {
|
|
8176
8433
|
swapActions as swapActions2
|
|
8177
8434
|
} from "@alchemy/wallet-apis/experimental";
|
|
8178
|
-
var NATIVE_TOKEN_ADDRESS3 = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
8179
8435
|
var NATIVE_DECIMALS2 = 18;
|
|
8180
8436
|
function isNativeToken3(address2) {
|
|
8181
|
-
return address2.toLowerCase() ===
|
|
8437
|
+
return address2.toLowerCase() === NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
8182
8438
|
}
|
|
8183
8439
|
function slippagePercentToBasisPoints2(percent) {
|
|
8184
8440
|
return BigInt(Math.round(percent * 100));
|
|
@@ -8269,7 +8525,7 @@ function extractQuoteData2(quote) {
|
|
|
8269
8525
|
}
|
|
8270
8526
|
function registerBridge(program2) {
|
|
8271
8527
|
const cmd = program2.command("bridge").description("Bridge tokens from the source -n/--network to a destination --to-network");
|
|
8272
|
-
const quoteCmd = cmd.command("quote").description("Get a bridge quote without executing").requiredOption("--from <token_address>", `Source token address (use ${
|
|
8528
|
+
const quoteCmd = cmd.command("quote").description("Get a bridge quote without executing").requiredOption("--from <token_address>", `Source token address (use ${NATIVE_TOKEN_ADDRESS} for the native token)`).requiredOption("--to <token_address>", `Destination token address (use ${NATIVE_TOKEN_ADDRESS} for the native token)`).requiredOption("--amount <number>", "Amount to bridge in decimal token units (for example, 1.5)").requiredOption("--to-network <network>", "Destination network (e.g. base-mainnet)").option("--from-address <address>", "Wallet/account address to quote from without changing signer selection").option("--slippage <percent>", "Max slippage percentage (omit to use the API default)");
|
|
8273
8529
|
addSignerOption(quoteCmd);
|
|
8274
8530
|
quoteCmd.addHelpText(
|
|
8275
8531
|
"after",
|
|
@@ -8277,8 +8533,11 @@ function registerBridge(program2) {
|
|
|
8277
8533
|
Source network comes from the global -n/--network flag. Use --to-network for the destination chain.
|
|
8278
8534
|
For same-chain token exchanges, use 'alchemy evm swap'.
|
|
8279
8535
|
|
|
8536
|
+
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
8537
|
+
(ETH, USDC, WETH, USDT, DAI, \u2026) per chain.
|
|
8538
|
+
|
|
8280
8539
|
Examples:
|
|
8281
|
-
alchemy xchain bridge quote --from ${
|
|
8540
|
+
alchemy xchain bridge quote --from ${NATIVE_TOKEN_ADDRESS} --to ${NATIVE_TOKEN_ADDRESS} --amount 0.1 --to-network base-mainnet -n eth-mainnet
|
|
8282
8541
|
alchemy xchain bridge quote --from <eth_usdc_address> --to <arb_usdc_address> --amount 100 --to-network arb-mainnet -n eth-mainnet`
|
|
8283
8542
|
).action(async (opts) => {
|
|
8284
8543
|
try {
|
|
@@ -8287,7 +8546,7 @@ Examples:
|
|
|
8287
8546
|
exitWithError(err);
|
|
8288
8547
|
}
|
|
8289
8548
|
});
|
|
8290
|
-
const executeCmd = cmd.command("execute").description("Execute a cross-chain bridge").requiredOption("--from <token_address>", `Source token address (use ${
|
|
8549
|
+
const executeCmd = cmd.command("execute").description("Execute a cross-chain bridge").requiredOption("--from <token_address>", `Source token address (use ${NATIVE_TOKEN_ADDRESS} for the native token)`).requiredOption("--to <token_address>", `Destination token address (use ${NATIVE_TOKEN_ADDRESS} for the native token)`).requiredOption("--amount <number>", "Amount to bridge in decimal token units (for example, 1.5)").requiredOption("--to-network <network>", "Destination network (e.g. base-mainnet)").option("--slippage <percent>", "Max slippage percentage (omit to use the API default)");
|
|
8291
8550
|
addSignerOption(executeCmd);
|
|
8292
8551
|
executeCmd.option("--gas-sponsored", "Enable gas sponsorship (env: ALCHEMY_EVM_GAS_SPONSORED)").option("--gas-policy-id <id>", "Gas policy ID for sponsorship (env: ALCHEMY_EVM_GAS_POLICY_ID)").addHelpText(
|
|
8293
8552
|
"after",
|
|
@@ -8295,8 +8554,11 @@ Examples:
|
|
|
8295
8554
|
Source network comes from the global -n/--network flag. Use --to-network for the destination chain.
|
|
8296
8555
|
For same-chain token exchanges, use 'alchemy evm swap'.
|
|
8297
8556
|
|
|
8557
|
+
Tip: use 'alchemy evm token <SYMBOL>' to resolve common token addresses
|
|
8558
|
+
(ETH, USDC, WETH, USDT, DAI, \u2026) per chain.
|
|
8559
|
+
|
|
8298
8560
|
Examples:
|
|
8299
|
-
alchemy xchain bridge execute --from ${
|
|
8561
|
+
alchemy xchain bridge execute --from ${NATIVE_TOKEN_ADDRESS} --to ${NATIVE_TOKEN_ADDRESS} --amount 0.1 --to-network base-mainnet -n eth-mainnet
|
|
8300
8562
|
alchemy xchain bridge execute --from <eth_usdc_address> --to <arb_usdc_address> --amount 100 --to-network arb-mainnet --gas-sponsored --gas-policy-id <id> -n eth-mainnet`
|
|
8301
8563
|
).action(async (_opts, cmd2) => {
|
|
8302
8564
|
try {
|
|
@@ -9125,7 +9387,7 @@ async function flushProcessOutput() {
|
|
|
9125
9387
|
}
|
|
9126
9388
|
program.name("alchemy").description(
|
|
9127
9389
|
"The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
|
|
9128
|
-
).version("0.9.
|
|
9390
|
+
).version("0.9.2", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
|
|
9129
9391
|
"-n, --network <network>",
|
|
9130
9392
|
"Target network (default: eth-mainnet) (env: ALCHEMY_NETWORK)"
|
|
9131
9393
|
).option("--x402", "Use x402 wallet-based gateway auth").option(
|
|
@@ -9312,11 +9574,11 @@ ${styledLine}`;
|
|
|
9312
9574
|
"wallet"
|
|
9313
9575
|
];
|
|
9314
9576
|
if (!skipAppPrompt.includes(cmdName) && isInteractiveAllowed(program) && !opts.apiKey && !process.env.ALCHEMY_API_KEY) {
|
|
9315
|
-
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-
|
|
9577
|
+
const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-FQ66OWT7.js");
|
|
9316
9578
|
const authToken = resolveAuthToken2(cfg);
|
|
9317
9579
|
const hasApiKey = Boolean(cfg.api_key?.trim() || cfg.app?.apiKey);
|
|
9318
9580
|
if (authToken && !hasApiKey) {
|
|
9319
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
9581
|
+
const { selectAppAfterAuth } = await import("./auth-6BBITIOZ.js");
|
|
9320
9582
|
console.log("");
|
|
9321
9583
|
console.log(` No app selected. Please select an app to continue.`);
|
|
9322
9584
|
await selectAppAfterAuth(authToken);
|
|
@@ -9351,7 +9613,7 @@ ${styledLine}`;
|
|
|
9351
9613
|
if (isInteractiveAllowed(program)) {
|
|
9352
9614
|
let latestForInteractiveStartup = null;
|
|
9353
9615
|
if (shouldRunOnboarding(program, cfg)) {
|
|
9354
|
-
const { runOnboarding } = await import("./onboarding-
|
|
9616
|
+
const { runOnboarding } = await import("./onboarding-CW7XGRE4.js");
|
|
9355
9617
|
const latest = getAvailableUpdateOnce();
|
|
9356
9618
|
const completed = await runOnboarding(program, latest);
|
|
9357
9619
|
updateShownDuringInteractiveStartup = Boolean(latest);
|
|
@@ -9365,7 +9627,7 @@ ${styledLine}`;
|
|
|
9365
9627
|
latestForInteractiveStartup
|
|
9366
9628
|
);
|
|
9367
9629
|
}
|
|
9368
|
-
const { startREPL } = await import("./interactive-
|
|
9630
|
+
const { startREPL } = await import("./interactive-IBR6RN74.js");
|
|
9369
9631
|
program.exitOverride();
|
|
9370
9632
|
program.configureOutput({
|
|
9371
9633
|
writeErr: () => {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
getSetupMethod
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-P56HOTPV.js";
|
|
6
6
|
import "./chunk-75ICFV5K.js";
|
|
7
7
|
import {
|
|
8
8
|
getRPCNetworkIds
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-SIIZGMK5.js";
|
|
10
10
|
import {
|
|
11
11
|
getUpdateNoticeLines
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HGFU4JCS.js";
|
|
13
13
|
import {
|
|
14
14
|
bold,
|
|
15
15
|
brand,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
|
|
3
3
|
import {
|
|
4
4
|
getUpdateNoticeLines
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HGFU4JCS.js";
|
|
6
6
|
import {
|
|
7
7
|
bold,
|
|
8
8
|
brand,
|
|
@@ -51,7 +51,7 @@ async function runOnboarding(_program, latestUpdate = null) {
|
|
|
51
51
|
auth_token_expires_at: result.expiresAt
|
|
52
52
|
});
|
|
53
53
|
console.log(` ${green("\u2713")} Logged in successfully`);
|
|
54
|
-
const { selectAppAfterAuth } = await import("./auth-
|
|
54
|
+
const { selectAppAfterAuth } = await import("./auth-6BBITIOZ.js");
|
|
55
55
|
await selectAppAfterAuth(result.token);
|
|
56
56
|
return true;
|
|
57
57
|
} catch (err) {
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
errNotLoggedInForPolicyLookup,
|
|
6
6
|
errSponsorshipNeedsPolicy,
|
|
7
7
|
selectOrCreatePolicy
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-TTWOBNJP.js";
|
|
9
|
+
import "./chunk-SIIZGMK5.js";
|
|
10
10
|
import "./chunk-MV7O3XBG.js";
|
|
11
11
|
import "./chunk-GDLPBPG3.js";
|
|
12
12
|
import "./chunk-OVLQH6KL.js";
|