suidouble 1.20.0 → 1.24.0
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/SuiEvent.js +4 -0
- package/lib/SuiInBrowserAdapter.js +11 -2
- package/lib/SuiMaster.js +8 -0
- package/lib/SuiPackageModule.js +1 -2
- package/package.json +4 -2
- package/test/sui_master_onlocal.test.js +4 -2
- package/test/test_move_contracts/different_types/Move.lock +1 -1
- package/test/test_move_contracts/suidouble_chat/Move.lock +1 -1
package/lib/SuiEvent.js
CHANGED
|
@@ -40,6 +40,10 @@ export default class SuiEvent extends Event {
|
|
|
40
40
|
return this._data ? (''+this._data.type).split('<')[0].split('::').pop() : null;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
get type() {
|
|
44
|
+
return this._data ? (''+this._data.type) : null;
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
get data() {
|
|
44
48
|
return this._data;
|
|
45
49
|
}
|
|
@@ -8,7 +8,8 @@ const Feature = {
|
|
|
8
8
|
SUI_SIGN_TX_BLOCK: 'sui:signTransactionBlock',
|
|
9
9
|
SUI_SIGN_AND_EXECUTE_TX: 'sui:signAndExecuteTransaction',
|
|
10
10
|
SUI_SIGN_TX: 'sui:signTransaction',
|
|
11
|
-
SUI_SIGN_MESSAGE: 'sui:signMessage'
|
|
11
|
+
SUI_SIGN_MESSAGE: 'sui:signMessage',
|
|
12
|
+
SUI_SIGN_PERSONAL_MESSAGE: 'sui:signPersonalMessage',
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export default class SuiInBrowserAdapter extends SuiCommonMethods {
|
|
@@ -58,8 +59,16 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
|
|
|
58
59
|
return await this.getFeature(Feature.SUI_SIGN_TX_BLOCK).signTransactionBlock(params);
|
|
59
60
|
}
|
|
60
61
|
|
|
62
|
+
async signPersonalMessage(params) {
|
|
63
|
+
if (this.hasFeature(Feature.SUI_SIGN_PERSONAL_MESSAGE)) {
|
|
64
|
+
return await this.getFeature(Feature.SUI_SIGN_PERSONAL_MESSAGE).signPersonalMessage(params);
|
|
65
|
+
} else {
|
|
66
|
+
return await this.getFeature(Feature.SUI_SIGN_MESSAGE).signMessage(params);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
61
70
|
async signMessage(params) {
|
|
62
|
-
return await this.
|
|
71
|
+
return await this.signPersonalMessage(params);
|
|
63
72
|
}
|
|
64
73
|
|
|
65
74
|
async disconnect(params) {
|
package/lib/SuiMaster.js
CHANGED
|
@@ -317,6 +317,14 @@ export default class SuiMaster extends SuiCommonMethods {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
async signAndExecuteTransaction(params) {
|
|
320
|
+
if (!params.chain) {
|
|
321
|
+
const chainId = 'sui:'+(this._providerName.split('sui:').join('').toLowerCase());
|
|
322
|
+
params.chain = chainId;
|
|
323
|
+
}
|
|
324
|
+
if (!params.account) {
|
|
325
|
+
params.account = { address: this._address };
|
|
326
|
+
}
|
|
327
|
+
|
|
320
328
|
let txResults = null;
|
|
321
329
|
if (this._keypair) {
|
|
322
330
|
params.signer = this._keypair;
|
package/lib/SuiPackageModule.js
CHANGED
|
@@ -53,7 +53,6 @@ export default class SuiPackageModule extends SuiCommonMethods {
|
|
|
53
53
|
function: methodName,
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
// console.log(ret);
|
|
57
56
|
return ret;
|
|
58
57
|
}
|
|
59
58
|
|
|
@@ -295,7 +294,7 @@ export default class SuiPackageModule extends SuiCommonMethods {
|
|
|
295
294
|
const moduleFilter = {};
|
|
296
295
|
|
|
297
296
|
// we need very first package version's id here. So we are getting it from normalized data
|
|
298
|
-
|
|
297
|
+
let normalizedPackageAddress = await this.getNormalizedPackageAddress();
|
|
299
298
|
if (params.eventTypeName) {
|
|
300
299
|
moduleFilter.MoveEventType = `${normalizedPackageAddress}::${this._moduleName}::${params.eventTypeName}`;
|
|
301
300
|
this.log('queriying for events of type: ', moduleFilter.MoveEventType);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suidouble",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
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
|
"type": "module",
|
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
"author": "suidouble (https://github.com/suidouble)",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@mysten/
|
|
25
|
+
"@mysten/bcs": "^1.5.0",
|
|
26
|
+
"@mysten/sui": "^1.24.0",
|
|
26
27
|
"@polymedia/coinmeta": "^0.0.17",
|
|
28
|
+
"@scure/bip39": "^1.5.4",
|
|
27
29
|
"@wallet-standard/core": "^1.0.3",
|
|
28
30
|
"websocket": "^1.0.35"
|
|
29
31
|
},
|
|
@@ -86,6 +86,8 @@ test('attach a local package', async t => {
|
|
|
86
86
|
t.not(contract.address, contractAddressV1);
|
|
87
87
|
t.equal(contract.version, 2);
|
|
88
88
|
|
|
89
|
+
await new Promise((res)=>setTimeout(res, 1000)); // wait for upgrade in rpc
|
|
90
|
+
|
|
89
91
|
contractAddressV2 = contract.address;
|
|
90
92
|
|
|
91
93
|
// let's quickly check it worked, there should be event ChatShopCreated created and we can fetch it from contract's module
|
|
@@ -259,7 +261,7 @@ test('testing paginatedResponse', async t => {
|
|
|
259
261
|
const moveCallResult = await contract.moveCall('suidouble_chat', 'fill', [chatTopMessage.id, contract.arg('string', 'the message response'), contract.arg('string', 'metadata')]);
|
|
260
262
|
t.ok(moveCallResult.created.length >= 60); // it's 60 in move code, but let's keep chat flexible
|
|
261
263
|
|
|
262
|
-
const eventsResponse = await contract.fetchEvents('
|
|
264
|
+
const eventsResponse = await contract.modules.suidouble_chat.fetchEvents({eventTypeName: 'ChatResponseCreated'});
|
|
263
265
|
const idsInEventsDict = {};
|
|
264
266
|
let responsesInEventsCount = 0;
|
|
265
267
|
do {
|
|
@@ -274,7 +276,7 @@ test('testing paginatedResponse', async t => {
|
|
|
274
276
|
t.ok(responsesInEventsCount >= 60); // it's 60 in move code, but let's keep chat flexible
|
|
275
277
|
|
|
276
278
|
// or using SuiPaginatedResponse forEach itterator:
|
|
277
|
-
const anotherEventsResponse = await contract.fetchEvents('
|
|
279
|
+
const anotherEventsResponse = await contract.modules.suidouble_chat.fetchEvents({eventTypeName: 'ChatResponseCreated'});
|
|
278
280
|
let loopsInForEach = 0;
|
|
279
281
|
const idsInLoopDict = {};
|
|
280
282
|
await anotherEventsResponse.forEach(async (event)=>{ //
|