@talismn/token-rates 0.0.0-pr573-20230227134247 → 0.0.0-pr577-20230228061431

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,11 +1,10 @@
1
1
  # @talismn/token-rates
2
2
 
3
- ## 0.0.0-pr573-20230227134247
3
+ ## 0.0.0-pr577-20230228061431
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies [87a1348]
8
- - @talismn/chaindata-provider@0.0.0-pr573-20230227134247
7
+ - 6643a4e: fix: tokenRates in @talismn/balances-react
9
8
 
10
9
  ## 0.1.14
11
10
 
@@ -0,0 +1,7 @@
1
+ import { Dexie } from "dexie";
2
+ import { DbTokenRates } from "./types";
3
+ export declare class TalismanTokenRatesDatabase extends Dexie {
4
+ tokenRates: Dexie.Table<DbTokenRates, string>;
5
+ constructor();
6
+ }
7
+ export declare const db: TalismanTokenRatesDatabase;
@@ -1,2 +1,3 @@
1
+ export * from "./TalismanTokenRatesDatabase";
1
2
  export * from "./TokenRates";
2
3
  export * from "./types";
@@ -1,6 +1,10 @@
1
1
  import { TokenId } from "@talismn/chaindata-provider";
2
2
  export type TokenRatesList = Record<TokenId, TokenRates>;
3
3
  export type TokenRateCurrency = keyof TokenRates;
4
+ export type DbTokenRates = {
5
+ tokenId: TokenId;
6
+ rates: TokenRates;
7
+ };
4
8
  export type TokenRates = {
5
9
  /** us dollar rate */
6
10
  usd: number | null;
@@ -2,12 +2,34 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var dexie = require('dexie');
5
6
  var axios = require('axios');
6
7
 
7
8
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
9
 
9
10
  var axios__default = /*#__PURE__*/_interopDefault(axios);
10
11
 
12
+ class TalismanTokenRatesDatabase extends dexie.Dexie {
13
+ constructor() {
14
+ super("TalismanTokenRates");
15
+
16
+ // https://dexie.org/docs/Tutorial/Design#database-versioning
17
+ this.version(1).stores({
18
+ // You only need to specify properties that you wish to index.
19
+ // The object store will allow any properties on your stored objects but you can only query them by indexed properties
20
+ // https://dexie.org/docs/API-Reference#declare-database
21
+ //
22
+ // Never index properties containing images, movies or large (huge) strings. Store them in IndexedDB, yes! but just don’t index them!
23
+ // https://dexie.org/docs/Version/Version.stores()#warning
24
+ tokenRates: "tokenId"
25
+ });
26
+
27
+ // this.on("ready", async () => {})
28
+ }
29
+ }
30
+
31
+ const db = new TalismanTokenRatesDatabase();
32
+
11
33
  const NewTokenRates = () => ({
12
34
  usd: null,
13
35
  aud: null,
@@ -104,5 +126,7 @@ function hasCoingeckoId(token) {
104
126
  }
105
127
 
106
128
  exports.NewTokenRates = NewTokenRates;
129
+ exports.TalismanTokenRatesDatabase = TalismanTokenRatesDatabase;
130
+ exports.db = db;
107
131
  exports.fetchTokenRates = fetchTokenRates;
108
132
  exports.hasCoingeckoId = hasCoingeckoId;
@@ -2,12 +2,34 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var dexie = require('dexie');
5
6
  var axios = require('axios');
6
7
 
7
8
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
9
 
9
10
  var axios__default = /*#__PURE__*/_interopDefault(axios);
10
11
 
12
+ class TalismanTokenRatesDatabase extends dexie.Dexie {
13
+ constructor() {
14
+ super("TalismanTokenRates");
15
+
16
+ // https://dexie.org/docs/Tutorial/Design#database-versioning
17
+ this.version(1).stores({
18
+ // You only need to specify properties that you wish to index.
19
+ // The object store will allow any properties on your stored objects but you can only query them by indexed properties
20
+ // https://dexie.org/docs/API-Reference#declare-database
21
+ //
22
+ // Never index properties containing images, movies or large (huge) strings. Store them in IndexedDB, yes! but just don’t index them!
23
+ // https://dexie.org/docs/Version/Version.stores()#warning
24
+ tokenRates: "tokenId"
25
+ });
26
+
27
+ // this.on("ready", async () => {})
28
+ }
29
+ }
30
+
31
+ const db = new TalismanTokenRatesDatabase();
32
+
11
33
  const NewTokenRates = () => ({
12
34
  usd: null,
13
35
  aud: null,
@@ -104,5 +126,7 @@ function hasCoingeckoId(token) {
104
126
  }
105
127
 
106
128
  exports.NewTokenRates = NewTokenRates;
129
+ exports.TalismanTokenRatesDatabase = TalismanTokenRatesDatabase;
130
+ exports.db = db;
107
131
  exports.fetchTokenRates = fetchTokenRates;
108
132
  exports.hasCoingeckoId = hasCoingeckoId;
@@ -1,5 +1,27 @@
1
+ import { Dexie } from 'dexie';
1
2
  import axios from 'axios';
2
3
 
4
+ class TalismanTokenRatesDatabase extends Dexie {
5
+ constructor() {
6
+ super("TalismanTokenRates");
7
+
8
+ // https://dexie.org/docs/Tutorial/Design#database-versioning
9
+ this.version(1).stores({
10
+ // You only need to specify properties that you wish to index.
11
+ // The object store will allow any properties on your stored objects but you can only query them by indexed properties
12
+ // https://dexie.org/docs/API-Reference#declare-database
13
+ //
14
+ // Never index properties containing images, movies or large (huge) strings. Store them in IndexedDB, yes! but just don’t index them!
15
+ // https://dexie.org/docs/Version/Version.stores()#warning
16
+ tokenRates: "tokenId"
17
+ });
18
+
19
+ // this.on("ready", async () => {})
20
+ }
21
+ }
22
+
23
+ const db = new TalismanTokenRatesDatabase();
24
+
3
25
  const NewTokenRates = () => ({
4
26
  usd: null,
5
27
  aud: null,
@@ -95,4 +117,4 @@ function hasCoingeckoId(token) {
95
117
  return "coingeckoId" in token && typeof token.coingeckoId === "string";
96
118
  }
97
119
 
98
- export { NewTokenRates, fetchTokenRates, hasCoingeckoId };
120
+ export { NewTokenRates, TalismanTokenRatesDatabase, db, fetchTokenRates, hasCoingeckoId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/token-rates",
3
- "version": "0.0.0-pr573-20230227134247",
3
+ "version": "0.0.0-pr577-20230228061431",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "UNLICENSED",
@@ -26,8 +26,9 @@
26
26
  "clean": "rm -rf dist && rm -rf .turbo rm -rf node_modules"
27
27
  },
28
28
  "dependencies": {
29
- "@talismn/chaindata-provider": "^0.0.0-pr573-20230227134247",
30
- "axios": "^0.27.2"
29
+ "@talismn/chaindata-provider": "^0.4.2",
30
+ "axios": "^0.27.2",
31
+ "dexie": "^3.2.2"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@talismn/eslint-config": "^0.0.1",