@moonwell-fi/moonwell-sdk 0.20.1 → 0.20.3
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/CHANGELOG.md +14 -0
- package/_cjs/actions/governance/common.js +9 -7
- package/_cjs/actions/governance/common.js.map +1 -1
- package/_cjs/actions/governance/getStakingInfo.js +1 -1
- package/_cjs/actions/governance/getStakingInfo.js.map +1 -1
- package/_cjs/actions/governance/getUserStakingInfo.js +2 -2
- package/_cjs/actions/governance/getUserStakingInfo.js.map +1 -1
- package/_cjs/actions/morpho/user-rewards/common.js +2 -1
- package/_cjs/actions/morpho/user-rewards/common.js.map +1 -1
- package/_cjs/common/lunar-indexer-helpers.js +6 -0
- package/_cjs/common/lunar-indexer-helpers.js.map +1 -1
- package/_cjs/environments/definitions/base/environment.js +2 -1
- package/_cjs/environments/definitions/base/environment.js.map +1 -1
- package/_cjs/environments/definitions/ethereum/contracts.js +1 -0
- package/_cjs/environments/definitions/ethereum/contracts.js.map +1 -1
- package/_cjs/environments/definitions/ethereum/environment.js +2 -1
- package/_cjs/environments/definitions/ethereum/environment.js.map +1 -1
- package/_cjs/environments/definitions/moonbeam/environment.js +2 -1
- package/_cjs/environments/definitions/moonbeam/environment.js.map +1 -1
- package/_cjs/environments/definitions/optimism/environment.js +2 -1
- package/_cjs/environments/definitions/optimism/environment.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/actions/governance/common.js +12 -7
- package/_esm/actions/governance/common.js.map +1 -1
- package/_esm/actions/governance/getStakingInfo.js +1 -1
- package/_esm/actions/governance/getStakingInfo.js.map +1 -1
- package/_esm/actions/governance/getUserStakingInfo.js +2 -2
- package/_esm/actions/governance/getUserStakingInfo.js.map +1 -1
- package/_esm/actions/morpho/user-rewards/common.js +2 -1
- package/_esm/actions/morpho/user-rewards/common.js.map +1 -1
- package/_esm/common/lunar-indexer-helpers.js +23 -0
- package/_esm/common/lunar-indexer-helpers.js.map +1 -1
- package/_esm/environments/definitions/base/environment.js +2 -1
- package/_esm/environments/definitions/base/environment.js.map +1 -1
- package/_esm/environments/definitions/ethereum/contracts.js +9 -0
- package/_esm/environments/definitions/ethereum/contracts.js.map +1 -1
- package/_esm/environments/definitions/ethereum/environment.js +2 -1
- package/_esm/environments/definitions/ethereum/environment.js.map +1 -1
- package/_esm/environments/definitions/moonbeam/environment.js +2 -1
- package/_esm/environments/definitions/moonbeam/environment.js.map +1 -1
- package/_esm/environments/definitions/optimism/environment.js +2 -1
- package/_esm/environments/definitions/optimism/environment.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_types/actions/governance/common.d.ts +3 -3
- package/_types/actions/governance/common.d.ts.map +1 -1
- package/_types/actions/governance/getUserStakingInfo.d.ts.map +1 -1
- package/_types/actions/morpho/user-rewards/common.d.ts.map +1 -1
- package/_types/client/createMoonwellClient.d.ts +2 -0
- package/_types/client/createMoonwellClient.d.ts.map +1 -1
- package/_types/common/lunar-indexer-helpers.d.ts +19 -0
- package/_types/common/lunar-indexer-helpers.d.ts.map +1 -1
- package/_types/environments/definitions/base/environment.d.ts.map +1 -1
- package/_types/environments/definitions/ethereum/contracts.d.ts +1 -0
- package/_types/environments/definitions/ethereum/contracts.d.ts.map +1 -1
- package/_types/environments/definitions/ethereum/environment.d.ts.map +1 -1
- package/_types/environments/definitions/moonbeam/environment.d.ts.map +1 -1
- package/_types/environments/definitions/optimism/environment.d.ts.map +1 -1
- package/_types/environments/index.d.ts +1 -0
- package/_types/environments/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/actions/governance/common.ts +14 -5
- package/actions/governance/getStakingInfo.ts +1 -1
- package/actions/governance/getUserStakingInfo.ts +4 -1
- package/actions/morpho/user-rewards/common.ts +2 -1
- package/common/lunar-indexer-helpers.ts +26 -0
- package/environments/definitions/base/environment.ts +2 -2
- package/environments/definitions/ethereum/contracts.ts +9 -0
- package/environments/definitions/ethereum/environment.ts +2 -2
- package/environments/definitions/moonbeam/environment.ts +2 -2
- package/environments/definitions/optimism/environment.ts +2 -2
- package/errors/version.ts +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
* Helper functions for working with Lunar Indexer marketId and tokenId formats
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Default lunar-indexer worker URL, used when an environment has no
|
|
7
|
+
* `lunarIndexerUrl` configured. Shared with the environment definitions so the
|
|
8
|
+
* production host has a single source of truth.
|
|
9
|
+
*/
|
|
10
|
+
export const DEFAULT_LUNAR_INDEXER_URL =
|
|
11
|
+
"https://lunar-services-worker.moonwell.workers.dev";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Build the base URL for the Merkl proxy exposed by the lunar-indexer worker.
|
|
15
|
+
*
|
|
16
|
+
* Merkl's v4 API needs a server-side API key for production rate limits, and
|
|
17
|
+
* the SDK runs in the browser where it cannot hold that secret. So all Merkl
|
|
18
|
+
* requests go through the worker's `/api/v1/merkl` proxy, which injects the key
|
|
19
|
+
* and passes the query/response through unchanged.
|
|
20
|
+
*
|
|
21
|
+
* @param lunarIndexerUrl - The environment's lunar-indexer base URL. Falls back
|
|
22
|
+
* to the production worker when missing or empty, so Merkl always resolves.
|
|
23
|
+
* @returns The Merkl proxy base URL, with no trailing slash
|
|
24
|
+
*/
|
|
25
|
+
export function getMerklProxyBaseUrl(lunarIndexerUrl?: string): string {
|
|
26
|
+
// `||` (not `??`) so an empty-string misconfig also falls back rather than
|
|
27
|
+
// producing a host-less `/api/v1/merkl/...` URL.
|
|
28
|
+
return `${lunarIndexerUrl || DEFAULT_LUNAR_INDEXER_URL}/api/v1/merkl`;
|
|
29
|
+
}
|
|
30
|
+
|
|
5
31
|
/**
|
|
6
32
|
* Build a marketId string from chainId and market address
|
|
7
33
|
* Format: {chainId}-{marketAddress}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { http, defineChain, fallback } from "viem";
|
|
2
2
|
import { base as baseChain } from "viem/chains";
|
|
3
|
+
import { DEFAULT_LUNAR_INDEXER_URL } from "../../../common/lunar-indexer-helpers.js";
|
|
3
4
|
import {
|
|
4
5
|
type Environment,
|
|
5
6
|
createEnvironmentConfig,
|
|
@@ -39,8 +40,7 @@ const createEnvironment = (
|
|
|
39
40
|
governanceIndexerUrl:
|
|
40
41
|
governanceIndexerUrl ||
|
|
41
42
|
"https://lunar-services-worker.moonwell.workers.dev",
|
|
42
|
-
lunarIndexerUrl:
|
|
43
|
-
lunarIndexerUrl || "https://lunar-services-worker.moonwell.workers.dev",
|
|
43
|
+
lunarIndexerUrl: lunarIndexerUrl || DEFAULT_LUNAR_INDEXER_URL,
|
|
44
44
|
tokens,
|
|
45
45
|
markets,
|
|
46
46
|
vaults,
|
|
@@ -14,6 +14,15 @@ export const contracts = createContractsConfig({
|
|
|
14
14
|
// no-ops on confirm.
|
|
15
15
|
comptroller: "0xdec80bb934397575594e91970b37baf65f5b21be",
|
|
16
16
|
views: "0x2d85b9c48a8c582f0AA244e134e9C6f30Cf7786e",
|
|
17
|
+
// MultiRewardDistributor (MRD_PROXY, deployed with MIP-E00) — the
|
|
18
|
+
// comptroller's `rewardDistributor()`. Reward *APRs* come from the `views`
|
|
19
|
+
// contract / indexer, not this address; what needs it is the app's
|
|
20
|
+
// reward-claim flow (useUserRewardsData), which keys off its presence:
|
|
21
|
+
// defined ⇒ claim via the comptroller's `claimReward(holders, mTokens, …)`
|
|
22
|
+
// (the EVM path Base/Optimism use), absent ⇒ fall back to the Moonbeam
|
|
23
|
+
// `0x…0808` precompile `batchAll`, which reverts on Ethereum. Required so
|
|
24
|
+
// users can claim the WELL rewards MIP-X59 starts accruing on Core markets.
|
|
25
|
+
multiRewardDistributor: "0x60142B8d76FaC5b88cfB422Ba1aA905d2171851c",
|
|
17
26
|
multichainGovernor: "0x8769B70ac7c93AF0e75de0D69877709B66d75838",
|
|
18
27
|
// mWETHRouter — wraps native ETH to WETH on supply and unwraps WETH to
|
|
19
28
|
// native ETH on withdraw, matching the mWETHRouter pattern used on Base
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { http, defineChain, fallback } from "viem";
|
|
2
2
|
import { mainnet } from "viem/chains";
|
|
3
|
+
import { DEFAULT_LUNAR_INDEXER_URL } from "../../../common/lunar-indexer-helpers.js";
|
|
3
4
|
import {
|
|
4
5
|
type Environment,
|
|
5
6
|
createEnvironmentConfig,
|
|
@@ -39,8 +40,7 @@ const createEnvironment = (
|
|
|
39
40
|
governanceIndexerUrl:
|
|
40
41
|
governanceIndexerUrl ||
|
|
41
42
|
"https://lunar-services-worker.moonwell.workers.dev",
|
|
42
|
-
lunarIndexerUrl:
|
|
43
|
-
lunarIndexerUrl || "https://lunar-services-worker.moonwell.workers.dev",
|
|
43
|
+
lunarIndexerUrl: lunarIndexerUrl || DEFAULT_LUNAR_INDEXER_URL,
|
|
44
44
|
tokens,
|
|
45
45
|
markets,
|
|
46
46
|
vaults: {},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { http, fallback } from "viem";
|
|
2
2
|
import { moonbeam } from "viem/chains";
|
|
3
|
+
import { DEFAULT_LUNAR_INDEXER_URL } from "../../../common/lunar-indexer-helpers.js";
|
|
3
4
|
import { createEnvironmentConfig } from "../../types/config.js";
|
|
4
5
|
import { contracts } from "./contracts.js";
|
|
5
6
|
import { markets } from "./core-markets.js";
|
|
@@ -23,8 +24,7 @@ const createEnvironment = (
|
|
|
23
24
|
transport: rpcUrls
|
|
24
25
|
? fallback(rpcUrls.map((url) => http(url)))
|
|
25
26
|
: http("https://rpc.moonwell.fi/main/evm/1284"),
|
|
26
|
-
lunarIndexerUrl:
|
|
27
|
-
lunarIndexerUrl || "https://lunar-services-worker.moonwell.workers.dev",
|
|
27
|
+
lunarIndexerUrl: lunarIndexerUrl || DEFAULT_LUNAR_INDEXER_URL,
|
|
28
28
|
governanceIndexerUrl:
|
|
29
29
|
governanceIndexerUrl ||
|
|
30
30
|
"https://lunar-services-worker.moonwell.workers.dev",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { http, defineChain, fallback } from "viem";
|
|
2
2
|
import { optimism as optimismChain } from "viem/chains";
|
|
3
|
+
import { DEFAULT_LUNAR_INDEXER_URL } from "../../../common/lunar-indexer-helpers.js";
|
|
3
4
|
import { createEnvironmentConfig } from "../../types/config.js";
|
|
4
5
|
import { contracts } from "./contracts.js";
|
|
5
6
|
import { markets } from "./core-markets.js";
|
|
@@ -26,8 +27,7 @@ const createEnvironment = (
|
|
|
26
27
|
transport: rpcUrls
|
|
27
28
|
? fallback(rpcUrls.map((url) => http(url)))
|
|
28
29
|
: http("https://rpc.moonwell.fi/main/evm/10"),
|
|
29
|
-
lunarIndexerUrl:
|
|
30
|
-
lunarIndexerUrl || "https://lunar-services-worker.moonwell.workers.dev",
|
|
30
|
+
lunarIndexerUrl: lunarIndexerUrl || DEFAULT_LUNAR_INDEXER_URL,
|
|
31
31
|
governanceIndexerUrl:
|
|
32
32
|
governanceIndexerUrl ||
|
|
33
33
|
"https://lunar-services-worker.moonwell.workers.dev",
|
package/errors/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '0.20.
|
|
1
|
+
export const version = '0.20.3'
|