@zyfai/sdk 0.11.2 → 0.12.0
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 +36 -0
- package/dist/index.d.mts +86 -1
- package/dist/index.d.ts +86 -1
- package/dist/index.js +99 -0
- package/dist/index.mjs +99 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -654,6 +654,31 @@ const redeeming = (portfolio.pendingAsyncWithdrawals ?? []).some(
|
|
|
654
654
|
);
|
|
655
655
|
```
|
|
656
656
|
|
|
657
|
+
### Claim rZFI Rewards
|
|
658
|
+
|
|
659
|
+
rZFI accrues to the user's Safe on Base and is claimed by the owner EOA. The
|
|
660
|
+
claim is gas-sponsored and the SDK never signs: you sign one hash in your own
|
|
661
|
+
pipeline.
|
|
662
|
+
|
|
663
|
+
```typescript
|
|
664
|
+
// 1. Prepare (throws if there is nothing to claim)
|
|
665
|
+
const prepared = await sdk.prepareRzfiClaim(userAddress);
|
|
666
|
+
// prepared.claimableAmount (wei), prepared.userOpHashToSign
|
|
667
|
+
|
|
668
|
+
// 2. Sign the raw 32-byte hash with the owner EOA (personal_sign)
|
|
669
|
+
const signature = await walletClient.signMessage({
|
|
670
|
+
account: userAddress,
|
|
671
|
+
message: { raw: prepared.userOpHashToSign! },
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
// 3. Submit within 5 minutes
|
|
675
|
+
const { txHash } = await sdk.submitRzfiClaim(userAddress, signature);
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
`prepared.userOperation` is the full userOp behind the hash if you want to
|
|
679
|
+
verify it before signing. A retryable error means the Merkl reward tree is
|
|
680
|
+
being updated on-chain; call `prepareRzfiClaim` again in a few minutes.
|
|
681
|
+
|
|
657
682
|
### 6. Get Available Protocols
|
|
658
683
|
|
|
659
684
|
Retrieve all available DeFi protocols and pools for a specific chain:
|
|
@@ -1186,6 +1211,17 @@ console.log("APY per strategy:", apyPerStrategy.data);
|
|
|
1186
1211
|
// Each item includes average_apy_withFee and average_apy_with_rzfi_withFee
|
|
1187
1212
|
```
|
|
1188
1213
|
|
|
1214
|
+
### Base Merkl Campaign APR
|
|
1215
|
+
|
|
1216
|
+
Current APR of Zyfai's Merkl incentive campaigns on Base (paid on top of
|
|
1217
|
+
strategy yield). APR is a decimal: `0.011` = 1.1%.
|
|
1218
|
+
|
|
1219
|
+
```typescript
|
|
1220
|
+
const campaigns = await sdk.getBaseMerklCampaigns();
|
|
1221
|
+
// [{ id: "base/rzfi", name, apr, tvlUsd, activeWallets, rewardToken,
|
|
1222
|
+
// totalRewards, dailyRewardAmount, startDate, endDate, isActive }, ...]
|
|
1223
|
+
```
|
|
1224
|
+
|
|
1189
1225
|
### 12. SDK API Key Management
|
|
1190
1226
|
|
|
1191
1227
|
#### Add Wallet to SDK API Key
|
package/dist/index.d.mts
CHANGED
|
@@ -776,6 +776,42 @@ interface WithdrawLifecycleResponse {
|
|
|
776
776
|
statusUrl: string;
|
|
777
777
|
estimatedClaimAt?: string | null;
|
|
778
778
|
}
|
|
779
|
+
/** Base Merkl campaign slots served by the data API. */
|
|
780
|
+
type BaseMerklCampaignId = "base" | "base-new-tvl" | "base/rzfi";
|
|
781
|
+
/** A Zyfai Merkl incentive campaign on Base, from {@link ZyfaiSDK.getBaseMerklCampaigns}. */
|
|
782
|
+
interface MerklCampaign {
|
|
783
|
+
id: BaseMerklCampaignId;
|
|
784
|
+
name: string;
|
|
785
|
+
/** Current campaign APR as a decimal (0.011 = 1.1%), on top of strategy yield. */
|
|
786
|
+
apr: number;
|
|
787
|
+
tvlUsd: number;
|
|
788
|
+
activeWallets: number;
|
|
789
|
+
rewardToken: Address;
|
|
790
|
+
totalRewards: number;
|
|
791
|
+
dailyRewardAmount: number;
|
|
792
|
+
startDate: string;
|
|
793
|
+
endDate: string;
|
|
794
|
+
/** True while now is between startDate and endDate. */
|
|
795
|
+
isActive: boolean;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Two-step rZFI claim state from {@link ZyfaiSDK.prepareRzfiClaim} and
|
|
799
|
+
* {@link ZyfaiSDK.submitRzfiClaim}.
|
|
800
|
+
*/
|
|
801
|
+
interface RzfiClaimResponse {
|
|
802
|
+
success: boolean;
|
|
803
|
+
status: "pending" | "claimed";
|
|
804
|
+
/** Safe that receives the rZFI (Base). */
|
|
805
|
+
safeAddress: Address;
|
|
806
|
+
/** rZFI being claimed, in wei (18 decimals). */
|
|
807
|
+
claimableAmount: string;
|
|
808
|
+
/** Present when pending: sign with the owner EOA (personal_sign of the raw hash). */
|
|
809
|
+
userOpHashToSign?: Hex;
|
|
810
|
+
/** Present when pending: the userOperation behind the hash, for verification. */
|
|
811
|
+
userOperation?: Record<string, unknown>;
|
|
812
|
+
/** Present when claimed. */
|
|
813
|
+
txHash?: Hex;
|
|
814
|
+
}
|
|
779
815
|
interface LogDepositResponse {
|
|
780
816
|
success: boolean;
|
|
781
817
|
message: string;
|
|
@@ -1903,6 +1939,37 @@ declare class ZyfaiSDK {
|
|
|
1903
1939
|
data: Hex;
|
|
1904
1940
|
value: "0";
|
|
1905
1941
|
}>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Prepare a gas-sponsored rZFI claim into the user's Safe on Base.
|
|
1944
|
+
*
|
|
1945
|
+
* @remarks
|
|
1946
|
+
* The SDK never signs. Sign `userOpHashToSign` with the owner EOA as a
|
|
1947
|
+
* personal_sign of the raw 32-byte hash (viem:
|
|
1948
|
+
* `signMessage({ message: { raw: userOpHashToSign } })`), then pass the
|
|
1949
|
+
* signature to {@link ZyfaiSDK.submitRzfiClaim} within 5 minutes.
|
|
1950
|
+
* Requires an authenticated user session.
|
|
1951
|
+
*
|
|
1952
|
+
* @group Rewards
|
|
1953
|
+
*
|
|
1954
|
+
* @param userAddress - Owner EOA
|
|
1955
|
+
* @returns `status: "pending"` with the hash to sign and the amount
|
|
1956
|
+
*
|
|
1957
|
+
* @throws If there is no rZFI to claim, or the reward tree is updating (retry later)
|
|
1958
|
+
*/
|
|
1959
|
+
prepareRzfiClaim(userAddress: string): Promise<RzfiClaimResponse>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Submit the owner-signed rZFI claim prepared by {@link ZyfaiSDK.prepareRzfiClaim}.
|
|
1962
|
+
*
|
|
1963
|
+
* @group Rewards
|
|
1964
|
+
*
|
|
1965
|
+
* @param userAddress - Owner EOA
|
|
1966
|
+
* @param userOpSignature - Owner EOA signature over `userOpHashToSign`
|
|
1967
|
+
* @returns `status: "claimed"` with the on-chain `txHash`
|
|
1968
|
+
*
|
|
1969
|
+
* @throws If the signature is not the owner's, the claim expired, or it reverted
|
|
1970
|
+
*/
|
|
1971
|
+
submitRzfiClaim(userAddress: string, userOpSignature: Hex): Promise<RzfiClaimResponse>;
|
|
1972
|
+
private assertRzfiClaimUser;
|
|
1906
1973
|
/** Apply the same per-asset minimum portfolio rule as sendDeposit. */
|
|
1907
1974
|
private enforceMinimumPortfolioBalance;
|
|
1908
1975
|
/**
|
|
@@ -2258,6 +2325,24 @@ declare class ZyfaiSDK {
|
|
|
2258
2325
|
* ```
|
|
2259
2326
|
*/
|
|
2260
2327
|
getUserDetails(asset?: SupportedAsset): Promise<UpdateUserProfileResponse>;
|
|
2328
|
+
/**
|
|
2329
|
+
* Get Zyfai's Merkl incentive campaigns on Base with their current APR.
|
|
2330
|
+
*
|
|
2331
|
+
* @group Analytics and opportunities
|
|
2332
|
+
*
|
|
2333
|
+
* @remarks Data API. Partner API key only; SIWE not required.
|
|
2334
|
+
*
|
|
2335
|
+
* @returns One entry per campaign slot (rZFI, new TVL, season campaign)
|
|
2336
|
+
*
|
|
2337
|
+
* @example
|
|
2338
|
+
* ```typescript
|
|
2339
|
+
* const campaigns = await sdk.getBaseMerklCampaigns();
|
|
2340
|
+
* for (const c of campaigns.filter((c) => c.isActive)) {
|
|
2341
|
+
* console.log(c.name, `${(c.apr * 100).toFixed(2)}%`);
|
|
2342
|
+
* }
|
|
2343
|
+
* ```
|
|
2344
|
+
*/
|
|
2345
|
+
getBaseMerklCampaigns(): Promise<MerklCampaign[]>;
|
|
2261
2346
|
/**
|
|
2262
2347
|
* Get total value locked (TVL) across all Zyfai accounts.
|
|
2263
2348
|
*
|
|
@@ -3165,4 +3250,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
3165
3250
|
*/
|
|
3166
3251
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
3167
3252
|
|
|
3168
|
-
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
|
3253
|
+
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
package/dist/index.d.ts
CHANGED
|
@@ -776,6 +776,42 @@ interface WithdrawLifecycleResponse {
|
|
|
776
776
|
statusUrl: string;
|
|
777
777
|
estimatedClaimAt?: string | null;
|
|
778
778
|
}
|
|
779
|
+
/** Base Merkl campaign slots served by the data API. */
|
|
780
|
+
type BaseMerklCampaignId = "base" | "base-new-tvl" | "base/rzfi";
|
|
781
|
+
/** A Zyfai Merkl incentive campaign on Base, from {@link ZyfaiSDK.getBaseMerklCampaigns}. */
|
|
782
|
+
interface MerklCampaign {
|
|
783
|
+
id: BaseMerklCampaignId;
|
|
784
|
+
name: string;
|
|
785
|
+
/** Current campaign APR as a decimal (0.011 = 1.1%), on top of strategy yield. */
|
|
786
|
+
apr: number;
|
|
787
|
+
tvlUsd: number;
|
|
788
|
+
activeWallets: number;
|
|
789
|
+
rewardToken: Address;
|
|
790
|
+
totalRewards: number;
|
|
791
|
+
dailyRewardAmount: number;
|
|
792
|
+
startDate: string;
|
|
793
|
+
endDate: string;
|
|
794
|
+
/** True while now is between startDate and endDate. */
|
|
795
|
+
isActive: boolean;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Two-step rZFI claim state from {@link ZyfaiSDK.prepareRzfiClaim} and
|
|
799
|
+
* {@link ZyfaiSDK.submitRzfiClaim}.
|
|
800
|
+
*/
|
|
801
|
+
interface RzfiClaimResponse {
|
|
802
|
+
success: boolean;
|
|
803
|
+
status: "pending" | "claimed";
|
|
804
|
+
/** Safe that receives the rZFI (Base). */
|
|
805
|
+
safeAddress: Address;
|
|
806
|
+
/** rZFI being claimed, in wei (18 decimals). */
|
|
807
|
+
claimableAmount: string;
|
|
808
|
+
/** Present when pending: sign with the owner EOA (personal_sign of the raw hash). */
|
|
809
|
+
userOpHashToSign?: Hex;
|
|
810
|
+
/** Present when pending: the userOperation behind the hash, for verification. */
|
|
811
|
+
userOperation?: Record<string, unknown>;
|
|
812
|
+
/** Present when claimed. */
|
|
813
|
+
txHash?: Hex;
|
|
814
|
+
}
|
|
779
815
|
interface LogDepositResponse {
|
|
780
816
|
success: boolean;
|
|
781
817
|
message: string;
|
|
@@ -1903,6 +1939,37 @@ declare class ZyfaiSDK {
|
|
|
1903
1939
|
data: Hex;
|
|
1904
1940
|
value: "0";
|
|
1905
1941
|
}>;
|
|
1942
|
+
/**
|
|
1943
|
+
* Prepare a gas-sponsored rZFI claim into the user's Safe on Base.
|
|
1944
|
+
*
|
|
1945
|
+
* @remarks
|
|
1946
|
+
* The SDK never signs. Sign `userOpHashToSign` with the owner EOA as a
|
|
1947
|
+
* personal_sign of the raw 32-byte hash (viem:
|
|
1948
|
+
* `signMessage({ message: { raw: userOpHashToSign } })`), then pass the
|
|
1949
|
+
* signature to {@link ZyfaiSDK.submitRzfiClaim} within 5 minutes.
|
|
1950
|
+
* Requires an authenticated user session.
|
|
1951
|
+
*
|
|
1952
|
+
* @group Rewards
|
|
1953
|
+
*
|
|
1954
|
+
* @param userAddress - Owner EOA
|
|
1955
|
+
* @returns `status: "pending"` with the hash to sign and the amount
|
|
1956
|
+
*
|
|
1957
|
+
* @throws If there is no rZFI to claim, or the reward tree is updating (retry later)
|
|
1958
|
+
*/
|
|
1959
|
+
prepareRzfiClaim(userAddress: string): Promise<RzfiClaimResponse>;
|
|
1960
|
+
/**
|
|
1961
|
+
* Submit the owner-signed rZFI claim prepared by {@link ZyfaiSDK.prepareRzfiClaim}.
|
|
1962
|
+
*
|
|
1963
|
+
* @group Rewards
|
|
1964
|
+
*
|
|
1965
|
+
* @param userAddress - Owner EOA
|
|
1966
|
+
* @param userOpSignature - Owner EOA signature over `userOpHashToSign`
|
|
1967
|
+
* @returns `status: "claimed"` with the on-chain `txHash`
|
|
1968
|
+
*
|
|
1969
|
+
* @throws If the signature is not the owner's, the claim expired, or it reverted
|
|
1970
|
+
*/
|
|
1971
|
+
submitRzfiClaim(userAddress: string, userOpSignature: Hex): Promise<RzfiClaimResponse>;
|
|
1972
|
+
private assertRzfiClaimUser;
|
|
1906
1973
|
/** Apply the same per-asset minimum portfolio rule as sendDeposit. */
|
|
1907
1974
|
private enforceMinimumPortfolioBalance;
|
|
1908
1975
|
/**
|
|
@@ -2258,6 +2325,24 @@ declare class ZyfaiSDK {
|
|
|
2258
2325
|
* ```
|
|
2259
2326
|
*/
|
|
2260
2327
|
getUserDetails(asset?: SupportedAsset): Promise<UpdateUserProfileResponse>;
|
|
2328
|
+
/**
|
|
2329
|
+
* Get Zyfai's Merkl incentive campaigns on Base with their current APR.
|
|
2330
|
+
*
|
|
2331
|
+
* @group Analytics and opportunities
|
|
2332
|
+
*
|
|
2333
|
+
* @remarks Data API. Partner API key only; SIWE not required.
|
|
2334
|
+
*
|
|
2335
|
+
* @returns One entry per campaign slot (rZFI, new TVL, season campaign)
|
|
2336
|
+
*
|
|
2337
|
+
* @example
|
|
2338
|
+
* ```typescript
|
|
2339
|
+
* const campaigns = await sdk.getBaseMerklCampaigns();
|
|
2340
|
+
* for (const c of campaigns.filter((c) => c.isActive)) {
|
|
2341
|
+
* console.log(c.name, `${(c.apr * 100).toFixed(2)}%`);
|
|
2342
|
+
* }
|
|
2343
|
+
* ```
|
|
2344
|
+
*/
|
|
2345
|
+
getBaseMerklCampaigns(): Promise<MerklCampaign[]>;
|
|
2261
2346
|
/**
|
|
2262
2347
|
* Get total value locked (TVL) across all Zyfai accounts.
|
|
2263
2348
|
*
|
|
@@ -3165,4 +3250,4 @@ declare const ERC7579_LAUNCHPAD_ADDRESS: Address$1;
|
|
|
3165
3250
|
*/
|
|
3166
3251
|
declare const POOL_MODULE_ADDRESSES: readonly Address$1[];
|
|
3167
3252
|
|
|
3168
|
-
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
|
3253
|
+
export { ALLOWED_HISTORY_DAYS, API_ENDPOINT, type APYPerStrategy, type APYPerStrategyResponse, type ActionData, type ActiveWallet, type ActiveWalletsResponse, type AddWalletToSdkResponse, type Address, type AllocationDetail, type AllowedHistoryDays, type ApyPosition, type AsyncWithdrawal, type AsyncWithdrawalStatus, type BackendEnvironment, type BankrProvider, type BankrProviderConfig, type BaseMerklCampaignId, type BestOpportunityDetails, type BestOpportunityResponse, type ChainConfig, type ChainPortfolio, type ChainTokenEarnings, type CustomizationConfig, type CustomizeBatchRequest, type CustomizeBatchResponse, DATA_API_BASE_URLS, DATA_API_ENDPOINT, DEFAULT_RELAY_SLIPPAGE_BPS, DEFAULT_TOKEN_ADDRESSES, type DailyApyEntry, type DailyApyHistoryPeriod, type DailyApyHistoryResponse, type DailyEarning, type DailyEarningsResponse, type DebankPortfolioResponse, type DepegEvent, type DeploySafeResponse, type DepositLifecycleResponse, type DepositLifecycleStatus, type DepositPositionOutcome, type DepositResponse, type DepositRoute, type DepositRouteInput, ERC7579_LAUNCHPAD_ADDRESS, type ERC7739Context, type ERC7739Data, EXECUTION_API_BASE_URLS, type ExcludedPool, type FirstTopupResponse, type GetPoolsResponse, type GetSelectedPoolsResponse, type Hex, type HistoryEntry, type HistoryFeeData, type HistoryPosition, type HistoryRebalanceLog, type HistoryResponse, INTENT_EXECUTOR, INTENT_SMART_SESSIONS, LOCAL_DATA_API_BASE_URL, LOCAL_EXECUTION_API_BASE_URL, LOCAL_WS_URL, type LiquidityDropEvent, type LogDepositResponse, MAX_RELAY_SLIPPAGE_BPS, type MerklCampaign, type NewCollateralDetectedEvent, OWNABLE_VALIDATOR, type OnchainEarnings, type OnchainEarningsResponse, type OpportunitiesResponse, type Opportunity, type OpportunityPosition, POOL_MODULE_ADDRESSES, PROXY_EXECUTOR, type PolicyData, type Pool, type Portfolio, type PortfolioAssetBalance, type PortfolioByAssetType, type PortfolioByChain, type PortfolioDetailed, type PortfolioDetailedResponse, type PortfolioResponse, type PortfolioToken, type PositionSlot, type Protocol, type ProtocolsResponse, RELAY_SLIPPAGE_PRESETS_BPS, type RebalanceFrequencyResponse, type RegisterAgentResponse, type RzfiClaimResponse, SAFE_7579_ADDRESS, type SDKConfig, SMART_SESSIONS_FALLBACK, SMART_SESSIONS_VALIDATOR, STAGING_DATA_API_BASE_URL, STAGING_EXECUTION_API_BASE_URL, STAGING_WS_URL, type SdkKeyTVLResponse, type SendDepositParams, type Session, type SessionKeyResponse, type SimulateBestPositionsParams, type SimulateBestPositionsResponse, type SimulateCalldataItem, type SimulatedPosition, type SmartWalletByEOAResponse, type SmartWalletResponse, type Strategy, type SupportedAsset, type SupportedChainId, type SwapDepositOrder, type SwapDepositParams, type SwapDepositQuote, type TVLResponse, type TokenApy, type TokenEarnings, type UpdateUserProfileRequest, type UpdateUserProfileResponse, type UserPosition, type UserSessionAuth, VAULT_ADDRESS, type VaultAsset, type VaultClaimResponse, type VaultDepositResponse, type VaultSharesResponse, type VaultWithdrawResponse, type VaultWithdrawStatusResponse, type VolumeResponse, WS_ENDPOINT, WS_URLS, type WaitForDepositCreditOptions, type WaitForDepositPositionOptions, type WaitForWithdrawCompleteOptions, type WaitForWithdrawSettlementOptions, type WalletTVL, type WithdrawAsyncLeg, type WithdrawLifecycleResponse, type WithdrawLifecycleStatus, type WithdrawResponse, type ZyfaiEventFilters, type ZyfaiEventHandlers, ZyfaiSDK, createBankrProvider, getChainConfig, getDataApiBaseUrl, getDefaultTokenAddress, getExecutionApiBaseUrl, getManagedAssets, getSupportedChainIds, getWsUrl, isSupportedChain, resolveDepositRoute, resolveRelaySlippageBps, type staleBalances };
|
package/dist/index.js
CHANGED
|
@@ -136,6 +136,7 @@ var ENDPOINTS = {
|
|
|
136
136
|
WITHDRAW_STATUS: (withdrawalId) => `/users/withdrawals/${withdrawalId}`,
|
|
137
137
|
// Safe Deployment (single endpoint)
|
|
138
138
|
SAFE_DEPLOY: "/users/safe-deploy",
|
|
139
|
+
RZFI_CLAIM: "/users/rzfi-claim",
|
|
139
140
|
// Multichain deploy for predeployed (pool) wallets — deploys + rotates the
|
|
140
141
|
// same address on the requested chains (sponsored, no user signature).
|
|
141
142
|
DEPLOY_CHAINS: "/users/deploy-chains",
|
|
@@ -187,6 +188,8 @@ var ENDPOINTS = {
|
|
|
187
188
|
CUSTOMIZATION_SELECTED_POOLS: (protocolId, chainId) => `/customization/selected-pools?protocolId=${protocolId}&chainId=${chainId}`
|
|
188
189
|
};
|
|
189
190
|
var DATA_ENDPOINTS = {
|
|
191
|
+
// Merkl incentive campaigns
|
|
192
|
+
MERKL_CAMPAIGN_INFO: (campaign) => `/merkl/${campaign}/campaign-info`,
|
|
190
193
|
// User Initialization
|
|
191
194
|
USER_INITIALIZE: "/api/earnings/initialize",
|
|
192
195
|
// Earnings
|
|
@@ -4256,6 +4259,57 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
4256
4259
|
value: "0"
|
|
4257
4260
|
};
|
|
4258
4261
|
}
|
|
4262
|
+
/**
|
|
4263
|
+
* Prepare a gas-sponsored rZFI claim into the user's Safe on Base.
|
|
4264
|
+
*
|
|
4265
|
+
* @remarks
|
|
4266
|
+
* The SDK never signs. Sign `userOpHashToSign` with the owner EOA as a
|
|
4267
|
+
* personal_sign of the raw 32-byte hash (viem:
|
|
4268
|
+
* `signMessage({ message: { raw: userOpHashToSign } })`), then pass the
|
|
4269
|
+
* signature to {@link ZyfaiSDK.submitRzfiClaim} within 5 minutes.
|
|
4270
|
+
* Requires an authenticated user session.
|
|
4271
|
+
*
|
|
4272
|
+
* @group Rewards
|
|
4273
|
+
*
|
|
4274
|
+
* @param userAddress - Owner EOA
|
|
4275
|
+
* @returns `status: "pending"` with the hash to sign and the amount
|
|
4276
|
+
*
|
|
4277
|
+
* @throws If there is no rZFI to claim, or the reward tree is updating (retry later)
|
|
4278
|
+
*/
|
|
4279
|
+
async prepareRzfiClaim(userAddress) {
|
|
4280
|
+
this.assertRzfiClaimUser(userAddress);
|
|
4281
|
+
await this.authenticateUser();
|
|
4282
|
+
return this.httpClient.post(ENDPOINTS.RZFI_CLAIM, {});
|
|
4283
|
+
}
|
|
4284
|
+
/**
|
|
4285
|
+
* Submit the owner-signed rZFI claim prepared by {@link ZyfaiSDK.prepareRzfiClaim}.
|
|
4286
|
+
*
|
|
4287
|
+
* @group Rewards
|
|
4288
|
+
*
|
|
4289
|
+
* @param userAddress - Owner EOA
|
|
4290
|
+
* @param userOpSignature - Owner EOA signature over `userOpHashToSign`
|
|
4291
|
+
* @returns `status: "claimed"` with the on-chain `txHash`
|
|
4292
|
+
*
|
|
4293
|
+
* @throws If the signature is not the owner's, the claim expired, or it reverted
|
|
4294
|
+
*/
|
|
4295
|
+
async submitRzfiClaim(userAddress, userOpSignature) {
|
|
4296
|
+
this.assertRzfiClaimUser(userAddress);
|
|
4297
|
+
if (!userOpSignature?.startsWith("0x")) {
|
|
4298
|
+
throw new Error("A 0x-prefixed userOpSignature is required");
|
|
4299
|
+
}
|
|
4300
|
+
await this.authenticateUser();
|
|
4301
|
+
return this.httpClient.post(ENDPOINTS.RZFI_CLAIM, {
|
|
4302
|
+
userOpSignature
|
|
4303
|
+
});
|
|
4304
|
+
}
|
|
4305
|
+
assertRzfiClaimUser(userAddress) {
|
|
4306
|
+
if (!userAddress) {
|
|
4307
|
+
throw new Error("A user address is required");
|
|
4308
|
+
}
|
|
4309
|
+
if (this.sessionEoa && (0, import_viem4.getAddress)(userAddress) !== this.sessionEoa) {
|
|
4310
|
+
throw new Error("userAddress does not match authenticated session EOA");
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
4259
4313
|
/** Apply the same per-asset minimum portfolio rule as sendDeposit. */
|
|
4260
4314
|
async enforceMinimumPortfolioBalance(chainId, asset, amount, safeAddress, userAddress) {
|
|
4261
4315
|
if (this.bypassMinPortfolio || isMainnetMinPortfolioExempt(chainId, userAddress, safeAddress)) {
|
|
@@ -5121,6 +5175,51 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5121
5175
|
// ============================================================================
|
|
5122
5176
|
// TVL & Volume Methods
|
|
5123
5177
|
// ============================================================================
|
|
5178
|
+
/**
|
|
5179
|
+
* Get Zyfai's Merkl incentive campaigns on Base with their current APR.
|
|
5180
|
+
*
|
|
5181
|
+
* @group Analytics and opportunities
|
|
5182
|
+
*
|
|
5183
|
+
* @remarks Data API. Partner API key only; SIWE not required.
|
|
5184
|
+
*
|
|
5185
|
+
* @returns One entry per campaign slot (rZFI, new TVL, season campaign)
|
|
5186
|
+
*
|
|
5187
|
+
* @example
|
|
5188
|
+
* ```typescript
|
|
5189
|
+
* const campaigns = await sdk.getBaseMerklCampaigns();
|
|
5190
|
+
* for (const c of campaigns.filter((c) => c.isActive)) {
|
|
5191
|
+
* console.log(c.name, `${(c.apr * 100).toFixed(2)}%`);
|
|
5192
|
+
* }
|
|
5193
|
+
* ```
|
|
5194
|
+
*/
|
|
5195
|
+
async getBaseMerklCampaigns() {
|
|
5196
|
+
const ids = ["base/rzfi", "base-new-tvl", "base"];
|
|
5197
|
+
try {
|
|
5198
|
+
const now = Date.now();
|
|
5199
|
+
return await Promise.all(
|
|
5200
|
+
ids.map(async (id) => {
|
|
5201
|
+
const { campaign, currentStats } = await this.httpClient.dataGet(DATA_ENDPOINTS.MERKL_CAMPAIGN_INFO(id));
|
|
5202
|
+
return {
|
|
5203
|
+
id,
|
|
5204
|
+
name: campaign.name,
|
|
5205
|
+
apr: Number(currentStats.currentAPR),
|
|
5206
|
+
tvlUsd: currentStats.totalTVL,
|
|
5207
|
+
activeWallets: currentStats.activeWallets,
|
|
5208
|
+
rewardToken: campaign.rewardToken,
|
|
5209
|
+
totalRewards: campaign.totalRewards,
|
|
5210
|
+
dailyRewardAmount: campaign.dailyRewardAmount,
|
|
5211
|
+
startDate: campaign.startDate,
|
|
5212
|
+
endDate: campaign.endDate,
|
|
5213
|
+
isActive: now >= Date.parse(campaign.startDate) && now < Date.parse(campaign.endDate)
|
|
5214
|
+
};
|
|
5215
|
+
})
|
|
5216
|
+
);
|
|
5217
|
+
} catch (error) {
|
|
5218
|
+
throw new Error(
|
|
5219
|
+
`Failed to get Base Merkl campaigns: ${error.message}`
|
|
5220
|
+
);
|
|
5221
|
+
}
|
|
5222
|
+
}
|
|
5124
5223
|
/**
|
|
5125
5224
|
* Get total value locked (TVL) across all Zyfai accounts.
|
|
5126
5225
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -62,6 +62,7 @@ var ENDPOINTS = {
|
|
|
62
62
|
WITHDRAW_STATUS: (withdrawalId) => `/users/withdrawals/${withdrawalId}`,
|
|
63
63
|
// Safe Deployment (single endpoint)
|
|
64
64
|
SAFE_DEPLOY: "/users/safe-deploy",
|
|
65
|
+
RZFI_CLAIM: "/users/rzfi-claim",
|
|
65
66
|
// Multichain deploy for predeployed (pool) wallets — deploys + rotates the
|
|
66
67
|
// same address on the requested chains (sponsored, no user signature).
|
|
67
68
|
DEPLOY_CHAINS: "/users/deploy-chains",
|
|
@@ -113,6 +114,8 @@ var ENDPOINTS = {
|
|
|
113
114
|
CUSTOMIZATION_SELECTED_POOLS: (protocolId, chainId) => `/customization/selected-pools?protocolId=${protocolId}&chainId=${chainId}`
|
|
114
115
|
};
|
|
115
116
|
var DATA_ENDPOINTS = {
|
|
117
|
+
// Merkl incentive campaigns
|
|
118
|
+
MERKL_CAMPAIGN_INFO: (campaign) => `/merkl/${campaign}/campaign-info`,
|
|
116
119
|
// User Initialization
|
|
117
120
|
USER_INITIALIZE: "/api/earnings/initialize",
|
|
118
121
|
// Earnings
|
|
@@ -4208,6 +4211,57 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
4208
4211
|
value: "0"
|
|
4209
4212
|
};
|
|
4210
4213
|
}
|
|
4214
|
+
/**
|
|
4215
|
+
* Prepare a gas-sponsored rZFI claim into the user's Safe on Base.
|
|
4216
|
+
*
|
|
4217
|
+
* @remarks
|
|
4218
|
+
* The SDK never signs. Sign `userOpHashToSign` with the owner EOA as a
|
|
4219
|
+
* personal_sign of the raw 32-byte hash (viem:
|
|
4220
|
+
* `signMessage({ message: { raw: userOpHashToSign } })`), then pass the
|
|
4221
|
+
* signature to {@link ZyfaiSDK.submitRzfiClaim} within 5 minutes.
|
|
4222
|
+
* Requires an authenticated user session.
|
|
4223
|
+
*
|
|
4224
|
+
* @group Rewards
|
|
4225
|
+
*
|
|
4226
|
+
* @param userAddress - Owner EOA
|
|
4227
|
+
* @returns `status: "pending"` with the hash to sign and the amount
|
|
4228
|
+
*
|
|
4229
|
+
* @throws If there is no rZFI to claim, or the reward tree is updating (retry later)
|
|
4230
|
+
*/
|
|
4231
|
+
async prepareRzfiClaim(userAddress) {
|
|
4232
|
+
this.assertRzfiClaimUser(userAddress);
|
|
4233
|
+
await this.authenticateUser();
|
|
4234
|
+
return this.httpClient.post(ENDPOINTS.RZFI_CLAIM, {});
|
|
4235
|
+
}
|
|
4236
|
+
/**
|
|
4237
|
+
* Submit the owner-signed rZFI claim prepared by {@link ZyfaiSDK.prepareRzfiClaim}.
|
|
4238
|
+
*
|
|
4239
|
+
* @group Rewards
|
|
4240
|
+
*
|
|
4241
|
+
* @param userAddress - Owner EOA
|
|
4242
|
+
* @param userOpSignature - Owner EOA signature over `userOpHashToSign`
|
|
4243
|
+
* @returns `status: "claimed"` with the on-chain `txHash`
|
|
4244
|
+
*
|
|
4245
|
+
* @throws If the signature is not the owner's, the claim expired, or it reverted
|
|
4246
|
+
*/
|
|
4247
|
+
async submitRzfiClaim(userAddress, userOpSignature) {
|
|
4248
|
+
this.assertRzfiClaimUser(userAddress);
|
|
4249
|
+
if (!userOpSignature?.startsWith("0x")) {
|
|
4250
|
+
throw new Error("A 0x-prefixed userOpSignature is required");
|
|
4251
|
+
}
|
|
4252
|
+
await this.authenticateUser();
|
|
4253
|
+
return this.httpClient.post(ENDPOINTS.RZFI_CLAIM, {
|
|
4254
|
+
userOpSignature
|
|
4255
|
+
});
|
|
4256
|
+
}
|
|
4257
|
+
assertRzfiClaimUser(userAddress) {
|
|
4258
|
+
if (!userAddress) {
|
|
4259
|
+
throw new Error("A user address is required");
|
|
4260
|
+
}
|
|
4261
|
+
if (this.sessionEoa && getAddress2(userAddress) !== this.sessionEoa) {
|
|
4262
|
+
throw new Error("userAddress does not match authenticated session EOA");
|
|
4263
|
+
}
|
|
4264
|
+
}
|
|
4211
4265
|
/** Apply the same per-asset minimum portfolio rule as sendDeposit. */
|
|
4212
4266
|
async enforceMinimumPortfolioBalance(chainId, asset, amount, safeAddress, userAddress) {
|
|
4213
4267
|
if (this.bypassMinPortfolio || isMainnetMinPortfolioExempt(chainId, userAddress, safeAddress)) {
|
|
@@ -5073,6 +5127,51 @@ var _ZyfaiSDK = class _ZyfaiSDK {
|
|
|
5073
5127
|
// ============================================================================
|
|
5074
5128
|
// TVL & Volume Methods
|
|
5075
5129
|
// ============================================================================
|
|
5130
|
+
/**
|
|
5131
|
+
* Get Zyfai's Merkl incentive campaigns on Base with their current APR.
|
|
5132
|
+
*
|
|
5133
|
+
* @group Analytics and opportunities
|
|
5134
|
+
*
|
|
5135
|
+
* @remarks Data API. Partner API key only; SIWE not required.
|
|
5136
|
+
*
|
|
5137
|
+
* @returns One entry per campaign slot (rZFI, new TVL, season campaign)
|
|
5138
|
+
*
|
|
5139
|
+
* @example
|
|
5140
|
+
* ```typescript
|
|
5141
|
+
* const campaigns = await sdk.getBaseMerklCampaigns();
|
|
5142
|
+
* for (const c of campaigns.filter((c) => c.isActive)) {
|
|
5143
|
+
* console.log(c.name, `${(c.apr * 100).toFixed(2)}%`);
|
|
5144
|
+
* }
|
|
5145
|
+
* ```
|
|
5146
|
+
*/
|
|
5147
|
+
async getBaseMerklCampaigns() {
|
|
5148
|
+
const ids = ["base/rzfi", "base-new-tvl", "base"];
|
|
5149
|
+
try {
|
|
5150
|
+
const now = Date.now();
|
|
5151
|
+
return await Promise.all(
|
|
5152
|
+
ids.map(async (id) => {
|
|
5153
|
+
const { campaign, currentStats } = await this.httpClient.dataGet(DATA_ENDPOINTS.MERKL_CAMPAIGN_INFO(id));
|
|
5154
|
+
return {
|
|
5155
|
+
id,
|
|
5156
|
+
name: campaign.name,
|
|
5157
|
+
apr: Number(currentStats.currentAPR),
|
|
5158
|
+
tvlUsd: currentStats.totalTVL,
|
|
5159
|
+
activeWallets: currentStats.activeWallets,
|
|
5160
|
+
rewardToken: campaign.rewardToken,
|
|
5161
|
+
totalRewards: campaign.totalRewards,
|
|
5162
|
+
dailyRewardAmount: campaign.dailyRewardAmount,
|
|
5163
|
+
startDate: campaign.startDate,
|
|
5164
|
+
endDate: campaign.endDate,
|
|
5165
|
+
isActive: now >= Date.parse(campaign.startDate) && now < Date.parse(campaign.endDate)
|
|
5166
|
+
};
|
|
5167
|
+
})
|
|
5168
|
+
);
|
|
5169
|
+
} catch (error) {
|
|
5170
|
+
throw new Error(
|
|
5171
|
+
`Failed to get Base Merkl campaigns: ${error.message}`
|
|
5172
|
+
);
|
|
5173
|
+
}
|
|
5174
|
+
}
|
|
5076
5175
|
/**
|
|
5077
5176
|
* Get total value locked (TVL) across all Zyfai accounts.
|
|
5078
5177
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zyfai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "TypeScript SDK for self-custodial Zyfai yield agents: discover DeFi opportunities and manage deposits, withdrawals, positions, and strategies across Ethereum, Base, and Arbitrum",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|