suidouble 0.0.20 → 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/lib/SuiInBrowser.js +10 -6
- package/package.json +1 -1
package/lib/SuiInBrowser.js
CHANGED
|
@@ -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 ||
|
|
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
|
|
70
|
+
static _singleInstances = {};
|
|
69
71
|
static getSingleton(params = {}) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
let defaultChainKey = params.defaultChain || DEFAULT_CHAIN;
|
|
73
|
+
|
|
74
|
+
if (SuiInBrowser._singleInstances[defaultChainKey]) {
|
|
75
|
+
return SuiInBrowser._singleInstances[defaultChainKey];
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
SuiInBrowser.
|
|
75
|
-
return SuiInBrowser.
|
|
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.
|
|
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": {
|