suidouble 0.0.9 → 0.0.10
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 +17 -12
- package/package.json +1 -1
- package/test/sui_master_onlocal.test.js +5 -0
package/lib/SuiObject.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const sui = require('@mysten/sui.js');
|
|
2
2
|
const SuiCommonMethods = require('./SuiCommonMethods.js');
|
|
3
|
+
const SuiPaginatedResponse = require('./SuiPaginatedResponse.js');
|
|
3
4
|
|
|
4
5
|
class SuiObject extends SuiCommonMethods {
|
|
5
6
|
constructor(params = {}) {
|
|
@@ -119,19 +120,23 @@ class SuiObject extends SuiCommonMethods {
|
|
|
119
120
|
return this._localProperties;
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
async getDynamicFields() {
|
|
123
|
-
const
|
|
124
|
-
parentId: this.address,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
123
|
+
async getDynamicFields(params = {}) {
|
|
124
|
+
const queryParams = {
|
|
125
|
+
parentId: this.address,
|
|
126
|
+
limit: params.limit || 50,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const paginatedResponse = new SuiPaginatedResponse({
|
|
130
|
+
debug: this._debug,
|
|
131
|
+
suiMaster: this._suiMaster,
|
|
132
|
+
params: queryParams,
|
|
133
|
+
method: 'getDynamicFields',
|
|
134
|
+
order: params.order,
|
|
134
135
|
});
|
|
136
|
+
|
|
137
|
+
await paginatedResponse.fetch();
|
|
138
|
+
|
|
139
|
+
return paginatedResponse;
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
async fetchFields() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suidouble",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
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": {
|
|
@@ -187,6 +187,11 @@ test('execute contract methods', async t => {
|
|
|
187
187
|
const chatTopMessage = contract.objectStorage.findMostRecentByTypeName('ChatTopMessage');
|
|
188
188
|
t.ok(chatTopMessage);
|
|
189
189
|
|
|
190
|
+
const dynamicFields = await chatTopMessage.getDynamicFields();
|
|
191
|
+
// as per sample move contract design, after the thread posted, chatResponse is attached to chatTopMessage as a dynamic object field
|
|
192
|
+
// it's there till the very first response to thread is posted
|
|
193
|
+
t.ok(dynamicFields.data.length === 1);
|
|
194
|
+
|
|
190
195
|
const responseTextAsBytes = [].slice.call(new TextEncoder().encode('ขอบคุณครับ, 🇺🇦')); // regular array with utf data
|
|
191
196
|
const moveCallResult2 = await contract.moveCall('suidouble_chat', 'reply', [chatTopMessage.id, responseTextAsBytes, 'metadata']);
|
|
192
197
|
|