@talismn/balances-react 0.0.0-pr596-20230306005809 → 0.0.0-pr596-20230306035406

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 CHANGED
@@ -1,6 +1,10 @@
1
1
  # @talismn/balances-react
2
2
 
3
- ## 0.0.0-pr596-20230306005809
3
+ ## 0.0.0-pr596-20230306035406
4
+
5
+ ### Minor Changes
6
+
7
+ - a696909: refactor: tweaks to trigger less balance subscription resets
4
8
 
5
9
  ### Patch Changes
6
10
 
@@ -8,8 +12,8 @@
8
12
  - 6643a4e: fix: ported useDbCache related perf fixes to @talismn/balances-react
9
13
  - Updated dependencies [6643a4e]
10
14
  - Updated dependencies [6643a4e]
11
- - @talismn/token-rates@0.0.0-pr596-20230306005809
12
- - @talismn/balances@0.0.0-pr596-20230306005809
15
+ - @talismn/token-rates@0.0.0-pr596-20230306035406
16
+ - @talismn/balances@0.0.0-pr596-20230306035406
13
17
 
14
18
  ## 0.3.3
15
19
 
@@ -10,12 +10,13 @@ export * from "./useDbCacheSubscription";
10
10
  export * from "./useEvmNetworks";
11
11
  export * from "./useTokenRates";
12
12
  export * from "./useTokens";
13
+ export * from "./useWithTestnets";
13
14
  import { BalanceModule } from "@talismn/balances";
14
15
  import { ReactNode } from "react";
15
16
  export type BalancesProviderProps = {
16
17
  balanceModules: Array<BalanceModule<any, any, any, any, any>>;
17
18
  onfinalityApiKey?: string;
18
- useTestnets?: boolean;
19
+ withTestnets?: boolean;
19
20
  children?: ReactNode;
20
21
  };
21
- export declare const BalancesProvider: ({ balanceModules, onfinalityApiKey, useTestnets, children, }: BalancesProviderProps) => JSX.Element;
22
+ export declare const BalancesProvider: ({ balanceModules, onfinalityApiKey, withTestnets, children, }: BalancesProviderProps) => JSX.Element;
@@ -1,2 +1,2 @@
1
1
  import { HydrateDb } from "@talismn/balances";
2
- export declare const useBalancesHydrate: (withTestnets?: boolean) => HydrateDb;
2
+ export declare const useBalancesHydrate: () => HydrateDb;
@@ -7,6 +7,6 @@ export type ChainConnectorsProviderOptions = {
7
7
  export declare const ChainConnectorsProvider: import("react").FC<ChainConnectorsProviderOptions & {
8
8
  children?: import("react").ReactNode;
9
9
  }>, useChainConnectors: () => {
10
- substrate: ChainConnector | undefined;
11
- evm: ChainConnectorEvm | undefined;
10
+ substrate: ChainConnector;
11
+ evm: ChainConnectorEvm;
12
12
  };
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { ChaindataProvider as Chaindata } from "@talismn/chaindata-provider";
2
+ import { ChaindataProviderExtension } from "@talismn/chaindata-provider-extension";
3
3
  export type ChaindataProviderOptions = {
4
4
  onfinalityApiKey?: string;
5
5
  };
6
6
  export declare const ChaindataProvider: import("react").FC<ChaindataProviderOptions & {
7
7
  children?: import("react").ReactNode;
8
- }>, useChaindata: () => Chaindata | undefined;
8
+ }>, useChaindata: () => ChaindataProviderExtension;
@@ -18,10 +18,7 @@ type DbCache = {
18
18
  tokenRatesMap: Record<TokenId, TokenRates>;
19
19
  balances: BalanceJson[];
20
20
  };
21
- type DbCacheProviderProps = {
22
- useTestnets?: boolean;
23
- };
24
- export declare const DbCacheProvider: import("react").FC<DbCacheProviderProps & {
21
+ export declare const DbCacheProvider: import("react").FC<{
25
22
  children?: import("react").ReactNode;
26
23
  }>, useDbCache: () => DbCache;
27
24
  export {};
@@ -1,9 +1,13 @@
1
- /// <reference types="react" />
2
- export type DbEntityType = "chains" | "evmNetworks" | "tokens" | "tokenRates" | "balances";
3
- export declare const SubscriptionsProvider: import("react").FC<{
4
- children?: import("react").ReactNode;
5
- }>, useSubscriptions: () => ((callback?: ((val: unknown) => void) | undefined) => import("../util").Unsubscribe)[];
1
+ export type DbEntityType = "chains" | "evmNetworks" | "tokens";
6
2
  /**
7
3
  * This hook is responsible for fetching the data used for balances and inserting it into the db.
8
4
  */
9
5
  export declare const useDbCacheSubscription: (subscribeTo: DbEntityType) => void;
6
+ /**
7
+ * This hook is responsible for fetching the data used for token rates and inserting it into the db.
8
+ */
9
+ export declare function useDbCacheTokenRatesSubscription(): void;
10
+ /**
11
+ * This hook is responsible for fetching the data used for balances and inserting it into the db.
12
+ */
13
+ export declare function useDbCacheBalancesSubscription(): void;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const WithTestnetsProvider: import("react").FC<{
3
+ withTestnets?: boolean | undefined;
4
+ } & {
5
+ children?: import("react").ReactNode;
6
+ }>, useWithTestnets: () => {
7
+ withTestnets: boolean | undefined;
8
+ };
@@ -0,0 +1,9 @@
1
+ type UnsubscribeFn = () => void;
2
+ type InitSubscriptionCallback = () => UnsubscribeFn;
3
+ /**
4
+ * This hook ensures a subscription is created only once, and unsubscribe automatically as soon as there is no consumer to the hook
5
+ * @param key key that is unique to the subscription's parameters
6
+ * @param subscribe // subscribe function that will be shared by all consumers of the key
7
+ */
8
+ export declare const useSharedSubscription: (key: string, subscribe: InitSubscriptionCallback) => void;
9
+ export {};