suidouble 1.13.0 → 1.14.2

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
@@ -43,7 +43,7 @@ npm install suidouble --save
43
43
  Main class to interact with blockchain is SuiMaster:
44
44
 
45
45
  ```javascript
46
- const { SuiMaster } = require('suidouble');
46
+ import { SuiMaster } from 'suidouble';
47
47
  ```
48
48
 
49
49
  You can initialize it directly, if you have keypair, secret phrase, or privateKey and can use it in code (so on node.js side - server side or CLI apps):
@@ -85,7 +85,7 @@ const suiMasterAsUser = new SuiMaster({ as: 'user', client: 'dev', });
85
85
 
86
86
  On browser side, you'd probably want to use Sui wallets extensions adapters to sign message and don't store any keypairs or secret phrases in your code. So there's SuiInBrowser class for this, which can setup suiMaster instance for you. See 'Sui Move Connect in browser' section or sample UI application's code for more details.
87
87
  ```javascript
88
- const { SuiInBrowser } = require('suidouble');
88
+ import { SuiInBrowser } from 'suidouble';
89
89
  const suiInBrowser = SuiInBrowser.getSingleton(); // you probably don't want to keep few connections, so there's singleton
90
90
  /// ...
91
91
  suiInBrowser.addEventListener('connected', async()=>{
@@ -175,32 +175,6 @@ while (events.hasNextPage) {
175
175
 
176
176
  *** Subscribe to Events is deprecated in Sui SDK *** You should plan to use different architecture in your application.
177
177
 
178
- You can subscribe to Sui's contract events on package's module level.
179
-
180
- ```javascript
181
- const module = await contract.getModule('suidouble_chat');
182
- await module.subscribeEvents();
183
- module.addEventListener('ChatResponseCreated', (suiEvent)=>{
184
- // received message emited by
185
- // emit(ChatResponseCreated { id: object::uid_to_inner(&chat_response_id), top_message_id: object::uid_to_inner(&id), seq_n: 0 });
186
- // in suidouble_chat 's smart contract
187
- console.log(suiEvent.typeName); // == 'ChatResponseCreated'
188
- console.log(suiEvent.parsedJson);
189
- });
190
- module.addEventListener('ChatTopMessageCreated', (suiEvent)=>{
191
- // received message emited by
192
- // emit(ChatTopMessageCreated { id: object::uid_to_inner(&id), top_response_id: object::uid_to_inner(&chat_response_id), });
193
- // in suidouble_chat 's smart contract
194
- console.log(suiEvent.typeName); // == 'ChatTopMessageCreated'
195
- console.log(suiEvent.parsedJson);
196
- });
197
- ```
198
-
199
- Don't forget to unsubscribe from events when you don't need them anymore:
200
-
201
- ```javascript
202
- await module.unsubscribeEvents();
203
- ```
204
178
 
205
179
  ##### executing smart contract method
206
180
 
@@ -302,7 +276,7 @@ Don't forget to test transactions sending real money on devnet/testnet first!
302
276
  If you need more flexebility, there's always an option to construct the transaction yourself:
303
277
 
304
278
  ```javascript
305
- const { Transaction, txInput } = require('suidobule'); // this exposes classes from the "@mysten/sui.js", so you don't have to import them separately
279
+ import { Transaction, txInput } from 'suidouble';
306
280
 
307
281
  const tx = new Transaction();
308
282
  tx.moveCall({
@@ -348,7 +322,8 @@ await paginatedResponse.forEach(async(suiObject)=>{
348
322
  Builds a package and publish it to blockchain. CLI thing, as it needs `execSync` to run `sui move build`. Tested on Ubuntu, works good. If you have some issues with other platforms - please feel free to let me know or post Pull Request.
349
323
 
350
324
  ```javascript
351
- const { SuiMaster } = require('suidouble');
325
+ import { SuiMaster } from 'suidouble';
326
+
352
327
 
353
328
  const client = 'dev';
354
329
  const suiMaster = new SuiMaster({ debug: true, as: 'admin', client: client, });
@@ -369,7 +344,7 @@ console.log('published as', package.address);
369
344
  Same, it's for CLI as it re-builds the package.
370
345
 
371
346
  ```javascript
372
- const { SuiMaster } = require('suidouble');
347
+ import { SuiMaster } from 'suidouble';
373
348
 
374
349
  const client = 'local';// or await SuiLocalTestValidator.launch({debug: true, epochDuration: 30000});
375
350
 
@@ -394,7 +369,7 @@ CLI integration tests, it runs local testing node (has to be installed), build a
394
369
  suidouble try to mimic Sui Move's testing framework:
395
370
 
396
371
  ```javascript
397
- const SuiTestScenario = require('./lib/SuiTestScenario.js');
372
+ import { SuiTestScenario } from 'suidouble';
398
373
 
399
374
  const testScenario = new SuiTestScenario({
400
375
  path: '../path_to_move_project_root/',
@@ -432,7 +407,7 @@ Check out [suidouble Vue component](https://www.npmjs.com/package/vue-sui) to co
432
407
  Or write the one manually, code is framework independed:
433
408
 
434
409
  ```javascript
435
- const { SuiInBrowser } = require('suidouble');
410
+ import { SuiInBrowser } from 'suidouble';
436
411
 
437
412
  const suiInBrowser = SuiInBrowser.getSingleton();
438
413
  const suiMaster = await suiInBrowser.getSuiMaster(); // not yet connected, works in read-only mode (no signing-posting txs).
package/index.js CHANGED
@@ -1,22 +1,25 @@
1
- const SuiMaster = require('./lib/SuiMaster.js');
2
- const SuiInBrowser = require('./lib/SuiInBrowser.js');
3
- const SuiTestScenario = require('./lib/SuiTestScenario.js');
4
- const SuiObject = require('./lib/SuiObject.js');
5
- const SuiUtils = require('./lib/SuiUtils.js');
6
- const SuiLocalTestValidator = require('./lib/SuiLocalTestValidator.js');
7
- const { Transaction, Commands } = require('@mysten/sui/transactions');
8
- const { bcs } = require('@mysten/sui/bcs');
1
+ import SuiMaster from './lib/SuiMaster.js';
2
+ import SuiInBrowser from './lib/SuiInBrowser.js';
3
+ import SuiTestScenario from './lib/SuiTestScenario.js';
4
+ import SuiObject from './lib/SuiObject.js';
5
+ import SuiUtils from './lib/SuiUtils.js';
6
+ import SuiLocalTestValidator from './lib/SuiLocalTestValidator.js';
7
+ import { Transaction, Commands } from '@mysten/sui/transactions';
8
+ import { bcs } from '@mysten/sui/bcs';
9
9
 
10
- module.exports = {
10
+ const txInput = SuiUtils.txInput;
11
+ const MIST_PER_SUI = SuiMaster.MIST_PER_SUI;
12
+
13
+ export {
11
14
  SuiMaster,
12
15
  SuiObject,
13
16
  SuiInBrowser,
14
17
  SuiTestScenario,
15
18
  SuiLocalTestValidator,
16
- MIST_PER_SUI: SuiMaster.MIST_PER_SUI,
17
- Transaction: Transaction,
18
- Commands: Commands,
19
- SuiUtils: SuiUtils,
20
- txInput: SuiUtils.txInput,
19
+ MIST_PER_SUI,
20
+ Transaction,
21
+ Commands,
22
+ SuiUtils,
23
+ txInput,
21
24
  bcs,
22
25
  };
@@ -1,23 +1,80 @@
1
- let doExecSync = null;
2
- let doSpawn = null;
3
- let doFs = null;
4
- let doPath = null;
5
- try {
6
- let { execSync, spawn } = require('child_process');
7
- doExecSync = execSync;
8
- doSpawn = spawn;
9
-
10
- const fs = require('fs');
11
- const path = require('path');
12
-
13
- doFs = fs;
14
- doPath = path;
15
- } catch (e) {
16
- console.log('looks we are in browser');
1
+ class ImportError extends Error {}
2
+
3
+ const loadModule = async (modulePath) => {
4
+ try {
5
+ return await import(modulePath)
6
+ } catch (e) {
7
+ throw new ImportError(`Unable to import module ${modulePath}`)
8
+ }
17
9
  }
18
10
 
19
- class SuiCliCommands {
11
+ /**
12
+ * Wrapper to get system function available on node.js side only, returning null on the browser side
13
+ * @param {string} name - execSync, spawn, fs, path, net
14
+ * @returns {(function | null)}
15
+ */
16
+ const getSystemFunction = async (name) => {
17
+ try {
18
+ if (name == 'execSync' || name == 'spawn') {
19
+ const { default: myDefault } = await loadModule('child_process');
20
+ return myDefault[name];
21
+ }
22
+ if (name == 'fs') {
23
+ const { default: myDefault } = await loadModule('fs');
24
+ return myDefault;
25
+ }
26
+ if (name == 'path') {
27
+ const { default: myDefault } = await loadModule('path');
28
+ return myDefault;
29
+ }
30
+ if (name == 'net') {
31
+ const { default: myDefault } = await loadModule('net');
32
+ return myDefault;
33
+ }
34
+ } catch (e) {
35
+ return null;
36
+ }
37
+ }
38
+
39
+ export default class SuiCliCommands {
40
+ static async isPortThere(port) {
41
+ const net = await getSystemFunction('net');
42
+ if (!net) {
43
+ return false;
44
+ }
45
+
46
+ const Socket = net.Socket;
47
+ const socket = new Socket();
48
+
49
+ let __waitPortPromiseResolver = null;
50
+ const __waitPortPromise = new Promise((res)=>{ __waitPortPromiseResolver = res; });
51
+
52
+ setTimeout(()=>{
53
+ socket.destroy();
54
+ __waitPortPromiseResolver(false);
55
+ }, 3000);
56
+ socket.on("connect", () => {
57
+ __waitPortPromiseResolver(true);
58
+ });
59
+ socket.on("error", () =>
60
+ {
61
+ __waitPortPromiseResolver(false);
62
+ });
63
+ socket.on("timeout", () => {
64
+ __waitPortPromiseResolver(false);
65
+ });
66
+
67
+ socket.connect(port, "0.0.0.0");
68
+
69
+ const portIsThere = await __waitPortPromise;
70
+ socket.destroy();
71
+
72
+ return portIsThere;
73
+ }
74
+
20
75
  static async spawn(command, params = [], envVars = {}) {
76
+ const doSpawn = await getSystemFunction('spawn');
77
+
21
78
  if (!doSpawn) {
22
79
  throw new Error('can not spawn a proccess in this env');
23
80
  }
@@ -59,6 +116,8 @@ class SuiCliCommands {
59
116
  }
60
117
 
61
118
  static async exec(command) {
119
+ const doExecSync = await getSystemFunction('execSync');
120
+
62
121
  if (!doExecSync) {
63
122
  throw new Error('can not exec a proccess in this env');
64
123
  }
@@ -70,6 +129,9 @@ class SuiCliCommands {
70
129
  }
71
130
 
72
131
  static async getModulesNamesFromPackagePath(path) {
132
+ const doPath = await getSystemFunction('path');
133
+ const doFs = await getSystemFunction('fs');
134
+
73
135
  if (!doPath || !doFs) {
74
136
  throw new Error('can not access path in this env');
75
137
  }
@@ -90,6 +152,4 @@ class SuiCliCommands {
90
152
  throw new Error('can not get modules names from local package path');
91
153
  }
92
154
  }
93
- }
94
-
95
- module.exports = SuiCliCommands;
155
+ };
package/lib/SuiCoin.js CHANGED
@@ -1,31 +1,23 @@
1
- const { Commands, Transaction, TransactionObjectArgument } = require('@mysten/sui/transactions');
2
- const { bcs } = require('@mysten/sui/bcs');
3
-
4
-
5
- const safeList = {
6
- 'sui:mainnet': {
7
- '0xa198f3be41cda8c07b3bf3fee02263526e535d682499806979a111e88a5a8d0f::coin::COIN': 'CELO',
8
- '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN': 'tBTC',
9
- '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN': 'USDCeth',
10
- '0xe32d3ebafa42e6011b87ef1087bbc6053b499bf6f095807b9013aff5a6ecd7bb::coin::COIN': 'USDCarb',
11
- '0x909cba62ce96d54de25bec9502de5ca7b4f28901747bbf96b76c2e63ec5f1cba::coin::COIN': 'USDCbnb',
12
- '0xcf72ec52c0f8ddead746252481fb44ff6e8485a39b803825bde6b00d77cdb0bb::coin::COIN': 'USDCpol',
13
- '0xb231fcda8bbddb31f2ef02e6161444aec64a514e2c89279584ac9806ce9cf037::coin::COIN': 'USDCsol',
14
- '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN': 'USDT',
15
- '0x1e8b532cca6569cab9f9b9ebc73f8c13885012ade714729aa3b450e0339ac766::coin::COIN': 'WAVAX',
16
- '0xb848cce11ef3a8f62eccea6eb5b35a12c4c2b1ee1af7755d02d7bd6218e8226f::coin::COIN': 'WBNB',
17
- '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN': 'WBTC',
18
- '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN': 'WETH',
19
- '0x6081300950a4f1e2081580e919c210436a1bed49080502834950d31ee55a2396::coin::COIN': 'WFTM',
20
- '0x66f87084e49c38f76502d17f87d17f943f183bb94117561eb573e075fdc5ff75::coin::COIN': 'WGLMR',
21
- '0xdbe380b13a6d0f5cdedd58de8f04625263f113b3f9db32b3e1983f49e2841676::coin::COIN': 'WMATIC',
22
- '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8::coin::COIN': 'WSOL',
23
- '0x2::sui::SUI': 'SUI',
24
- },
25
- };
1
+ import { Commands, Transaction } from '@mysten/sui/transactions';
2
+
3
+ /**
4
+ * @typedef {import("@mysten/sui/transactions").TransactionObjectArgument} TransactionObjectArgument
5
+ *
6
+ *
7
+ * @typedef CoinMeta
8
+ * @type {object}
9
+ * @property {number} decimals - Number of decimal places the coin uses.
10
+ * @property {string} description - Description of the token
11
+ * @property {string} iconUrl - URL for the token logo
12
+ * @property {string} name - Name for the token
13
+ * @property {string} symbol - Symbol for the token
14
+ * @property {string} [id] - Meta id
15
+ * @property {string} [type] - Coin type string
16
+ */
17
+
26
18
 
27
19
  /** Coin metadata object */
28
- class SuiCoin {
20
+ export default class SuiCoin {
29
21
 
30
22
  /**
31
23
  * SuiCoin constructor
@@ -97,10 +89,6 @@ class SuiCoin {
97
89
  return this._suiCoins.suiMaster;
98
90
  }
99
91
 
100
- static safeList(connectedChain) {
101
- return safeList[connectedChain];
102
- }
103
-
104
92
  get coinType() {
105
93
  if (this._coinType.indexOf('0x') === 0) {
106
94
  return this._coinType;
@@ -129,29 +117,7 @@ class SuiCoin {
129
117
  return this._metadata;
130
118
  }
131
119
 
132
- get safeList() {
133
- if (this.suiMaster && this.suiMaster.connectedChain) {
134
- if (safeList[this.suiMaster.connectedChain]) {
135
- return safeList[this.suiMaster.connectedChain];
136
- }
137
- }
138
-
139
- return {};
140
- }
141
-
142
- get isSafe() {
143
- if (this.safeList[this.coinType]) {
144
- return true;
145
- }
146
-
147
- return false;
148
- }
149
-
150
120
  get symbol() {
151
- if (this.safeList[this.coinType]) {
152
- return this.safeList[this.coinType];
153
- }
154
-
155
121
  if (this.metadata) {
156
122
  return this.metadata.symbol;
157
123
  }
@@ -165,9 +131,24 @@ class SuiCoin {
165
131
 
166
132
  isSUI() {
167
133
  const lc = this._coinType.toLowerCase();
168
- if (lc == 'sui' || lc.indexOf(':sui:') !== -1) {
134
+ if (lc == '0x0000000000000000000000000000000000000000000000000000000000000002::sui::sui') { // as it's normalized
135
+ return true;
136
+ }
137
+ return false;
138
+ }
139
+
140
+ /**
141
+ * set predefined coin metadata so it will not be fetched from RPC
142
+ * @param {CoinMeta} meta
143
+ * @returns {boolean} if processed ok
144
+ */
145
+ setMetadata(meta) {
146
+ if (meta && meta.decimals && meta.decimals > 0 && meta.name && meta.symbol) {
147
+ this._metadata = meta;
148
+ this._exists = true;
169
149
  return true;
170
150
  }
151
+
171
152
  return false;
172
153
  }
173
154
 
@@ -189,6 +170,7 @@ class SuiCoin {
189
170
  this._exists = false;
190
171
  } else {
191
172
  this._metadata = result;
173
+ this._exists = true;
192
174
  }
193
175
 
194
176
  return this._metadata;
@@ -218,6 +200,7 @@ class SuiCoin {
218
200
  return totalAmount;
219
201
  }
220
202
 
203
+
221
204
  /**
222
205
  * Returns TransactionObjectArgument with Coin of amount to be used in tranasctions
223
206
  *
@@ -300,6 +283,4 @@ class SuiCoin {
300
283
 
301
284
  return null;
302
285
  }
303
- }
304
-
305
- module.exports = SuiCoin;
286
+ };
package/lib/SuiCoins.js CHANGED
@@ -1,17 +1,42 @@
1
- const SuiCoin = require('./SuiCoin.js');
2
- const SuiCommonMethods = require('./SuiCommonMethods.js');
1
+ import SuiCoin from './SuiCoin.js';
2
+ import SuiCommonMethods from './SuiCommonMethods.js';
3
+ import { allCoinMetas } from '@polymedia/coinmeta';
4
+ import { normalizeStructTag } from "@mysten/sui/utils";
5
+
6
+ /**
7
+ * @typedef {import("./SuiCoin.js").CoinMeta} CoinMeta
8
+ * @typedef {import("./SuiMaster.js").default} SuiMaster
9
+ */
10
+
11
+ /**
12
+ * Common class to work with Coins and Coin objects. Expected to have single instance per SuiMaster instance
13
+ * @class
14
+ * @constructor
15
+ * @public
16
+ */
17
+ export default class SuiCoins extends SuiCommonMethods {
3
18
 
4
- class SuiCoins extends SuiCommonMethods {
19
+ /**
20
+ * SuiCoins constructor
21
+ * @param {Object} params - Initialization parameters
22
+ * @param {SuiMaster} params.suiMaster - instance of SuiMaster
23
+ */
5
24
  constructor(params = {}) {
6
25
  super(params);
7
26
 
27
+ /** @type {SuiMaster} */
8
28
  this._suiMaster = params.suiMaster;
9
29
  if (!this._suiMaster) {
10
30
  throw new Error('suiMaster is required');
11
31
  }
32
+
33
+ /** @type {Object.<string, SuiCoin>} */
12
34
  this._coins = {};
13
35
 
14
- this._isInitialized = false;
36
+ if (this._suiMaster.onMainnet) {
37
+ // pre-cached coins metadata
38
+ this.setCoinMetas(allCoinMetas);
39
+ }
15
40
  }
16
41
 
17
42
  get suiMaster() {
@@ -23,78 +48,58 @@ class SuiCoins extends SuiCommonMethods {
23
48
  }
24
49
 
25
50
  /**
26
- * Optional common initialized to get a list and metadata of all safe coins defined in SuiCoin.js
51
+ * set predefined coin metas so they will not be fetched from RPC
52
+ * @param {(Object.<string, CoinMeta> | Array.<CoinMeta>)}
53
+ * @returns {number} count of processed items
27
54
  */
28
- async init() {
29
- if (this._isInitialized) {
30
- return true;
31
- }
32
-
33
- const safeList = SuiCoin.safeList(this._suiMaster.connectedChain);
34
- const metadataPromises = [];
35
- for (const coinType in safeList) {
36
- const normalizedCoinType = this.normalizeCoinType(coinType);
37
- if (!this._coins[normalizedCoinType]) {
38
- const suiCoin = new SuiCoin({
39
- coinType: normalizedCoinType,
40
- suiCoins: this,
41
- });
42
- console.log('adding coin with type', normalizedCoinType);
43
- this._coins[normalizedCoinType] = suiCoin;
44
-
45
- const metadataPromise = new Promise(async(res)=>{
46
- try {
47
- await suiCoin.getMetadata();
48
- } catch (e) {
49
- console.error(e);
55
+ setCoinMetas(coinMetas) {
56
+ let processedCount = 0;
57
+ if (Array.isArray(coinMetas)) {
58
+ // [CoinMeta, CoinMeta]
59
+ for (const coinMeta of coinMetas) {
60
+ if (coinMeta.type) {
61
+ const suiCoin = this.get(coinMeta.type);
62
+ const ok = suiCoin.setMetadata(coinMeta);
63
+ if (ok) {
64
+ processedCount++;
50
65
  }
51
-
52
- res();
53
- });
54
- metadataPromises.push(metadataPromise);
66
+ }
67
+ }
68
+ } else {
69
+ // {type: CoinMeta, type: CoinMeta}
70
+ for (const coinType in coinMetas) {
71
+ const suiCoin = this.get(coinType);
72
+ const ok = suiCoin.setMetadata(coinMetas[coinType]);
73
+ if (ok) {
74
+ processedCount++;
75
+ }
55
76
  }
56
77
  }
57
78
 
58
- await Promise.all(metadataPromises);
59
-
60
- this._isInitialized = true;
79
+ return processedCount;
61
80
  }
62
81
 
82
+ /**
83
+ * normalize coinType string to sui's coin type. As extra, may take 'sui' or 'SUI' as the type and return type for it
84
+ * @param {string} coinType
85
+ * @returns {string} normalized coin type
86
+ */
63
87
  normalizeCoinType(coinType) {
64
- if (coinType.indexOf('::') == -1) {
65
- if (coinType.toLowerCase() == 'sui') {
66
- return '0x2::sui::SUI';
67
- } else {
68
- for (const key in this._coins) {
69
- if (key == coinType) {
70
- return this._coins[key].coinType;
71
- }
72
- }
73
-
74
- const safeList = SuiCoin.safeList(this._suiMaster.connectedChain);
75
- for (const key in safeList) {
76
- if (safeList[key] == coinType) {
77
- return key;
78
- }
79
- }
80
- }
88
+ let nCoinType = (''+coinType);
81
89
 
82
- if (coinType.indexOf('0x') == -1) {
83
- return '0x'+coinType+'::coin::COIN';
84
- } else {
85
- return ''+coinType+'::coin::COIN';
90
+ if (nCoinType.indexOf('::') == -1) {
91
+ if (nCoinType.toLowerCase() == 'sui') {
92
+ nCoinType = '0x2::sui::SUI';
86
93
  }
87
94
  }
88
95
 
89
- if (coinType.indexOf('0x') == -1) {
90
- coinType = '0x'+coinType;
96
+ if (nCoinType.indexOf('0x') == -1) {
97
+ nCoinType = '0x'+nCoinType;
91
98
  }
92
99
 
93
- if (coinType == '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI') {
94
- return '0x2::sui::SUI';
95
- }
100
+ nCoinType = normalizeStructTag(nCoinType);
96
101
 
97
- return coinType;
102
+ return nCoinType;
98
103
  }
99
104
 
100
105
  /**
@@ -121,6 +126,14 @@ class SuiCoins extends SuiCommonMethods {
121
126
  }
122
127
 
123
128
  static _singleInstances = {};
129
+
130
+ /**
131
+ * Return singleton instance of the SuiCoins object for the specific chain
132
+ *
133
+ * @param {Object} params - parameters
134
+ * @param {SuiMaster} params.suiMaster - instance of SuiMaster
135
+ * @returns {SuiCoins}
136
+ */
124
137
  static getSingleton(params = {}) {
125
138
  const suiMaster = params.suiMaster;
126
139
  const connectedChain = suiMaster.connectedChain;
@@ -133,6 +146,4 @@ class SuiCoins extends SuiCommonMethods {
133
146
  return SuiCoins._singleInstances[connectedChain];
134
147
  }
135
148
 
136
- };
137
-
138
- module.exports = SuiCoins;
149
+ };
@@ -12,7 +12,7 @@ class CustomEvent extends Event {
12
12
  }
13
13
  }
14
14
 
15
- class SuiCommonMethods extends EventTarget {
15
+ export default class SuiCommonMethods extends EventTarget {
16
16
  constructor(params = {}) {
17
17
  super();
18
18
 
@@ -42,6 +42,4 @@ class SuiCommonMethods extends EventTarget {
42
42
  console.error(e);
43
43
  }
44
44
  }
45
- }
46
-
47
- module.exports = SuiCommonMethods;
45
+ };
package/lib/SuiEvent.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- class SuiEvent extends Event {
3
+ export default class SuiEvent extends Event {
4
4
  constructor(params = {}) {
5
5
  const typeName = params.data ? ((''+params.data.type).split('<')[0].split('::').pop()) : null;
6
6
  super(typeName, {});
@@ -58,6 +58,4 @@ class SuiEvent extends Event {
58
58
  return null;
59
59
  }
60
60
  }
61
- };
62
-
63
- module.exports = SuiEvent;
61
+ };