@sodax/dapp-kit 2.0.0-rc.2 → 2.0.0-rc.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/ai-exported/integration/ai-rules.md +1 -0
- package/ai-exported/integration/architecture.md +2 -0
- package/ai-exported/integration/features/money-market.md +30 -2
- package/ai-exported/integration/recipes/money-market.md +5 -4
- package/ai-exported/integration/recipes/setup.md +24 -0
- package/ai-exported/integration/recipes/wallet-connectivity.md +27 -0
- package/ai-exported/integration/reference/glossary.md +2 -0
- package/ai-exported/migration/breaking-changes/sdk-leakage.md +2 -0
- package/ai-exported/migration/features/bridge.md +50 -13
- package/ai-exported/migration/features/money-market.md +45 -3
- package/ai-exported/migration/features/swap.md +17 -2
- package/ai-exported/migration/recipes.md +11 -14
- package/ai-exported/migration/reference/renamed-hooks.md +2 -0
- package/dist/index.cjs +3 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.mjs +3 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/src/providers/SodaxProvider.tsx +15 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sodax/dapp-kit",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "2.0.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.3",
|
|
5
5
|
"description": "dapp-kit of New World",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.cjs",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"viem": "2.29.2",
|
|
21
|
-
"@sodax/sdk": "2.0.0-rc.
|
|
21
|
+
"@sodax/sdk": "2.0.0-rc.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@tanstack/react-query": "5.87.4",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"check:ai-imports": "bash ./scripts/check-ai-imports.sh",
|
|
59
59
|
"check:ai-snippets": "bash ./scripts/check-ai-snippets.sh",
|
|
60
60
|
"check:ai-keys": "bash ./scripts/check-ai-keys.sh",
|
|
61
|
-
"check:ai-consistency": "bash ./scripts/check-ai-consistency.sh"
|
|
61
|
+
"check:ai-consistency": "bash ./scripts/check-ai-consistency.sh",
|
|
62
|
+
"check:ai": "pnpm run check:ai-exported && pnpm run check:ai-scope && pnpm run check:ai-links && pnpm run check:ai-imports && pnpm run check:ai-snippets && pnpm run check:ai-keys && pnpm run check:ai-consistency"
|
|
62
63
|
}
|
|
63
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo,
|
|
1
|
+
import { useMemo, type ReactNode, type ReactElement } from 'react';
|
|
2
2
|
import { Sodax, type SodaxConfig } from '@sodax/sdk';
|
|
3
3
|
import { SodaxContext } from '@/contexts/index.js';
|
|
4
4
|
import type { DeepPartial } from '@sodax/sdk';
|
|
@@ -6,20 +6,24 @@ import type { DeepPartial } from '@sodax/sdk';
|
|
|
6
6
|
interface SodaxProviderProps {
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
/**
|
|
9
|
-
* Sodax config
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Sodax SDK config. Tracked by **reference** - a new identity re-instantiates the
|
|
10
|
+
* SDK. Hoist to a module constant or wrap in `useMemo`; include any value the SDK
|
|
11
|
+
* should react to (e.g. solver env) in the deps. Inline `{...}` re-creates the SDK
|
|
12
|
+
* every parent render and resets every `useSodaxContext` consumer.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const config = useMemo(() => ({ solver: solverMap[env] }), [env]);
|
|
17
|
+
* <SodaxProvider config={config}>...</SodaxProvider>
|
|
18
|
+
* ```
|
|
13
19
|
*/
|
|
14
20
|
config?: DeepPartial<SodaxConfig>;
|
|
15
21
|
}
|
|
16
22
|
|
|
23
|
+
/** Root provider for `@sodax/dapp-kit`. Must be paired with `QueryClientProvider`. */
|
|
17
24
|
export const SodaxProvider = ({ children, config }: SodaxProviderProps): ReactElement => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const configRef = useRef<DeepPartial<SodaxConfig> | undefined>(config);
|
|
21
|
-
const frozen = configRef.current;
|
|
22
|
-
const sodax = useMemo(() => new Sodax(frozen), [frozen]);
|
|
25
|
+
const sodax = useMemo(() => new Sodax(config), [config]);
|
|
26
|
+
const contextValue = useMemo(() => ({ sodax }), [sodax]);
|
|
23
27
|
|
|
24
|
-
return <SodaxContext.Provider value={
|
|
28
|
+
return <SodaxContext.Provider value={contextValue}>{children}</SodaxContext.Provider>;
|
|
25
29
|
};
|