suidouble 0.0.42 → 0.0.44

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
@@ -321,7 +321,7 @@ Same, it's for CLI as it re-builds the package.
321
321
  ```javascript
322
322
  const { SuiMaster } = require('suidouble');
323
323
 
324
- const provider = 'local';// or await SuiLocalTestValidator.launch({debug: true});
324
+ const provider = 'local';// or await SuiLocalTestValidator.launch({debug: true, epochDuration: 30000});
325
325
 
326
326
  const suiMaster = new SuiMaster({ debug: true, as: 'admin', provider: provider, });
327
327
  await suiMaster.requestSuiFromFaucet();
@@ -15,7 +15,7 @@ try {
15
15
  } catch (e) {}
16
16
 
17
17
  class SuiCliCommands {
18
- static async spawn(command, envVars = {}) {
18
+ static async spawn(command, params = [], envVars = {}) {
19
19
  if (!doSpawn) {
20
20
  throw new Error('can not spawn a proccess in this env');
21
21
  }
@@ -23,7 +23,7 @@ class SuiCliCommands {
23
23
  return await new Promise((res,rej)=>{
24
24
  let success = true;
25
25
  let e = null;
26
- const proc = doSpawn(command, [], {
26
+ const proc = doSpawn(command, params, {
27
27
  env: {
28
28
  ...process.env,
29
29
  ...envVars,
@@ -17,6 +17,8 @@ class SuiLocalTestValidator extends SuiCommonMethods {
17
17
  this._testFallbackEnabled = true;
18
18
  }
19
19
 
20
+ this._epochDuration = params.epochDuration || null;
21
+
20
22
  this._providerName = 'sui:localnet';
21
23
  }
22
24
 
@@ -60,7 +62,12 @@ class SuiLocalTestValidator extends SuiCommonMethods {
60
62
  this.log('launching sui-test-validator ...');
61
63
 
62
64
  try {
63
- this._child = await SuiCliCommands.spawn('sui-test-validator', { RUST_LOG: 'consensus=off' });
65
+ const params = [];
66
+ if (this._epochDuration) {
67
+ params.push('--epoch-duration-ms');
68
+ params.push(this._epochDuration);
69
+ }
70
+ this._child = await SuiCliCommands.spawn('sui-test-validator', params, { RUST_LOG: 'consensus=off' });
64
71
  } catch (e) {
65
72
  if (this._testFallbackEnabled) {
66
73
  // can't start local node. Let's switch to sui:dev
@@ -216,12 +216,14 @@ class SuiPackageModule extends SuiCommonMethods {
216
216
  this.emit(suiEvent.typeName, suiEvent);
217
217
  }
218
218
 
219
- return {
220
- created: listCreated,
221
- mutated: listMutated,
222
- deleted: listDeleted,
223
- status: status,
224
- };
219
+ return suiTransaction;
220
+
221
+ // return {
222
+ // created: listCreated,
223
+ // mutated: listMutated,
224
+ // deleted: listDeleted,
225
+ // status: status,
226
+ // };
225
227
  }
226
228
 
227
229
  async getOwnedObjects(params = {}) {
@@ -16,6 +16,49 @@ class SuiTransaction extends SuiCommonMethods {
16
16
  this._events = null;
17
17
  }
18
18
 
19
+ get executedEpoch() {
20
+ if (this._data && this._data.effects && this._data.effects.executedEpoch) {
21
+ return BigInt(this._data.effects.executedEpoch);
22
+ }
23
+
24
+ return null;
25
+ }
26
+
27
+ get digest() {
28
+ if (this._data) {
29
+ return this._data.digest;
30
+ }
31
+
32
+ return null;
33
+ }
34
+
35
+ get gasUsed() {
36
+ try {
37
+ if (this._data && this._data.effects && this._data.effects.gasUsed) {
38
+ return BigInt(this._data.effects.gasUsed.computationCost) + BigInt(this._data.effects.gasUsed.storageCost) - BigInt(this._data.effects.gasUsed.storageRebate);
39
+ }
40
+ } catch (e) {
41
+ return null;
42
+ }
43
+
44
+ return null;
45
+ }
46
+
47
+ get deleted() {
48
+ const results = this.results;
49
+ return results.deleted;
50
+ }
51
+
52
+ get mutated() {
53
+ const results = this.results;
54
+ return results.mutated;
55
+ }
56
+
57
+ get created() {
58
+ const results = this.results;
59
+ return results.created;
60
+ }
61
+
19
62
  get data() {
20
63
  return this._data;
21
64
  }
@@ -135,6 +178,7 @@ class SuiTransaction extends SuiCommonMethods {
135
178
  mutated: listMutated,
136
179
  deleted: listDeleted,
137
180
  objects: Object.values(objects),
181
+ status: this.status,
138
182
  };
139
183
 
140
184
  return this._results;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suidouble",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
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": {