suidouble 0.0.51 → 1.0.4-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/lib/SuiObject.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const SuiCommonMethods = require('./SuiCommonMethods.js');
2
2
  const SuiPaginatedResponse = require('./SuiPaginatedResponse.js');
3
- const { normalizeSuiAddress } = require('@mysten/sui.js/utils');
3
+ const { normalizeSuiAddress } = require('@mysten/sui/utils');
4
4
 
5
5
  class SuiObject extends SuiCommonMethods {
6
6
  constructor(params = {}) {
@@ -137,7 +137,7 @@ class SuiObject extends SuiCommonMethods {
137
137
  }
138
138
  v = Number(v);
139
139
 
140
- const result = await this._suiMaster._provider.tryGetPastObject({
140
+ const result = await this._suiMaster._client.tryGetPastObject({
141
141
  version: (v),
142
142
  id: this.address,
143
143
  options: {
@@ -221,7 +221,7 @@ class SuiObject extends SuiCommonMethods {
221
221
  }
222
222
 
223
223
  async fetchFields() {
224
- const result = await this._suiMaster._provider.getObject({
224
+ const result = await this._suiMaster._client.getObject({
225
225
  id: this.address, // normalized id
226
226
  options: {
227
227
  showType: true,
package/lib/SuiPackage.js CHANGED
@@ -4,8 +4,9 @@ const SuiPackageModule = require('./SuiPackageModule.js');
4
4
  const SuiPaginatedResponse = require('./SuiPaginatedResponse.js');
5
5
 
6
6
  // fromB64, toB64
7
- const { TransactionBlock } = require('@mysten/sui.js/transactions');
8
- const { normalizeSuiAddress } = require('@mysten/sui.js/utils');
7
+ const { Transaction } = require('@mysten/sui/transactions');
8
+ const { normalizeSuiAddress } = require('@mysten/sui/utils');
9
+ const { bcs } = require('@mysten/sui/bcs');
9
10
 
10
11
  class SuiPackage extends SuiObject {
11
12
  constructor(params = {}) {
@@ -70,9 +71,13 @@ class SuiPackage extends SuiObject {
70
71
  return false;
71
72
  }
72
73
 
73
- async moveCall(moduleName, methodName, params) {
74
+ arg(type, value) {
75
+ return this._suiMaster.utils.pureInput(type, value);
76
+ }
77
+
78
+ async moveCall(moduleName, methodName, params, typeArguments) {
74
79
  await this.checkOnChainIfNeeded();
75
- return await this.modules[moduleName].moveCall(methodName, params);
80
+ return await this.modules[moduleName].moveCall(methodName, params, typeArguments);
76
81
  }
77
82
 
78
83
  async fetchEvents(moduleName, params = {}) {
@@ -167,7 +172,7 @@ class SuiPackage extends SuiObject {
167
172
 
168
173
  // queriing packages out of the loop, as not sure if pagination cursor works ok with mixed calls, @todo: check
169
174
  // @todo: what is the max count of ids here?
170
- const packagesResult = await this._suiMaster._provider.multiGetObjects({
175
+ const packagesResult = await this._suiMaster._client.multiGetObjects({
171
176
  ids: packagesOnChainIds,
172
177
  // only fetch the object type
173
178
  options: { showType: true, showContent: true, },
@@ -215,9 +220,9 @@ class SuiPackage extends SuiObject {
215
220
  async getVersionOnChain() {
216
221
  this.log('geting package version previously published on chain...');
217
222
 
218
- const provider = await this._suiMaster.getProvider();
223
+ const client = await this._suiMaster.getClient();
219
224
 
220
- const result = await provider.getObject({
225
+ const result = await client.getObject({
221
226
  id: this.address, // normalized id
222
227
  options: {
223
228
  showType: true,
@@ -237,6 +242,7 @@ class SuiPackage extends SuiObject {
237
242
 
238
243
  if (result?.data?.content?.disassembled) {
239
244
  for (const key in result?.data?.content?.disassembled) {
245
+ // console.log(result?.data?.content?.disassembled[key]);
240
246
  this.attachModule(key);
241
247
  // if (!this._modules[key]) {
242
248
  // this._modules[key] = new SuiPackageModule({
@@ -311,7 +317,7 @@ class SuiPackage extends SuiObject {
311
317
  queryParams.cursor = nextCursor;
312
318
  }
313
319
 
314
- const result = await this._suiMaster._provider.getOwnedObjects(queryParams);
320
+ const result = await this._suiMaster._client.getOwnedObjects(queryParams);
315
321
 
316
322
  if (result.hasNextPage && result.nextCursor) {
317
323
  hasNextPage = true;
@@ -398,16 +404,16 @@ class SuiPackage extends SuiObject {
398
404
 
399
405
  this.log('publishing package...');
400
406
 
401
- const tx = new TransactionBlock();
407
+ const tx = new Transaction();
402
408
  const [upgradeCap] = tx.publish({
403
409
  modules: this._builtModules,
404
410
  dependencies: this._builtDependencies,
405
411
  });
406
412
 
407
- tx.transferObjects([upgradeCap], tx.pure(this._suiMaster.address));
413
+ tx.transferObjects([upgradeCap], this._suiMaster.address);
408
414
 
409
- const result = await this._suiMaster.signAndExecuteTransactionBlock({
410
- transactionBlock: tx,
415
+ const result = await this._suiMaster.signAndExecuteTransaction({
416
+ transaction: tx,
411
417
  requestType: 'WaitForLocalExecution',
412
418
  options: {
413
419
  "showEffects": true, // @todo: remove?
@@ -434,7 +440,7 @@ class SuiPackage extends SuiObject {
434
440
 
435
441
  this.log('upgrading package...');
436
442
 
437
- const tx = new TransactionBlock();
443
+ const tx = new Transaction();
438
444
 
439
445
  const cap = tx.object(await this.getUpgradeCapId());
440
446
  // export enum UpgradePolicy {
@@ -444,15 +450,21 @@ class SuiPackage extends SuiObject {
444
450
  // }
445
451
  const UpgradePolicyCOMPATIBLE = 0;
446
452
 
453
+ const authorizeUpgradeArguments = [
454
+ cap,
455
+ tx.pure(this.arg('u8', UpgradePolicyCOMPATIBLE)),
456
+ tx.pure(this.arg('vector<u8>', this._builtDigest)),
457
+ ];
458
+
447
459
  const ticket = tx.moveCall({
448
460
  target: '0x2::package::authorize_upgrade',
449
- arguments: [cap, tx.pure(UpgradePolicyCOMPATIBLE), tx.pure(this._builtDigest)],
461
+ arguments: authorizeUpgradeArguments,
450
462
  });
451
463
 
452
464
  const receipt = tx.upgrade({
453
465
  modules: this._builtModules,
454
466
  dependencies: this._builtDependencies,
455
- packageId: this.address, // normalized id
467
+ package: this.address, // packageId -> package in sdk v1.0
456
468
  ticket,
457
469
  });
458
470
 
@@ -461,8 +473,10 @@ class SuiPackage extends SuiObject {
461
473
  arguments: [cap, receipt],
462
474
  });
463
475
 
464
- const result = await this._suiMaster.signAndExecuteTransactionBlock({
465
- transactionBlock: tx,
476
+ console.log(tx);
477
+
478
+ const result = await this._suiMaster.signAndExecuteTransaction({
479
+ transaction: tx,
466
480
  options: {
467
481
  showEffects: true,
468
482
  showObjectChanges: true,
@@ -519,6 +533,7 @@ class SuiPackage extends SuiObject {
519
533
  throw new Error('can not get modules names from local package path');
520
534
  }
521
535
  }
536
+
522
537
  }
523
538
 
524
539
  module.exports = SuiPackage;
@@ -5,8 +5,8 @@ const SuiPaginatedResponse = require('./SuiPaginatedResponse.js');
5
5
  const SuiEvent = require('./SuiEvent.js');
6
6
  // fromB64, toB64
7
7
 
8
- const { TransactionBlock } = require('@mysten/sui.js/transactions');
9
- const { normalizeSuiAddress } = require('@mysten/sui.js/utils');
8
+ const { Transaction } = require('@mysten/sui/transactions');
9
+ const { normalizeSuiAddress } = require('@mysten/sui/utils');
10
10
 
11
11
  class SuiPackageModule extends SuiCommonMethods {
12
12
  constructor(params = {}) {
@@ -35,6 +35,23 @@ class SuiPackageModule extends SuiCommonMethods {
35
35
  this._unsubscribeFunction = null;
36
36
  }
37
37
 
38
+ arg(type, value) {
39
+ return this._suiMaster.utils.pureInput(type, value);
40
+ }
41
+
42
+ async getNormalizedMoveFunction(methodName) {
43
+ const normalizedPackageAddress = await this.getNormalizedPackageAddress();
44
+
45
+ const ret = await this._suiMaster._client.getMoveFunctionArgTypes({
46
+ package: normalizedPackageAddress,
47
+ module: this._moduleName,
48
+ function: methodName,
49
+ });
50
+
51
+ // console.log(ret);
52
+ return ret;
53
+ }
54
+
38
55
  async subscribeEvents() {
39
56
  this.log('subscribing to events of module', this._moduleName);
40
57
 
@@ -55,7 +72,7 @@ class SuiPackageModule extends SuiCommonMethods {
55
72
  this.emit('event', suiEvent, true); // emit to common events flow
56
73
  };
57
74
 
58
- this._unsubscribeFunction = await this._suiMaster._provider.subscribeEvent({
75
+ this._unsubscribeFunction = await this._suiMaster._client.subscribeEvent({
59
76
  filter: {"MoveModule": {"package": normalizedPackageAddress, "module": this._moduleName} },
60
77
  onMessage: onMessage,
61
78
  });
@@ -114,14 +131,14 @@ class SuiPackageModule extends SuiCommonMethods {
114
131
  return null;
115
132
  }
116
133
 
117
- async moveCall(methodName, params) {
134
+ async moveCall(methodName, params, typeArguments) {
118
135
  await this._package.checkOnChainIfNeeded();
119
136
 
120
137
  let tx = null;
121
138
  if (params.tx) {
122
139
  tx = params.tx;
123
140
  } else {
124
- tx = new TransactionBlock();
141
+ tx = new Transaction();
125
142
 
126
143
  const callArgs = [];
127
144
 
@@ -149,11 +166,12 @@ class SuiPackageModule extends SuiCommonMethods {
149
166
  tx.moveCall({
150
167
  target: `${this._package.address}::${this._moduleName}::${methodName}`,
151
168
  arguments: callArgs,
169
+ typeArguments: typeArguments,
152
170
  });
153
171
  }
154
172
 
155
- const result = await this._suiMaster.signAndExecuteTransactionBlock({
156
- transactionBlock: tx,
173
+ const result = await this._suiMaster.signAndExecuteTransaction({
174
+ transaction: tx,
157
175
  requestType: 'WaitForLocalExecution',
158
176
  options: {
159
177
  "showEffects": true, // @todo: remove?
@@ -311,7 +329,7 @@ class SuiPackageModule extends SuiCommonMethods {
311
329
  return true;
312
330
  }
313
331
 
314
- const normalized = await this._suiMaster._provider.getNormalizedMoveModule({
332
+ const normalized = await this._suiMaster._client.getNormalizedMoveModule({
315
333
  package: this._package.address,
316
334
  module: this._moduleName,
317
335
  });
@@ -64,7 +64,7 @@ class SuiPaginatedResponse extends SuiCommonMethods {
64
64
  }
65
65
  paramsCopy.order = this._order;
66
66
 
67
- const response = await this._suiMaster.provider[this._method](paramsCopy);
67
+ const response = await this._suiMaster.client[this._method](paramsCopy);
68
68
  let responseCount = 0;
69
69
  if (response.data && response.data.length) {
70
70
  responseCount = response.data.length;
@@ -1,6 +1,6 @@
1
1
  const { entropyToMnemonic } = require('@scure/bip39');
2
2
  const { wordlist } = require('@scure/bip39/wordlists/english');
3
- const { Ed25519Keypair } = require('@mysten/sui.js/keypairs/ed25519');
3
+ const { Ed25519Keypair } = require('@mysten/sui/keypairs/ed25519');
4
4
 
5
5
  class SuiPseudoRandomAddress {
6
6
  static stringToKeyPair(as) {
@@ -1,13 +1,14 @@
1
1
  const SuiCommonMethods = require('./SuiCommonMethods.js');
2
2
  const SuiLocalTestValidator = require('./SuiLocalTestValidator.js');
3
3
  const SuiMaster = require('./SuiMaster.js');
4
+ const SuiUtils = require('./SuiUtils.js');
4
5
 
5
6
  class SuiTestScenario extends SuiCommonMethods {
6
7
  constructor(params = {}) {
7
8
  super(params);
8
9
 
9
10
  this._path = params.path; // path to Move package's root
10
- this._provider = null;
11
+ this._client = null;
11
12
 
12
13
  this._defaultAs = null; // 'as'(string for pseudo-random keypair generator) for default user and package's owner
13
14
  // (we will publish and init from this user)
@@ -25,13 +26,17 @@ class SuiTestScenario extends SuiCommonMethods {
25
26
  return this._currentAs;
26
27
  }
27
28
 
29
+ arg(type, value) {
30
+ return SuiUtils.pureInput(type, value);
31
+ }
32
+
28
33
  /**
29
34
  * Start local test validator and set up `as` as owner of package deploy transaction.
30
35
  * Package will be deployed with method `init`, as we try to mimic Sui Move's test_scenario
31
36
  * @param {String} as
32
37
  */
33
38
  async begin(as) {
34
- this._provider = await SuiLocalTestValidator.launch({debug: true});
39
+ this._client = await SuiLocalTestValidator.launch({debug: true});
35
40
  this._defaultAs = as;
36
41
  this._currentAs = as;
37
42
  }
@@ -123,7 +128,7 @@ class SuiTestScenario extends SuiCommonMethods {
123
128
  return true;
124
129
  }
125
130
 
126
- const suiMaster = new SuiMaster({debug: this._debug, as: as, provider: this._provider, });
131
+ const suiMaster = new SuiMaster({debug: this._debug, as: as, client: this._client, });
127
132
 
128
133
  await suiMaster.initialize();
129
134
  await suiMaster.requestSuiFromFaucet();
@@ -0,0 +1,182 @@
1
+ const SuiCommonMethods = require('./SuiCommonMethods.js');
2
+ const { Inputs } = require('@mysten/sui/transactions');
3
+ const { bcs } = require('@mysten/sui/bcs');
4
+ const { SuiClient, getFullnodeUrl, SuiHTTPTransport } = require('@mysten/sui/client');
5
+ const { normalizeSuiAddress } = require('@mysten/sui/utils');
6
+
7
+ const WebSocketClient = require('websocket').w3cwebsocket;
8
+
9
+ class SuiUtils extends SuiCommonMethods {
10
+
11
+ /**
12
+ * Returns and Inputs.Pure for a given type
13
+ * to be used as moveCall parameters
14
+ * type is 'u8', 'u16', 'u32', 'u64', 'u128', 'u256', 'address', 'bool', 'string', 'vector<u8>' ... 'vector<u256>'
15
+ *
16
+ * result may be passed as arguments to SuiPackage or SuiPackageModule moveCall functions params array:
17
+ * contract.moveCall('suidouble_chat', 'reply', [
18
+ * SuiUtils.pureInput('string', 'metadata')
19
+ * SuiUtils.pureInput('string', 'metadata')
20
+ * ]);
21
+ *
22
+ * or:
23
+ * wrapped in tx.pure if you are going to construct tx yourself:
24
+ * const tx = new Transaction();
25
+ * tx.moveCall({ target: `x.x.x`, arguments: [
26
+ * tx.pure(SuiUtils.pureInput('u8',22)),
27
+ * tx.pure(SuiUtils.pureInput('string','test')),
28
+ * ] });
29
+ *
30
+ * @param {string} type
31
+ * @param {value} value
32
+ * @returns Inputs.Pure
33
+ */
34
+ static pureInput(type, value) {
35
+ let typeNormalized = type;
36
+ if (typeNormalized.toLowerCase() == 'address') {
37
+ typeNormalized = 'Address';
38
+ }
39
+
40
+ if (bcs[typeNormalized]) {
41
+ //
42
+ if (typeof(bcs[typeNormalized]) == 'object') {
43
+ // sui/bcs
44
+ return Inputs.Pure(bcs[typeNormalized].serialize(value));
45
+ } else {
46
+ // bcs
47
+ return Inputs.Pure(bcs[typeNormalized]().serialize(value));
48
+ }
49
+ } else {
50
+ // may it be a "vector<x>" ?
51
+ const splet = (''+typeNormalized).split('<');
52
+ if (splet[0] == 'vector' && splet[1]) {
53
+ const second = splet[1].split('>');
54
+ if (second[0] && bcs[second[0]]) {
55
+ return Inputs.Pure(bcs.vector(bcs[second[0]]()).serialize(value));
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Wrapper for sui's utils normalizeSuiAddress
63
+ * Perform the following operations:
64
+ * 1. Make the address lower case
65
+ * 2. Prepend `0x` if the string does not start with `0x`.
66
+ * 3. Add more zeros if the length of the address(excluding `0x`) is less than `SUI_ADDRESS_LENGTH`
67
+ *
68
+ * @param {string} address
69
+ * @returns string
70
+ */
71
+ normalizeSuiAddress(address) {
72
+ return normalizeSuiAddress(address);
73
+ }
74
+
75
+ /**
76
+ * As SUI removed websocket dependency for a node, we'll have it here as constructor wrapper
77
+ * returning native WebSocket in browser and websocket's w3cwebsocket in node
78
+ * @returns
79
+ */
80
+ static WebSocketConstructor() {
81
+ return WebSocketClient;
82
+ }
83
+
84
+ /**
85
+ * Makes an instance for SuiClient for a specific chain, eg: 'mainnet'
86
+ * @param {string} chainname
87
+ * @returns SuiClient
88
+ */
89
+ static suiClientFor(chainname) {
90
+ return new SuiClient({
91
+ transport: new SuiHTTPTransport({
92
+ url: getFullnodeUrl(chainname),
93
+ WebSocketConstructor: SuiUtils.WebSocketConstructor(),
94
+ }),
95
+ });
96
+ }
97
+
98
+ /**
99
+ * Normalize SuiClient parameter, accepting:
100
+ * - different previous versions of sui.js library,
101
+ * - object of SuiClient class
102
+ * - object of SuiLocalTestValidator class
103
+ * - string of the chain name to connect to
104
+ *
105
+ * @param {SuiClient} client
106
+ */
107
+ static normalizeClient(clientParam) {
108
+ let client = null;
109
+ let providerName = null;
110
+
111
+ if (clientParam) {
112
+ if (clientParam == 'local' || (clientParam.constructor && clientParam.constructor.name && clientParam.constructor.name == 'SuiLocalTestValidator')) {
113
+ if (clientParam == 'local') {
114
+ client = SuiUtils.suiClientFor('localnet');
115
+ providerName = 'sui:localnet';
116
+ } else {
117
+ // SuiLocalTestValidator
118
+ providerName = clientParam.providerName;
119
+ client = clientParam.client;
120
+ }
121
+ } else if (clientParam == 'test' || clientParam == 'testnet') {
122
+ client = SuiUtils.suiClientFor('testnet');
123
+ providerName = 'sui:testnet';
124
+ } else if (clientParam == 'dev' || clientParam == 'devnet') {
125
+ client = SuiUtils.suiClientFor('devnet');
126
+ providerName = 'sui:devnet';
127
+ } else if (clientParam == 'main' || clientParam == 'mainnet') {
128
+ client = SuiUtils.suiClientFor('mainnet');
129
+ providerName = 'sui:mainnet';
130
+ } else {
131
+ if (clientParam && clientParam.constructor && clientParam.constructor.name && clientParam.constructor.name == 'SuiClient') {
132
+ client = clientParam;
133
+ let url = '';
134
+ if (clientParam.endpoint) {
135
+ // workaround set in SuiInBrowserAdapter
136
+ url = clientParam.endpoint;
137
+ } else if (clientParam.transport && clientParam.transport.websocketClient && clientParam.transport.websocketClient.endpoint) {
138
+ url = clientParam.transport.websocketClient.endpoint;
139
+ }
140
+
141
+ if (url.indexOf('devnet') !== -1) {
142
+ providerName = 'sui:devnet';
143
+ } else if (url.indexOf('testnet') !== -1) {
144
+ providerName = 'sui:testnet';
145
+ } else if (url.indexOf('mainnet') !== -1) {
146
+ providerName = 'sui:mainnet';
147
+ } else if (url.indexOf('127.0.0.1') !== -1) {
148
+ providerName = 'sui:localnet';
149
+ } else {
150
+ // just keep provider name as unique to fullnode URL to keep separate ObjectStorage instances
151
+ providerName = url.split('//')[1];
152
+ }
153
+ } else if (clientParam && clientParam.connection && clientParam.connection.fullnode) {
154
+ client = clientParam;
155
+
156
+ if (clientParam.connection.fullnode.indexOf('devnet') !== -1) {
157
+ providerName = 'sui:devnet';
158
+ } else if (clientParam.connection.fullnode.indexOf('testnet') !== -1) {
159
+ providerName = 'sui:testnet';
160
+ } else if (clientParam.connection.fullnode.indexOf('mainnet') !== -1) {
161
+ providerName = 'sui:mainnet';
162
+ } else if (clientParam.connection.fullnode.indexOf('127.0.0.1') !== -1) {
163
+ providerName = 'sui:localnet';
164
+ } else {
165
+ // just keep provider name as unique to fullnode URL to keep separate ObjectStorage instances
166
+ providerName = clientParam.connection.fullnode;
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ if (client) {
173
+ client.providerName = providerName;
174
+ return client;
175
+ }
176
+
177
+ return null;
178
+ }
179
+
180
+ };
181
+
182
+ module.exports = SuiUtils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suidouble",
3
- "version": "0.0.51",
3
+ "version": "1.0.4-2",
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": {
@@ -21,8 +21,9 @@
21
21
  "author": "Jeka Kiselyov <jeka911@gmail.com> (https://github.com/jeka-kiselyov)",
22
22
  "license": "Apache-2.0",
23
23
  "dependencies": {
24
- "@mysten/sui.js": "^0.43.3",
25
- "@wallet-standard/core": "^1.0.3"
24
+ "@mysten/sui": "^1.0.4",
25
+ "@wallet-standard/core": "^1.0.3",
26
+ "websocket": "^1.0.35"
26
27
  },
27
28
  "devDependencies": {
28
29
  "tap": "^16.3.4"
@@ -3,7 +3,7 @@
3
3
  const t = require('tap');
4
4
  const { test } = t;
5
5
 
6
- const { SuiMaster, SuiLocalTestValidator, TransactionBlock } = require('..');
6
+ const { SuiMaster, SuiLocalTestValidator, Transaction } = require('..');
7
7
 
8
8
  let suiLocalTestValidator = null;
9
9
  let suiMaster = null;
@@ -18,7 +18,7 @@ test('spawn local test node', async t => {
18
18
  });
19
19
 
20
20
  test('init suiMaster and connect it to local test validator', async t => {
21
- suiMaster = new SuiMaster({provider: 'local', as: 'somebody', debug: true});
21
+ suiMaster = new SuiMaster({client: 'local', as: 'somebody', debug: true});
22
22
  await suiMaster.initialize();
23
23
 
24
24
  t.ok(suiMaster.address); // there should be some address
@@ -56,16 +56,16 @@ test('string representation works ok', async t => {
56
56
  await suiCoin.getMetadata();
57
57
 
58
58
  const toDisplay1 = suiCoin.amountToString(suiMaster.MIST_PER_SUI);
59
- t.equals(toDisplay1, '1.0');
59
+ t.equal(toDisplay1, '1.0');
60
60
 
61
61
  const toDisplay2 = suiCoin.amountToString(1); // 1 mist
62
- t.equals(toDisplay2, '0.000000001');
62
+ t.equal(toDisplay2, '0.000000001');
63
63
 
64
64
  const toDisplay3 = suiCoin.amountToString(suiMaster.MIST_PER_SUI * BigInt(1000) + BigInt(1)); // 1000 SUI + 1 mist
65
- t.equals(toDisplay3, '1000.000000001');
65
+ t.equal(toDisplay3, '1000.000000001');
66
66
 
67
67
  const toDisplay4 = suiCoin.amountToString(suiMaster.MIST_PER_SUI * BigInt(1000) - BigInt(1)); // 1000 SUI - 1 mist
68
- t.equals(toDisplay4, '999.999999999');
68
+ t.equal(toDisplay4, '999.999999999');
69
69
  });
70
70
 
71
71
  test('you have no SUI on the fresh node', async t => {
@@ -87,12 +87,12 @@ test('getting coin objects for a transaction', async t => {
87
87
 
88
88
  const wasBalance = await suiCoin.getBalance(suiMaster.address);
89
89
 
90
- const txb = new TransactionBlock();
91
- const coinInput = await suiCoin.coinOfAmountToTxCoin(txb, suiMaster.address, suiMaster.MIST_PER_SUI); // pick 1 SUI
92
- txb.transferObjects([coinInput], txb.pure('0x1d20dcdb2bca4f508ea9613994683eb4e76e9c4ed371169677c1be02aaf0b12a')); // send it anywhere
90
+ const tx = new Transaction();
91
+ const coinInput = await suiCoin.coinOfAmountToTxCoin(tx, suiMaster.address, suiMaster.MIST_PER_SUI); // pick 1 SUI
92
+ tx.transferObjects([coinInput], tx.pure('0x1d20dcdb2bca4f508ea9613994683eb4e76e9c4ed371169677c1be02aaf0b12a')); // send it anywhere
93
93
 
94
- const result = await suiMaster.signAndExecuteTransactionBlock({
95
- transactionBlock: txb,
94
+ const result = await suiMaster.signAndExecuteTransaction({
95
+ transaction: tx,
96
96
  requestType: 'WaitForLocalExecution',
97
97
  options: {
98
98
  },