@talismn/chaindata-provider 0.2.0 → 0.4.1

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{ChaindataProvider.d.ts → declarations/src/ChaindataProvider.d.ts} +0 -0
  3. package/dist/{github.d.ts → declarations/src/github.d.ts} +0 -0
  4. package/dist/{index.d.ts → declarations/src/index.d.ts} +0 -0
  5. package/dist/{plugins.d.ts → declarations/src/plugins.d.ts} +0 -0
  6. package/dist/{types → declarations/src/types}/Chain.d.ts +9 -5
  7. package/dist/{types → declarations/src/types}/EvmNetwork.d.ts +5 -5
  8. package/dist/{types → declarations/src/types}/MultiChain.d.ts +3 -3
  9. package/dist/{types → declarations/src/types}/Token.d.ts +7 -7
  10. package/dist/{types → declarations/src/types}/index.d.ts +0 -0
  11. package/dist/talismn-chaindata-provider.cjs.d.ts +1 -0
  12. package/dist/talismn-chaindata-provider.cjs.dev.js +25 -0
  13. package/dist/talismn-chaindata-provider.cjs.js +7 -0
  14. package/dist/talismn-chaindata-provider.cjs.prod.js +25 -0
  15. package/dist/talismn-chaindata-provider.esm.js +12 -0
  16. package/package.json +12 -10
  17. package/plugins/dist/talismn-chaindata-provider-plugins.cjs.d.ts +1 -0
  18. package/plugins/dist/talismn-chaindata-provider-plugins.cjs.dev.js +2 -0
  19. package/plugins/dist/talismn-chaindata-provider-plugins.cjs.js +7 -0
  20. package/plugins/dist/talismn-chaindata-provider-plugins.cjs.prod.js +2 -0
  21. package/plugins/dist/talismn-chaindata-provider-plugins.esm.js +1 -0
  22. package/plugins/package.json +2 -3
  23. package/dist/ChaindataProvider.js +0 -2
  24. package/dist/github.js +0 -16
  25. package/dist/index.js +0 -19
  26. package/dist/plugins.js +0 -2
  27. package/dist/types/Chain.js +0 -2
  28. package/dist/types/EvmNetwork.js +0 -2
  29. package/dist/types/MultiChain.js +0 -2
  30. package/dist/types/Token.js +0 -2
  31. package/dist/types/index.js +0 -31
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @talismn/chaindata-provider
2
2
 
3
+ ## 0.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 8adc7f06: feat: switched build tool to preconstruct
8
+
9
+ ## 0.2.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 4aa691d: feat: new balance modules
14
+
3
15
  ## 0.2.0
4
16
 
5
17
  ## 0.1.10
File without changes
@@ -1,8 +1,8 @@
1
1
  import { EvmNetworkId } from "./EvmNetwork";
2
2
  import { TokenId } from "./Token";
3
- export declare type ChainList = Record<ChainId, Chain | CustomChain>;
4
- export declare type ChainId = string;
5
- export declare type Chain = {
3
+ export type ChainList = Record<ChainId, Chain | CustomChain>;
4
+ export type ChainId = string;
5
+ export type Chain = {
6
6
  id: ChainId;
7
7
  isTestnet: boolean;
8
8
  sortIndex: number | null;
@@ -30,11 +30,15 @@ export declare type Chain = {
30
30
  parathreads?: Chain[];
31
31
  paraId: number | null;
32
32
  relay?: Chain;
33
+ balanceMetadata: Array<{
34
+ moduleType: string;
35
+ metadata: any;
36
+ }>;
33
37
  };
34
- export declare type CustomChain = Chain & {
38
+ export type CustomChain = Chain & {
35
39
  isCustom: true;
36
40
  };
37
- export declare type SubstrateRpc = {
41
+ export type SubstrateRpc = {
38
42
  url: string;
39
43
  isHealthy: boolean;
40
44
  };
@@ -1,8 +1,8 @@
1
1
  import { ChainId } from "./Chain";
2
2
  import { TokenId } from "./Token";
3
- export declare type EvmNetworkList = Record<EvmNetworkId, EvmNetwork | CustomEvmNetwork>;
4
- export declare type EvmNetworkId = string;
5
- export declare type EvmNetwork = {
3
+ export type EvmNetworkList = Record<EvmNetworkId, EvmNetwork | CustomEvmNetwork>;
4
+ export type EvmNetworkId = string;
5
+ export type EvmNetwork = {
6
6
  id: EvmNetworkId;
7
7
  isTestnet: boolean;
8
8
  sortIndex: number | null;
@@ -21,12 +21,12 @@ export declare type EvmNetwork = {
21
21
  id: ChainId;
22
22
  } | null;
23
23
  };
24
- export declare type CustomEvmNetwork = EvmNetwork & {
24
+ export type CustomEvmNetwork = EvmNetwork & {
25
25
  isCustom: true;
26
26
  explorerUrls: string[];
27
27
  iconUrls: string[];
28
28
  };
29
- export declare type EthereumRpc = {
29
+ export type EthereumRpc = {
30
30
  url: string;
31
31
  isHealthy: boolean;
32
32
  };
@@ -1,9 +1,9 @@
1
1
  import { ChainId } from "./Chain";
2
2
  import { EvmNetworkId } from "./EvmNetwork";
3
- export declare type MultiChainId = SubChainId | EvmChainId;
4
- export declare type SubChainId = {
3
+ export type MultiChainId = SubChainId | EvmChainId;
4
+ export type SubChainId = {
5
5
  subChainId: ChainId;
6
6
  };
7
- export declare type EvmChainId = {
7
+ export type EvmChainId = {
8
8
  evmChainId: EvmNetworkId;
9
9
  };
@@ -1,4 +1,4 @@
1
- import { PluginTokenTypes } from "../plugins";
1
+ import { PluginTokenTypes } from "@talismn/chaindata-provider/plugins";
2
2
  import { ChainId } from "./Chain";
3
3
  import { EvmNetworkId } from "./EvmNetwork";
4
4
  /**
@@ -6,7 +6,7 @@ import { EvmNetworkId } from "./EvmNetwork";
6
6
  *
7
7
  * It is the same list, but with any invalid `TokenType` definitions filtered out.
8
8
  */
9
- export declare type TokenTypes = {
9
+ export type TokenTypes = {
10
10
  [TokenType in keyof PluginTokenTypes]: PluginTokenTypes[TokenType] extends IToken ? PluginTokenTypes[TokenType] : never;
11
11
  };
12
12
  /**
@@ -20,12 +20,12 @@ export declare type TokenTypes = {
20
20
  *
21
21
  * If `TokenTypes` is empty then `Token` will fall back to the common `IToken` interface, which every token must implement.
22
22
  */
23
- export declare type Token = TokenTypes[keyof TokenTypes] extends never ? IToken : TokenTypes[keyof TokenTypes];
23
+ export type Token = TokenTypes[keyof TokenTypes] extends never ? IToken : TokenTypes[keyof TokenTypes];
24
24
  /** A collection of `Token` objects */
25
- export declare type TokenList = Record<TokenId, Token>;
26
- export declare type TokenId = string;
25
+ export type TokenList = Record<TokenId, Token>;
26
+ export type TokenId = string;
27
27
  /** `IToken` is a common interface which all tokens must implement. */
28
- export declare type IToken = {
28
+ export type IToken = {
29
29
  id: TokenId;
30
30
  type: string;
31
31
  isTestnet: boolean;
@@ -41,6 +41,6 @@ export declare type IToken = {
41
41
  } | null;
42
42
  };
43
43
  /** Used by plugins to help define their custom `TokenType` */
44
- export declare type NewTokenType<ModuleType extends string, TokenParams extends Record<string, unknown>> = IToken & {
44
+ export type NewTokenType<ModuleType extends string, TokenParams extends Record<string, unknown>> = IToken & {
45
45
  type: ModuleType;
46
46
  } & TokenParams;
@@ -0,0 +1 @@
1
+ export * from "./declarations/src/index";
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const githubChaindataBranch = "v3";
6
+ const githubChaindataBaseUrl = `https://raw.githubusercontent.com/TalismanSociety/chaindata/${githubChaindataBranch}`;
7
+ const githubChainsUrl = `${githubChaindataBaseUrl}/chaindata.json`;
8
+ const githubTestnetChainsUrl = `${githubChaindataBaseUrl}/testnets-chaindata.json`;
9
+ const githubEvmNetworksUrl = `${githubChaindataBaseUrl}/evm-networks.json`;
10
+ const githubTokensUrl = `${githubChaindataBaseUrl}/tokens.json`;
11
+ const githubChainLogoUrl = chainId => `${githubChaindataBaseUrl}/assets/chains/${chainId}.svg`;
12
+ const githubEvmNetworkLogoUrl = networkId => `${githubChaindataBaseUrl}/assets/chains/${networkId}.svg`;
13
+ const githubTokenLogoUrl = tokenId => `${githubChaindataBaseUrl}/assets/tokens/${tokenId}.svg`;
14
+ const githubUnknownTokenLogoUrl = githubTokenLogoUrl("unknown");
15
+
16
+ exports.githubChainLogoUrl = githubChainLogoUrl;
17
+ exports.githubChaindataBaseUrl = githubChaindataBaseUrl;
18
+ exports.githubChaindataBranch = githubChaindataBranch;
19
+ exports.githubChainsUrl = githubChainsUrl;
20
+ exports.githubEvmNetworkLogoUrl = githubEvmNetworkLogoUrl;
21
+ exports.githubEvmNetworksUrl = githubEvmNetworksUrl;
22
+ exports.githubTestnetChainsUrl = githubTestnetChainsUrl;
23
+ exports.githubTokenLogoUrl = githubTokenLogoUrl;
24
+ exports.githubTokensUrl = githubTokensUrl;
25
+ exports.githubUnknownTokenLogoUrl = githubUnknownTokenLogoUrl;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./talismn-chaindata-provider.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./talismn-chaindata-provider.cjs.dev.js");
7
+ }
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const githubChaindataBranch = "v3";
6
+ const githubChaindataBaseUrl = `https://raw.githubusercontent.com/TalismanSociety/chaindata/${githubChaindataBranch}`;
7
+ const githubChainsUrl = `${githubChaindataBaseUrl}/chaindata.json`;
8
+ const githubTestnetChainsUrl = `${githubChaindataBaseUrl}/testnets-chaindata.json`;
9
+ const githubEvmNetworksUrl = `${githubChaindataBaseUrl}/evm-networks.json`;
10
+ const githubTokensUrl = `${githubChaindataBaseUrl}/tokens.json`;
11
+ const githubChainLogoUrl = chainId => `${githubChaindataBaseUrl}/assets/chains/${chainId}.svg`;
12
+ const githubEvmNetworkLogoUrl = networkId => `${githubChaindataBaseUrl}/assets/chains/${networkId}.svg`;
13
+ const githubTokenLogoUrl = tokenId => `${githubChaindataBaseUrl}/assets/tokens/${tokenId}.svg`;
14
+ const githubUnknownTokenLogoUrl = githubTokenLogoUrl("unknown");
15
+
16
+ exports.githubChainLogoUrl = githubChainLogoUrl;
17
+ exports.githubChaindataBaseUrl = githubChaindataBaseUrl;
18
+ exports.githubChaindataBranch = githubChaindataBranch;
19
+ exports.githubChainsUrl = githubChainsUrl;
20
+ exports.githubEvmNetworkLogoUrl = githubEvmNetworkLogoUrl;
21
+ exports.githubEvmNetworksUrl = githubEvmNetworksUrl;
22
+ exports.githubTestnetChainsUrl = githubTestnetChainsUrl;
23
+ exports.githubTokenLogoUrl = githubTokenLogoUrl;
24
+ exports.githubTokensUrl = githubTokensUrl;
25
+ exports.githubUnknownTokenLogoUrl = githubUnknownTokenLogoUrl;
@@ -0,0 +1,12 @@
1
+ const githubChaindataBranch = "v3";
2
+ const githubChaindataBaseUrl = `https://raw.githubusercontent.com/TalismanSociety/chaindata/${githubChaindataBranch}`;
3
+ const githubChainsUrl = `${githubChaindataBaseUrl}/chaindata.json`;
4
+ const githubTestnetChainsUrl = `${githubChaindataBaseUrl}/testnets-chaindata.json`;
5
+ const githubEvmNetworksUrl = `${githubChaindataBaseUrl}/evm-networks.json`;
6
+ const githubTokensUrl = `${githubChaindataBaseUrl}/tokens.json`;
7
+ const githubChainLogoUrl = chainId => `${githubChaindataBaseUrl}/assets/chains/${chainId}.svg`;
8
+ const githubEvmNetworkLogoUrl = networkId => `${githubChaindataBaseUrl}/assets/chains/${networkId}.svg`;
9
+ const githubTokenLogoUrl = tokenId => `${githubChaindataBaseUrl}/assets/tokens/${tokenId}.svg`;
10
+ const githubUnknownTokenLogoUrl = githubTokenLogoUrl("unknown");
11
+
12
+ export { githubChainLogoUrl, githubChaindataBaseUrl, githubChaindataBranch, githubChainsUrl, githubEvmNetworkLogoUrl, githubEvmNetworksUrl, githubTestnetChainsUrl, githubTokenLogoUrl, githubTokensUrl, githubUnknownTokenLogoUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@talismn/chaindata-provider",
3
- "version": "0.2.0",
3
+ "version": "0.4.1",
4
4
  "author": "Talisman",
5
5
  "homepage": "https://talisman.xyz",
6
6
  "license": "UNLICENSED",
@@ -12,8 +12,8 @@
12
12
  "type": "git",
13
13
  "url": "https://github.com/talismansociety/talisman.git"
14
14
  },
15
- "main": "dist/index.js",
16
- "types": "dist/index.d.ts",
15
+ "main": "dist/talismn-chaindata-provider.cjs.js",
16
+ "module": "dist/talismn-chaindata-provider.esm.js",
17
17
  "files": [
18
18
  "/dist",
19
19
  "/plugins"
@@ -22,27 +22,29 @@
22
22
  "node": ">=14"
23
23
  },
24
24
  "scripts": {
25
- "dev": "tsc --watch --declarationMap",
26
- "build": "tsc --declarationMap",
27
- "build:packages:prod": "rm -rf dist && tsc",
28
- "prepack": "yarn build:packages:prod",
29
25
  "test": "jest",
30
26
  "lint": "eslint . --max-warnings 0",
31
27
  "clean": "rm -rf dist && rm -rf .turbo rm -rf node_modules"
32
28
  },
33
29
  "devDependencies": {
34
- "@talismn/eslint-config": "^0.0.0",
35
- "@talismn/tsconfig": "^0.0.1",
30
+ "@talismn/eslint-config": "^0.0.1",
31
+ "@talismn/tsconfig": "^0.0.2",
36
32
  "@types/jest": "^27.5.1",
37
33
  "eslint": "^8.4.0",
38
34
  "jest": "^28.1.0",
39
35
  "ts-jest": "^28.0.2",
40
36
  "typescript": "^4.6.4"
41
37
  },
38
+ "preconstruct": {
39
+ "entrypoints": [
40
+ "index.ts",
41
+ "plugins.ts"
42
+ ]
43
+ },
42
44
  "eslintConfig": {
43
45
  "root": true,
44
46
  "extends": [
45
- "@talismn/eslint-config"
47
+ "@talismn/eslint-config/base"
46
48
  ]
47
49
  }
48
50
  }
@@ -0,0 +1 @@
1
+ export * from "../../dist/declarations/src/plugins";
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./talismn-chaindata-provider-plugins.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./talismn-chaindata-provider-plugins.cjs.dev.js");
7
+ }
@@ -1,5 +1,4 @@
1
1
  {
2
- "internal": true,
3
- "main": "../dist/plugins.js",
4
- "types": "../dist/plugins.d.ts"
2
+ "main": "dist/talismn-chaindata-provider-plugins.cjs.js",
3
+ "module": "dist/talismn-chaindata-provider-plugins.esm.js"
5
4
  }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/github.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.githubUnknownTokenLogoUrl = exports.githubTokenLogoUrl = exports.githubEvmNetworkLogoUrl = exports.githubChainLogoUrl = exports.githubTokensUrl = exports.githubEvmNetworksUrl = exports.githubTestnetChainsUrl = exports.githubChainsUrl = exports.githubChaindataBaseUrl = exports.githubChaindataBranch = void 0;
4
- exports.githubChaindataBranch = "v3";
5
- exports.githubChaindataBaseUrl = `https://raw.githubusercontent.com/TalismanSociety/chaindata/${exports.githubChaindataBranch}`;
6
- exports.githubChainsUrl = `${exports.githubChaindataBaseUrl}/chaindata.json`;
7
- exports.githubTestnetChainsUrl = `${exports.githubChaindataBaseUrl}/testnets-chaindata.json`;
8
- exports.githubEvmNetworksUrl = `${exports.githubChaindataBaseUrl}/evm-networks.json`;
9
- exports.githubTokensUrl = `${exports.githubChaindataBaseUrl}/tokens.json`;
10
- const githubChainLogoUrl = (chainId) => `${exports.githubChaindataBaseUrl}/assets/chains/${chainId}.svg`;
11
- exports.githubChainLogoUrl = githubChainLogoUrl;
12
- const githubEvmNetworkLogoUrl = (networkId) => `${exports.githubChaindataBaseUrl}/assets/chains/${networkId}.svg`;
13
- exports.githubEvmNetworkLogoUrl = githubEvmNetworkLogoUrl;
14
- const githubTokenLogoUrl = (tokenId) => `${exports.githubChaindataBaseUrl}/assets/tokens/${tokenId}.svg`;
15
- exports.githubTokenLogoUrl = githubTokenLogoUrl;
16
- exports.githubUnknownTokenLogoUrl = (0, exports.githubTokenLogoUrl)("unknown");
package/dist/index.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./ChaindataProvider"), exports);
18
- __exportStar(require("./types"), exports);
19
- __exportStar(require("./github"), exports);
package/dist/plugins.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,31 +0,0 @@
1
- "use strict";
2
- //
3
- // NOTE: Do not export `./plugins` from here!
4
- // Doing so will introduce a circular dependency!
5
- // It is a separate entrypoint meant to be used like this:
6
- //
7
- // import { PluginTokenTypes } from '@talismn/chaindata-provider/plugins'
8
- //
9
- // Not this:
10
- //
11
- // import { PluginTokenTypes } from '@talismn/chaindata-provider'
12
- //
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
25
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- __exportStar(require("./Chain"), exports);
29
- __exportStar(require("./EvmNetwork"), exports);
30
- __exportStar(require("./MultiChain"), exports);
31
- __exportStar(require("./Token"), exports);