suidouble 0.0.19 → 0.0.21

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
@@ -18,7 +18,12 @@ Set of provider, package and object classes for javascript representation of Sui
18
18
  - [Connecting web3 dapps to Sui](#sui-move-connect-in-browser)
19
19
  - [Todo](#todo)
20
20
 
21
- Also take a look at sample Vue dapp application [source code](https://github.com/suidouble/suidouble-sample-app) or [check it online](https://suidouble-sample-app.herokuapp.com/).
21
+ ### Sample applications
22
+
23
+ | Name | Stack | Online | Github |
24
+ |----------|---------------|---------|--------|
25
+ | suidouble-sample-app | Vue + suidouble | [suidouble-sample-app](https://suidouble-sample-app.herokuapp.com/) | [source code](https://github.com/suidouble/suidouble-sample-app) |
26
+ | suidouble-color | Vue + suidouble | [suidouble-color](https://suidouble-color.herokuapp.com/) | [source code](https://github.com/suidouble/suidouble-sample-color) |
22
27
 
23
28
  ### installation
24
29
 
@@ -5,13 +5,15 @@ const icons = require('./data/icons.json');
5
5
  const { JsonRpcProvider } = require('@mysten/sui.js');
6
6
  const SuiMaster = require('./SuiMaster.js');
7
7
 
8
+ const DEFAULT_CHAIN = 'sui:devnet';
9
+
8
10
  class SuiInBrowser extends SuiCommonMethods {
9
11
  constructor(params = {}) {
10
12
  super(params);
11
13
 
12
14
  this._adapters = {};
13
15
 
14
- this._defaultChain = params.defaultChain || 'sui:devnet';
16
+ this._defaultChain = params.defaultChain || DEFAULT_CHAIN;
15
17
 
16
18
  this._activeAdapter = null;
17
19
  this._connectedAddress = null;
@@ -65,14 +67,16 @@ class SuiInBrowser extends SuiCommonMethods {
65
67
  return this._connectedChain;
66
68
  }
67
69
 
68
- static _singleInstance = null;
70
+ static _singleInstances = {};
69
71
  static getSingleton(params = {}) {
70
- if (SuiInBrowser._singleInstance) {
71
- return SuiInBrowser._singleInstance;
72
+ let defaultChainKey = params.defaultChain || DEFAULT_CHAIN;
73
+
74
+ if (SuiInBrowser._singleInstances[defaultChainKey]) {
75
+ return SuiInBrowser._singleInstances[defaultChainKey];
72
76
  }
73
77
 
74
- SuiInBrowser._singleInstance = new SuiInBrowser(params);
75
- return SuiInBrowser._singleInstance;
78
+ SuiInBrowser._singleInstances[defaultChainKey] = new SuiInBrowser(params);
79
+ return SuiInBrowser._singleInstances[defaultChainKey];
76
80
  }
77
81
 
78
82
  get adapters() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suidouble",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "description": "Set of provider, package and object classes for javascript representation of Sui Move smart contracts. Use same code for publishing, upgrading, integration testing, interaction with smart contracts and integration in browser web3 dapps",
5
5
  "main": "index.js",
6
6
  "scripts": {