@rareprotocol/rare-cli 1.0.0 → 1.0.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 CHANGED
@@ -19,6 +19,7 @@ rare --help
19
19
  ```
20
20
 
21
21
  See [CHANGELOG.md](./CHANGELOG.md) for release notes and migration guidance.
22
+ For generated reference maps, see [rare-cli-commands.md](./rare-cli-commands.md) and [rare-cli-sdk-client-functions.md](./rare-cli-sdk-client-functions.md).
22
23
 
23
24
  ## Getting Started
24
25
 
@@ -80,13 +81,29 @@ rare configure --show
80
81
 
81
82
  Private keys are masked in the output. Configured account addresses are shown.
82
83
 
84
+ ### 4. Configure Uniswap fallback routes (optional)
85
+
86
+ `rare swap buy-token` and `rare swap sell-token` can fall back to the hosted Uniswap API when `--route auto` cannot build a local route, or when you force `--route uniswap`. Those routes require a Uniswap API key in rare's per-chain wallet config:
87
+
88
+ ```bash
89
+ rare configure --chain sepolia --uniswap-api-key your-uniswap-api-key
90
+ ```
91
+
92
+ You can store the API key in 1Password instead:
93
+
94
+ ```bash
95
+ rare configure --chain sepolia --uniswap-api-key-ref op://Private/uniswap/api-key
96
+ ```
97
+
98
+ The CLI verifies the 1Password reference during configuration, then resolves it only if a hosted Uniswap route is actually needed. Normal user workflows do not read Uniswap keys from `.env` files.
99
+
83
100
  ## Usage
84
101
 
85
102
  Most chain-aware commands accept `--chain` or `--chain-id` to select a network. Defaults to the configured default chain, or `sepolia` when no default is configured.
86
103
 
87
104
  Supported chains: `mainnet`, `sepolia`, `base`, `base-sepolia`
88
105
 
89
- Feature deployment varies by chain. Batch listing, batch offer, RareMinter release, Liquid Edition, and swap flows are currently available on `mainnet` and `sepolia`; batch auction addresses are also configured for `base` and `base-sepolia`.
106
+ Feature deployment varies by chain. Batch listing, batch offer, batch auction, RareMinter release, Liquid Edition, and swap flows are currently available on `mainnet` and `sepolia`.
90
107
 
91
108
  ### Deploy an NFT Collection
92
109
 
@@ -575,6 +592,8 @@ rare swap tokens \
575
592
 
576
593
  `buy-token` and `sell-token` accept `--route auto`, `--route local`, `--route uniswap`, or `--route raw`. Raw route execution requires `--commands`, `--inputs-file`, and `--min-amount-out`.
577
594
 
595
+ With `--route auto`, the CLI tries the local liquid-router path first. If no canonical local route is available, it uses the hosted Uniswap API and requires `uniswapApiKey` or `uniswapApiKeyRef` in the selected chain config.
596
+
578
597
  ### Search
579
598
 
580
599
  ```bash
@@ -847,7 +866,7 @@ await rare.import.erc721({
847
866
 
848
867
  ## Configuration
849
868
 
850
- Config is stored at `~/.rare/config.json`. Each chain has its own key source and RPC URL. A key source can be a plaintext `privateKey` or a 1Password `privateKeyRef` plus a derived public address. `rare configure --show` prints the account address for configured key sources.
869
+ Config is stored at `~/.rare/config.json`. Each chain has its own key source, RPC URL, and optional Uniswap API key source. A wallet key source can be a plaintext `privateKey` or a 1Password `privateKeyRef` plus a derived public address. A Uniswap API key source can be a plaintext `uniswapApiKey` or a 1Password `uniswapApiKeyRef`. `rare configure --show` prints the account address for configured key sources and masks plaintext secrets.
851
870
 
852
871
  ```bash
853
872
  # Set private key and RPC for a chain
@@ -856,6 +875,12 @@ rare configure --chain sepolia --private-key 0x... --rpc-url https://...
856
875
  # Set a 1Password-backed private key reference and RPC for a chain
857
876
  rare configure --chain sepolia --private-key-ref op://Private/rare-sepolia/private-key --rpc-url https://...
858
877
 
878
+ # Set a Uniswap API key for hosted swap fallback routes
879
+ rare configure --chain sepolia --uniswap-api-key your-uniswap-api-key
880
+
881
+ # Or keep the Uniswap API key in 1Password
882
+ rare configure --chain sepolia --uniswap-api-key-ref op://Private/uniswap/api-key
883
+
859
884
  # Configure multiple chains
860
885
  rare configure --chain base --rpc-url https://your-base-rpc.com
861
886
  rare configure --chain base-sepolia --private-key 0x... --rpc-url https://your-base-sepolia-rpc.com
@@ -884,6 +909,7 @@ RARE_API_BASE_URL=https://rare-api.example.com rare listing batch buy --contract
884
909
  - **Use sepolia for testing.** Default to sepolia and only switch to mainnet when you're ready.
885
910
  - **Set a reliable RPC endpoint.** Public endpoints throttle and drop requests. Services like Alchemy or Infura provide free tiers.
886
911
  - **Prefer 1Password for private keys.** Install the 1Password CLI, run `op signin`, and configure keys with `--private-key-ref` to avoid storing plaintext keys in rare config.
912
+ - **Prefer 1Password for Uniswap API keys.** Configure hosted swap fallback routes with `--uniswap-api-key-ref` when you do not want API keys stored in plaintext config.
887
913
  - **Don't share your private key.** If you use `--private-key` or generated saved wallets, keep `~/.rare/config.json` secure and never commit it to version control.
888
914
  - **Check status before transacting.** Use `rare status` and `rare auction status` to inspect on-chain state before sending transactions.
889
915
  - **Back up your wallet.** If you lose your private key, you lose access to your assets. Store a copy somewhere safe.
@@ -916,8 +942,8 @@ Batch, approval, Liquid Edition, and swap infrastructure:
916
942
  |---|---|---|---|---|---|---|---|---|---|
917
943
  | Sepolia | `0xF2bE72d4343beD375Cb6d0E799a3c003163860e0` | `0x371cca54ef859bb0c7b910581a528ee47773fd56` | `0x293AE7701A7830B1d38A7608EdF86A106d9E2645` | `0x972dEe8fa339ad2D9c6cbDA31b67f98Fac242d13` | `0x4619eB29e84392CE91C27FC936A5c94d1D14b93f` | `0x5fa0a461d3a2Ea3bFDf03e8BD37CAbB4ae84205E` | `0xb1777091C953fa2aC1fD67f2b3e2f61343F5Ce5e` | `0x429c3Ee66E7f6CDA12C5BadE4104aF3277aA2305` | `0x61B3f2011A92d183C7dbaDBdA940a7555Ccf9227` |
918
944
  | Mainnet | `0x6a190885A806D39A0A8C348bfA1ac762D72E608d` | `0xe15cf80b25272ade261532efdb7912f9104851d4` | `0x71742c7196f1c334C4c038ce6dcDcEE98097F9Da` | `0x61DBF87164d33FD3695256DC8Ba74D3B1d304170` | `0xa837a7eAff154Ab837617Cf7250648D3Ec0A4436` | `0x4bb0Deea6d1A30C601338aAB776d394C2AE5c0F8` | `0xbb4341CFd588a098e9aCE1D224178836426c4a8E` | `0xEBd58EdA8408d9EA409f2c2bE8898BD9738f3583` | `0x52F0E24D1c21C8A0cB1e5a5dD6198556BD9E1203` |
919
- | Base Sepolia | — | — | `0x2b181ae0f1aea6fed75591b04991b1a3f9868d51` | — | — | — | — | — | — |
920
- | Base | — | — | `0xf776204233bfb52ba0ddff24810cbdbf3dbf94dd` | — | — | — | — | — | — |
945
+ | Base Sepolia | — | — | | — | — | — | — | — | — |
946
+ | Base | — | — | | — | — | — | — | — | — |
921
947
 
922
948
  ## Underlying Solidity Contracts
923
949
 
package/dist/client.d.ts CHANGED
@@ -1960,6 +1960,46 @@ type CollectionRoyaltyInfoResult = {
1960
1960
  defaultReceiver?: Address;
1961
1961
  defaultPercentage?: bigint;
1962
1962
  };
1963
+ type CollectionStatusParams = {
1964
+ contract: Address;
1965
+ tokenId?: IntegerInput;
1966
+ price?: IntegerInput;
1967
+ };
1968
+ type CollectionStatusResult = {
1969
+ contract: Address;
1970
+ name?: string;
1971
+ symbol?: string;
1972
+ owner?: Address;
1973
+ totalSupply?: bigint;
1974
+ maxTokens?: bigint;
1975
+ disabled?: boolean;
1976
+ tokenUrisLocked?: boolean;
1977
+ batchCount?: bigint;
1978
+ defaultReceiver?: Address;
1979
+ defaultPercentage?: bigint;
1980
+ interfaces?: {
1981
+ erc165?: boolean;
1982
+ erc721?: boolean;
1983
+ erc721Metadata?: boolean;
1984
+ erc2981?: boolean;
1985
+ };
1986
+ mintConfig?: {
1987
+ tokenCount: bigint;
1988
+ baseUri: string;
1989
+ lockedMetadata: boolean;
1990
+ };
1991
+ token?: {
1992
+ tokenId: bigint;
1993
+ owner?: Address;
1994
+ tokenUri?: string;
1995
+ creator?: Address;
1996
+ royalty?: {
1997
+ salePrice: bigint;
1998
+ receiver: Address;
1999
+ amount: bigint;
2000
+ };
2001
+ };
2002
+ };
1963
2003
  type CollectionSetDefaultRoyaltyReceiverParams = {
1964
2004
  contract: Address;
1965
2005
  receiver: Address;
@@ -1991,9 +2031,9 @@ type CollectionMintConfigParams = {
1991
2031
  };
1992
2032
  type CollectionMintConfigResult = {
1993
2033
  contract: Address;
1994
- tokenCount: bigint;
1995
- baseUri: string;
1996
- lockedMetadata: boolean;
2034
+ tokenCount?: bigint;
2035
+ baseUri?: string;
2036
+ lockedMetadata?: boolean;
1997
2037
  };
1998
2038
  type CollectionUpdateBaseUriParams = {
1999
2039
  contract: Address;
@@ -2036,6 +2076,7 @@ type CollectionDeployNamespace = {
2036
2076
  };
2037
2077
  type CollectionNamespace = {
2038
2078
  get: (id: string) => Promise<Collection>;
2079
+ status: (params: CollectionStatusParams) => Promise<CollectionStatusResult>;
2039
2080
  deploy: CollectionDeployNamespace;
2040
2081
  mint: (params: CollectionMintParams) => Promise<CollectionMintResult>;
2041
2082
  mintBatch: (params: CollectionMintBatchParams) => Promise<CollectionMintBatchResult>;
@@ -2215,6 +2256,7 @@ type ReleaseConfigureParams = {
2215
2256
  maxMints: IntegerInput;
2216
2257
  splitAddresses?: Address[];
2217
2258
  splitRatios?: number[];
2259
+ autoApprove?: boolean;
2218
2260
  };
2219
2261
  type ReleaseConfigureResult = {
2220
2262
  rareMinter: Address;
@@ -2225,6 +2267,7 @@ type ReleaseConfigureResult = {
2225
2267
  maxMints: bigint;
2226
2268
  splitRecipients: Address[];
2227
2269
  splitRatios: number[];
2270
+ approvalTxHash?: Hash;
2228
2271
  } & TransactionResult;
2229
2272
  type ReleaseMintDirectSaleParams = {
2230
2273
  contract: Address;
@@ -2747,6 +2790,17 @@ type RareClientConfig = {
2747
2790
  * Optional fetch implementation for API-backed SDK methods.
2748
2791
  */
2749
2792
  apiFetch?: typeof fetch;
2793
+ /**
2794
+ * Optional Uniswap Trade API key used when token trades require the hosted
2795
+ * Uniswap route.
2796
+ */
2797
+ uniswapApiKey?: string;
2798
+ /**
2799
+ * Optional lazy Uniswap Trade API key resolver. Prefer this when the key
2800
+ * lives in an external secret manager and should only be read if a hosted
2801
+ * Uniswap route is actually needed.
2802
+ */
2803
+ resolveUniswapApiKey?: () => Promise<string | undefined>;
2750
2804
  };
2751
2805
  type RareClientNftSearchParams = Omit<NftSearchParams, 'chainId'>;
2752
2806
  type RareClientCollectionSearchParams = Omit<CollectionSearchParams, 'chainId'>;
@@ -2888,4 +2942,4 @@ declare class PaymentApprovalRequiredError extends Error {
2888
2942
  });
2889
2943
  }
2890
2944
 
2891
- export { AmountInput, type AuctionBidParams, type AuctionBidResult, type AuctionCancelParams, type AuctionCreateParams, type AuctionCreateResult, type AuctionMarketplaceNamespace, type AuctionNamespace, type AuctionSettleParams, type AuctionStatus, type AuctionStatusParams, type BatchAuctionBidParams, type BatchAuctionBidResult, type BatchAuctionCancelParams, type BatchAuctionCancelResult, type BatchAuctionCreateParams, type BatchAuctionCreateResult, type BatchAuctionNamespace, type BatchAuctionRootSource, type BatchAuctionRootsParams, type BatchAuctionSettleParams, type BatchAuctionSettleResult, type BatchAuctionStatus, type BatchAuctionStatusParams, BatchListingNamespace, type BatchOfferAcceptParams, type BatchOfferAcceptResult, type BatchOfferCreateParams, type BatchOfferCreateResult, type BatchOfferNamespace, type BatchOfferRevokeParams, type BatchOfferRevokeResult, type BatchOfferRootSource, type BatchOfferStatus, type BatchOfferStatusParams, BuildUtilsTreeParams, type BuyRareParams, type BuyRareQuote, type BuyRareResult, type BuyTokenParams, type Collection, type CollectionDeployNamespace, type CollectionLockBaseUriParams, type CollectionLockBaseUriResult, type CollectionMintBatchParams, type CollectionMintBatchResult, type CollectionMintConfigParams, type CollectionMintConfigResult, type CollectionMintParams, type CollectionMintResult, type CollectionNamespace, type CollectionPrepareLazyMintParams, type CollectionPrepareLazyMintResult, type CollectionRoyaltyInfoParams, type CollectionRoyaltyInfoResult, type CollectionSearchParams, type CollectionSetDefaultRoyaltyPercentageParams, type CollectionSetDefaultRoyaltyPercentageResult, type CollectionSetDefaultRoyaltyReceiverParams, type CollectionSetDefaultRoyaltyReceiverResult, type CollectionSetTokenRoyaltyReceiverParams, type CollectionSetTokenRoyaltyReceiverResult, type CollectionTokenCreatorParams, type CollectionTokenCreatorResult, type CollectionUpdateBaseUriParams, type CollectionUpdateBaseUriResult, type CollectionUpdateTokenUriParams, type CollectionUpdateTokenUriResult, CurrencyInfo, CurrencyInput, type CurrencyNamespace, type CurvePresetKey, type DeployErc721Params, type DeployErc721Result, type DeployLazyBatchMintParams, type DeployLazyBatchMintResult, type DeployLazyErc721Params, type DeployLazyErc721Result, type DeployLiquidEditionParams, type DeployLiquidEditionResult, type EventSearchParams, type GeneratePresetCurvesParams, type GeneratePresetCurvesResult, type ImportErc721Params, type ImportNamespace, IntegerInput, type LiquidCurvePreview, type LiquidCurveSegment, type LiquidEditionCurrentPrice, type LiquidEditionMarketState, type LiquidEditionNamespace, type LiquidEditionPoolInfo, type LiquidEditionPoolKey, type LiquidEditionTelemetry, type LiquidFactoryConfig, type LiquidRouterTokenTradeQuote, type ListingBuyParams, type ListingBuyResult, type ListingCancelParams, type ListingCreateParams, type ListingCreateResult, type ListingMarketplaceNamespace, type ListingNamespace, type ListingStatus, type ListingStatusParams, type MediaNamespace, type Nft, NftApprovalRequiredError, type NftAttribute, type NftEvent, type NftMediaEntry, type NftNamespace, type NftSearchParams, type OfferAcceptParams, type OfferAcceptResult, type OfferCancelParams, type OfferCreateParams, type OfferCreateResult, type OfferMarketplaceNamespace, type OfferNamespace, type OfferStatus, type OfferStatusParams, type Pagination, PaymentApprovalRequiredError, type PinMetadataParams, type RareClient, type RareClientCollectionSearchParams, type RareClientConfig, type RareClientContracts, type RareClientEventSearchParams, type RareClientNftGetParams, type RareClientNftSearchParams, type ReleaseAllowlistArtifact, type ReleaseAllowlistConfig, type ReleaseAllowlistInputFormat, type ReleaseAllowlistNamespace, type ReleaseAllowlistWalletProof, type ReleaseConfigureParams, type ReleaseConfigureResult, type ReleaseLimitConfig, type ReleaseLimitsNamespace, type ReleaseMintDirectSaleParams, type ReleaseMintDirectSaleResult, type ReleaseNamespace, type ReleaseSetAllowlistConfigParams, type ReleaseSetAllowlistConfigResult, type ReleaseSetLimitParams, type ReleaseSetLimitResult, type ReleaseStatus, type ReleaseStatusParams, ResolvedCurrency, ResolvedCurrencyWithDecimals, type RouterBuyParams, type RouterSellParams, type RouterSwapTokensParams, type SearchNamespace, type SearchPageResponse, type SellTokenParams, type SetLiquidEditionRenderContractParams, type SetLiquidEditionRenderContractResult, type SwapNamespace, TimestampInput, type TokenContractInfo, type TokenInfo, type TokenNamespace, type TokenStatus, type TokenTradeBaseParams, type TokenTradeExecution, type TokenTradeExecutionRoute, type TokenTradeQuote, type TokenTradeQuoteBase, type TokenTradeQuoteParams, type TokenTradeRawRouteParams, type TokenTradeResult, type TokenTradeRouteMode, type TokenTradeRouteSource, TransactionResult, type UniswapApiTokenTradeQuote, type UserNamespace, type UserProfile, UtilsMerkleProofArtifact, UtilsMerkleProofParams, type UtilsNamespace, UtilsTreeArtifact, UtilsTreeProofArtifact, UtilsTreeProofParams, UtilsTreeProofVerifyParams, type ValidateLiquidCurvesParams, createRareClient };
2945
+ export { AmountInput, type AuctionBidParams, type AuctionBidResult, type AuctionCancelParams, type AuctionCreateParams, type AuctionCreateResult, type AuctionMarketplaceNamespace, type AuctionNamespace, type AuctionSettleParams, type AuctionStatus, type AuctionStatusParams, type BatchAuctionBidParams, type BatchAuctionBidResult, type BatchAuctionCancelParams, type BatchAuctionCancelResult, type BatchAuctionCreateParams, type BatchAuctionCreateResult, type BatchAuctionNamespace, type BatchAuctionRootSource, type BatchAuctionRootsParams, type BatchAuctionSettleParams, type BatchAuctionSettleResult, type BatchAuctionStatus, type BatchAuctionStatusParams, BatchListingNamespace, type BatchOfferAcceptParams, type BatchOfferAcceptResult, type BatchOfferCreateParams, type BatchOfferCreateResult, type BatchOfferNamespace, type BatchOfferRevokeParams, type BatchOfferRevokeResult, type BatchOfferRootSource, type BatchOfferStatus, type BatchOfferStatusParams, BuildUtilsTreeParams, type BuyRareParams, type BuyRareQuote, type BuyRareResult, type BuyTokenParams, type Collection, type CollectionDeployNamespace, type CollectionLockBaseUriParams, type CollectionLockBaseUriResult, type CollectionMintBatchParams, type CollectionMintBatchResult, type CollectionMintConfigParams, type CollectionMintConfigResult, type CollectionMintParams, type CollectionMintResult, type CollectionNamespace, type CollectionPrepareLazyMintParams, type CollectionPrepareLazyMintResult, type CollectionRoyaltyInfoParams, type CollectionRoyaltyInfoResult, type CollectionSearchParams, type CollectionSetDefaultRoyaltyPercentageParams, type CollectionSetDefaultRoyaltyPercentageResult, type CollectionSetDefaultRoyaltyReceiverParams, type CollectionSetDefaultRoyaltyReceiverResult, type CollectionSetTokenRoyaltyReceiverParams, type CollectionSetTokenRoyaltyReceiverResult, type CollectionStatusParams, type CollectionStatusResult, type CollectionTokenCreatorParams, type CollectionTokenCreatorResult, type CollectionUpdateBaseUriParams, type CollectionUpdateBaseUriResult, type CollectionUpdateTokenUriParams, type CollectionUpdateTokenUriResult, CurrencyInfo, CurrencyInput, type CurrencyNamespace, type CurvePresetKey, type DeployErc721Params, type DeployErc721Result, type DeployLazyBatchMintParams, type DeployLazyBatchMintResult, type DeployLazyErc721Params, type DeployLazyErc721Result, type DeployLiquidEditionParams, type DeployLiquidEditionResult, type EventSearchParams, type GeneratePresetCurvesParams, type GeneratePresetCurvesResult, type ImportErc721Params, type ImportNamespace, IntegerInput, type LiquidCurvePreview, type LiquidCurveSegment, type LiquidEditionCurrentPrice, type LiquidEditionMarketState, type LiquidEditionNamespace, type LiquidEditionPoolInfo, type LiquidEditionPoolKey, type LiquidEditionTelemetry, type LiquidFactoryConfig, type LiquidRouterTokenTradeQuote, type ListingBuyParams, type ListingBuyResult, type ListingCancelParams, type ListingCreateParams, type ListingCreateResult, type ListingMarketplaceNamespace, type ListingNamespace, type ListingStatus, type ListingStatusParams, type MediaNamespace, type Nft, NftApprovalRequiredError, type NftAttribute, type NftEvent, type NftMediaEntry, type NftNamespace, type NftSearchParams, type OfferAcceptParams, type OfferAcceptResult, type OfferCancelParams, type OfferCreateParams, type OfferCreateResult, type OfferMarketplaceNamespace, type OfferNamespace, type OfferStatus, type OfferStatusParams, type Pagination, PaymentApprovalRequiredError, type PinMetadataParams, type RareClient, type RareClientCollectionSearchParams, type RareClientConfig, type RareClientContracts, type RareClientEventSearchParams, type RareClientNftGetParams, type RareClientNftSearchParams, type ReleaseAllowlistArtifact, type ReleaseAllowlistConfig, type ReleaseAllowlistInputFormat, type ReleaseAllowlistNamespace, type ReleaseAllowlistWalletProof, type ReleaseConfigureParams, type ReleaseConfigureResult, type ReleaseLimitConfig, type ReleaseLimitsNamespace, type ReleaseMintDirectSaleParams, type ReleaseMintDirectSaleResult, type ReleaseNamespace, type ReleaseSetAllowlistConfigParams, type ReleaseSetAllowlistConfigResult, type ReleaseSetLimitParams, type ReleaseSetLimitResult, type ReleaseStatus, type ReleaseStatusParams, ResolvedCurrency, ResolvedCurrencyWithDecimals, type RouterBuyParams, type RouterSellParams, type RouterSwapTokensParams, type SearchNamespace, type SearchPageResponse, type SellTokenParams, type SetLiquidEditionRenderContractParams, type SetLiquidEditionRenderContractResult, type SwapNamespace, TimestampInput, type TokenContractInfo, type TokenInfo, type TokenNamespace, type TokenStatus, type TokenTradeBaseParams, type TokenTradeExecution, type TokenTradeExecutionRoute, type TokenTradeQuote, type TokenTradeQuoteBase, type TokenTradeQuoteParams, type TokenTradeRawRouteParams, type TokenTradeResult, type TokenTradeRouteMode, type TokenTradeRouteSource, TransactionResult, type UniswapApiTokenTradeQuote, type UserNamespace, type UserProfile, UtilsMerkleProofArtifact, UtilsMerkleProofParams, type UtilsNamespace, UtilsTreeArtifact, UtilsTreeProofArtifact, UtilsTreeProofParams, UtilsTreeProofVerifyParams, type ValidateLiquidCurvesParams, createRareClient };