@paraspell/sdk 0.0.16 → 0.0.18

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/README.md CHANGED
@@ -84,28 +84,31 @@ paraspell.openChannels.openChannel(api: ApiPromise, origin: origin Parachain I
84
84
  //Asset pallet
85
85
 
86
86
  //Returns assets object from assets.json for particular node including information about native and foreign assets
87
- paraspell.getAssetsObject(node: TNode)
87
+ paraspell.assets.getAssetsObject(node: TNode)
88
88
 
89
89
  //Returns foreign assetId for particular node and asset symbol
90
- paraspell.getAssetId(node: TNode, symbol: string)
90
+ paraspell.assets.getAssetId(node: TNode, symbol: string)
91
91
 
92
92
  //Returns symbol of the relay chain for particular node. Either "DOT" or "KSM"
93
- paraspell.getRelayChainSymbol(node: TNode)
93
+ paraspell.assets.getRelayChainSymbol(node: TNode)
94
94
 
95
95
  //Returns string array of native assets symbols for particular node
96
- paraspell.getNativeAssets(node: TNode)
96
+ paraspell.assets.getNativeAssets(node: TNode)
97
97
 
98
98
  //Returns object array of foreign assets for particular node. Each object has symbol and assetId property
99
- paraspell.getOtherAssets(node: TNode)
99
+ paraspell.assets.getOtherAssets(node: TNode)
100
100
 
101
101
  //Returns string array of all assets symbols. (native and foreign assets are merged to a single array)
102
- paraspell.getAllAssetsSymbols(node: TNode)
102
+ paraspell.assets.getAllAssetsSymbols(node: TNode)
103
103
 
104
104
  //Checks if node supports particular asset. (Both native and foreign assets are searched). Returns boolean
105
- paraspell.hasSupportForAsset(node: TNode, symbol: string)
105
+ paraspell.assets.hasSupportForAsset(node: TNode, symbol: string)
106
+
107
+ //Import all compatible nodes as constant:
108
+ paraspell.NODE_NAMES
106
109
  ```
107
110
 
108
- ##### Example of usage can be found in the UI repository [here](https://github.com/paraspell/ui)
111
+ ##### Example of usage can be found in the UI repository [here](https://github.com/paraspell/ui) or in the Astarot repository [here](https://github.com/paraspell/astarot)
109
112
  ##### List of currently compatible nodes can be found [here](https://github.com/paraspell/sdk/blob/beta-pre-release/docs/supportedNodes.md)
110
113
 
111
114
 
package/dist/index.cjs CHANGED
@@ -51,6 +51,53 @@ const nodeToPallet = {
51
51
  Turing: "xTokens"
52
52
  };
53
53
 
54
+ const NODE_NAMES = [
55
+ "Statemint",
56
+ "Acala",
57
+ "Astar",
58
+ "BifrostPolkadot",
59
+ "Bitgreen",
60
+ "Centrifuge",
61
+ "Clover",
62
+ "ComposableFinance",
63
+ "Darwinia",
64
+ "HydraDX",
65
+ "Interlay",
66
+ "Kylin",
67
+ "Litentry",
68
+ "Moonbeam",
69
+ "Parallel",
70
+ "Statemine",
71
+ "Encointer",
72
+ "Altair",
73
+ "Amplitude",
74
+ "Bajun",
75
+ "Basilisk",
76
+ "BifrostKusama",
77
+ "Pioneer",
78
+ "Calamari",
79
+ "CrustShadow",
80
+ "Crab",
81
+ "Dorafactory",
82
+ "Imbue",
83
+ "Integritee",
84
+ "InvArchTinker",
85
+ "Karura",
86
+ "Kico",
87
+ "Kintsugi",
88
+ "Listen",
89
+ "Litmus",
90
+ "Mangata",
91
+ "Moonriver",
92
+ "ParallelHeiko",
93
+ "Picasso",
94
+ "Pichiu",
95
+ "Quartz",
96
+ "Robonomics",
97
+ "Shiden",
98
+ "Turing"
99
+ ];
100
+
54
101
  function createAccID(api, account) {
55
102
  console.log("Generating AccountId32 address");
56
103
  return api.createType("AccountId32", account).toHex();
@@ -2753,7 +2800,7 @@ function getNativeAssets(node) {
2753
2800
  return [];
2754
2801
  }
2755
2802
  const info = getAssetsInfo(node).nativeAssets;
2756
- return info ? info : [];
2803
+ return info || [];
2757
2804
  }
2758
2805
  function getOtherAssets(node) {
2759
2806
  if (!hasAssetsInfo(node)) {
@@ -2909,6 +2956,7 @@ const index = {
2909
2956
  closeChannel: closeChannel
2910
2957
  };
2911
2958
 
2959
+ exports.NODE_NAMES = NODE_NAMES;
2912
2960
  exports.assets = index$3;
2913
2961
  exports.closeChannels = index;
2914
2962
  exports.openChannels = index$1;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,18 @@
1
1
  import { ApiPromise } from '@polkadot/api';
2
2
  import { SubmittableExtrinsic } from '@polkadot/api/types';
3
3
 
4
- declare const nodeNames: readonly ["Statemint", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Kylin", "Litentry", "Moonbeam", "Parallel", "Statemine", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Dorafactory", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kico", "Kintsugi", "Listen", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Pichiu", "Quartz", "Robonomics", "Shiden", "Turing"];
4
+ declare const NODE_NAMES: readonly ["Statemint", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Kylin", "Litentry", "Moonbeam", "Parallel", "Statemine", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Dorafactory", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kico", "Kintsugi", "Listen", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Pichiu", "Quartz", "Robonomics", "Shiden", "Turing"];
5
5
 
6
+ type UpdateFunction = (name: string, index: number) => string;
6
7
  type Extrinsic = SubmittableExtrinsic<'promise'>;
7
- type TNode = typeof nodeNames[number];
8
+ type ExtrinsicFunction<T> = (arg: T) => Extrinsic;
9
+ type TPalletType = 'xTokens' | 'polkadotXCM' | 'ormlXTokens' | 'relayerXcm';
10
+ type TRelayChainType = 'polkadot' | 'kusama';
11
+ type TNodeDetails = {
12
+ name: string;
13
+ type: TRelayChainType;
14
+ };
15
+ type TNode = typeof NODE_NAMES[number];
8
16
  type TAssetDetails = {
9
17
  assetId: string;
10
18
  symbol: string;
@@ -14,6 +22,8 @@ type TNodeAssets = {
14
22
  nativeAssets: string[];
15
23
  otherAssets: TAssetDetails[];
16
24
  };
25
+ type TAssetJsonMap = Record<TNode, TNodeAssets>;
26
+ type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
17
27
 
18
28
  declare function send(api: ApiPromise, origin: TNode, currency: string, currencyID: number, amount: any, to: string, destination?: number): Extrinsic;
19
29
  declare function transferRelayToPara(api: ApiPromise, destination: number, amount: any, to: string): Extrinsic | never;
@@ -72,4 +82,4 @@ declare namespace index {
72
82
  };
73
83
  }
74
84
 
75
- export { index as assets, index$1 as closeChannels, index$2 as openChannels, index$3 as xcmPallet };
85
+ export { Extrinsic, ExtrinsicFunction, NODE_NAMES, TAssetDetails, TAssetJsonMap, TNode, TNodeAssets, TNodeDetails, TPalletType, TRelayChainType, TScenario, UpdateFunction, index as assets, index$1 as closeChannels, index$2 as openChannels, index$3 as xcmPallet };
package/dist/index.mjs CHANGED
@@ -49,6 +49,53 @@ const nodeToPallet = {
49
49
  Turing: "xTokens"
50
50
  };
51
51
 
52
+ const NODE_NAMES = [
53
+ "Statemint",
54
+ "Acala",
55
+ "Astar",
56
+ "BifrostPolkadot",
57
+ "Bitgreen",
58
+ "Centrifuge",
59
+ "Clover",
60
+ "ComposableFinance",
61
+ "Darwinia",
62
+ "HydraDX",
63
+ "Interlay",
64
+ "Kylin",
65
+ "Litentry",
66
+ "Moonbeam",
67
+ "Parallel",
68
+ "Statemine",
69
+ "Encointer",
70
+ "Altair",
71
+ "Amplitude",
72
+ "Bajun",
73
+ "Basilisk",
74
+ "BifrostKusama",
75
+ "Pioneer",
76
+ "Calamari",
77
+ "CrustShadow",
78
+ "Crab",
79
+ "Dorafactory",
80
+ "Imbue",
81
+ "Integritee",
82
+ "InvArchTinker",
83
+ "Karura",
84
+ "Kico",
85
+ "Kintsugi",
86
+ "Listen",
87
+ "Litmus",
88
+ "Mangata",
89
+ "Moonriver",
90
+ "ParallelHeiko",
91
+ "Picasso",
92
+ "Pichiu",
93
+ "Quartz",
94
+ "Robonomics",
95
+ "Shiden",
96
+ "Turing"
97
+ ];
98
+
52
99
  function createAccID(api, account) {
53
100
  console.log("Generating AccountId32 address");
54
101
  return api.createType("AccountId32", account).toHex();
@@ -2751,7 +2798,7 @@ function getNativeAssets(node) {
2751
2798
  return [];
2752
2799
  }
2753
2800
  const info = getAssetsInfo(node).nativeAssets;
2754
- return info ? info : [];
2801
+ return info || [];
2755
2802
  }
2756
2803
  function getOtherAssets(node) {
2757
2804
  if (!hasAssetsInfo(node)) {
@@ -2907,4 +2954,4 @@ const index = {
2907
2954
  closeChannel: closeChannel
2908
2955
  };
2909
2956
 
2910
- export { index$3 as assets, index as closeChannels, index$1 as openChannels, index$2 as xcmPallet };
2957
+ export { NODE_NAMES, index$3 as assets, index as closeChannels, index$1 as openChannels, index$2 as xcmPallet };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paraspell/sdk",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "SDK for ParaSpell XCM/XCMP tool for developers",
5
5
  "repository": "@paraspell/sdk",
6
6
  "license": "MIT",