suidouble 1.45.0 → 2.5.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/index.js CHANGED
@@ -8,7 +8,7 @@ import SuiMemoryObjectStorage from './lib/SuiMemoryObjectStorage.js';
8
8
  import SuiCoin from './lib/SuiCoin.js';
9
9
  import SuiCoins from './lib/SuiCoins.js';
10
10
  import SuiPaginatedResponse from './lib/SuiPaginatedResponse.js';
11
- import { Transaction, Commands } from '@mysten/sui/transactions';
11
+ import { Transaction, TransactionCommands as Commands } from '@mysten/sui/transactions';
12
12
  import { bcs } from '@mysten/sui/bcs';
13
13
 
14
14
  const txInput = SuiUtils.txInput;
package/lib/SuiCoin.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Commands, Transaction } from '@mysten/sui/transactions';
1
+ import { TransactionCommands as Commands, Transaction } from '@mysten/sui/transactions';
2
2
 
3
3
  /**
4
4
  * @typedef {import("@mysten/sui/transactions").TransactionObjectArgument} TransactionObjectArgument
@@ -209,12 +209,18 @@ export default class SuiCoin {
209
209
  * @returns {boolean} if processed ok
210
210
  */
211
211
  setMetadata(meta) {
212
- if (meta && meta.decimals && meta.decimals > 0 && meta.name && meta.symbol) {
212
+ if (SuiCoin.isValidMetadata(meta)) {
213
213
  this._metadata = meta;
214
214
  this._exists = true;
215
215
  return true;
216
216
  }
217
+ return false;
218
+ }
217
219
 
220
+ static isValidMetadata(meta) {
221
+ if (meta && meta.decimals && meta.decimals > 0 && meta.name && meta.symbol) {
222
+ return true;
223
+ }
218
224
  return false;
219
225
  }
220
226
 
package/lib/SuiCoins.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import SuiCoin from './SuiCoin.js';
2
2
  import SuiCommonMethods from './SuiCommonMethods.js';
3
- import { allCoinMetas } from '@polymedia/coinmeta';
4
3
  import { normalizeStructTag } from "@mysten/sui/utils";
5
-
4
+ import { allCoinMetas } from '@polymedia/coinmeta';
6
5
 
7
6
  /**
8
7
  * @typedef {import("./SuiCoin.js").CoinMeta} CoinMeta
@@ -81,6 +80,34 @@ export default class SuiCoins extends SuiCommonMethods {
81
80
  return processedCount;
82
81
  }
83
82
 
83
+ static async prefetchMainnetCoinMetas() {
84
+ if (this.__preloadPromise) {
85
+ return this.__preloadPromise;
86
+ }
87
+
88
+ this.__preloadPromiseResolver = null;
89
+ this.__preloadPromise = new Promise((resolve) => {
90
+ this.__preloadPromiseResolver = resolve;
91
+ });
92
+
93
+ const preloadUrl = "https://coinmeta.polymedia.app/api/data.json";
94
+ const fetched = [];
95
+ try {
96
+ const response = await fetch(preloadUrl);
97
+ if (response.ok) {
98
+ const coinMetas = await response.json();
99
+ if (Array.isArray(coinMetas) && coinMetas.length) {
100
+ fetched.push(...coinMetas);
101
+ }
102
+ }
103
+ } catch (e) {
104
+ // ignore
105
+ }
106
+
107
+ this.__preloadPromiseResolver(fetched);
108
+ return fetched;
109
+ }
110
+
84
111
  /**
85
112
  * Get all CoinBalance[] for the specific address or connected address
86
113
  *
@@ -1,7 +1,6 @@
1
1
  import SuiCommonMethods from './SuiCommonMethods.js';
2
2
  import SuiInBrowserAdapter from './SuiInBrowserAdapter.js';
3
3
  import { getWallets } from '@wallet-standard/core';
4
- import { SuiClient } from '@mysten/sui/client';
5
4
  import SuiMaster from './SuiMaster.js';
6
5
 
7
6
  import icons from './data/icons.js';
@@ -198,18 +197,15 @@ export default class SuiInBrowser extends SuiCommonMethods {
198
197
  }
199
198
 
200
199
  let chainName = this.getCurrentChain();
201
- const chainSettings = SuiInBrowser.getChainsSettings();
202
- // https://github.com/MystenLabs/sui/blob/827f1138a09190975172ec99389751ca95cce5df/sdk/typescript/src/rpc/connection.ts#L32
203
200
 
204
201
  if (this._rpcSettings) {
205
202
  this._rpcSettings.providerName = chainName.split('sui:').join('');
206
203
  this._client = SuiMaster.SuiUtils.suiClientForRPC(this._rpcSettings);
207
- } else if (!chainSettings[chainName]) {
204
+ } else if (!chainName) {
208
205
  this.log('error', 'invalid chain', chainName);
209
206
  throw new Error('invalid chain: '+chainName);
210
207
  } else {
211
- this._client = new SuiClient({url: chainSettings[chainName].fullnode});
212
- this._client.endpoint = chainSettings[chainName].fullnode;
208
+ this._client = SuiMaster.SuiUtils.suiClientFor(chainName);
213
209
  }
214
210
 
215
211
  this._suiMaster = new SuiMaster({
@@ -245,31 +241,6 @@ export default class SuiInBrowser extends SuiCommonMethods {
245
241
  });
246
242
  }
247
243
 
248
- static getChainsSettings() {
249
- return {
250
- 'sui:devnet': {
251
- fullnode: 'https://fullnode.devnet.sui.io:443/',
252
- websocket: 'https://fullnode.devnet.sui.io:443/',
253
- faucet: 'https://faucet.devnet.sui.io/gas',
254
- },
255
- 'sui:testnet': {
256
- fullnode: 'https://fullnode.testnet.sui.io:443/',
257
- websocket: 'https://fullnode.testnet.sui.io:443/',
258
- faucet: 'https://faucet.testnet.sui.io/gas',
259
- },
260
- 'sui:mainnet': {
261
- fullnode: 'https://fullnode.mainnet.sui.io:443/',
262
- websocket: 'https://fullnode.mainnet.sui.io:443/',
263
- },
264
- 'sui:localnet': {
265
- websocket: 'http://127.0.0.1:9000',
266
- fullnode: 'http://127.0.0.1:9000',
267
- websocket: 'http://127.0.0.1:9000',
268
- faucet: 'http://127.0.0.1:9123/gas',
269
- },
270
- };
271
- }
272
-
273
244
  static getPossibleWallets() {
274
245
  return [
275
246
  {
@@ -1,6 +1,5 @@
1
1
  import SuiCliCommands from "./SuiCliCommands.js";
2
2
  import SuiCommonMethods from "./SuiCommonMethods.js";
3
- import { SuiClient, getFullnodeUrl, SuiHTTPTransport } from '@mysten/sui/client';
4
3
  import SuiUtils from "./SuiUtils.js";
5
4
 
6
5
  export default class SuiLocalTestValidator extends SuiCommonMethods {
@@ -28,18 +27,10 @@ export default class SuiLocalTestValidator extends SuiCommonMethods {
28
27
 
29
28
  get client() {
30
29
  if (this._providerName === 'sui:localnet') {
31
- return new SuiClient({
32
- transport: new SuiHTTPTransport({
33
- url: getFullnodeUrl('localnet'),
34
- WebSocketConstructor: SuiUtils.WebSocketConstructor(),
35
- }),
36
- });
30
+ return SuiUtils.suiClientFor('localnet');
37
31
  } else if (this._providerName === 'sui:devnet') {
38
32
  // if testFallbackEnabled == true and we can't start local node
39
- return new SuiClient({
40
- url: getFullnodeUrl('devnet'),
41
- WebSocketConstructor: SuiUtils.WebSocketConstructor(),
42
- });
33
+ return SuiUtils.suiClientFor('devnet');
43
34
  }
44
35
  }
45
36
 
package/lib/SuiMaster.js CHANGED
@@ -13,17 +13,17 @@ import { MIST_PER_SUI } from '@mysten/sui/utils';
13
13
  import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
14
14
  import { Secp256k1Keypair } from '@mysten/sui/keypairs/secp256k1';
15
15
  import { Secp256r1Keypair } from '@mysten/sui/keypairs/secp256r1';
16
- import { requestSuiFromFaucetV0, getFaucetHost } from '@mysten/sui/faucet';
17
- import { Transaction, Commands } from '@mysten/sui/transactions';
16
+ import { requestSuiFromFaucetV2, getFaucetHost } from '@mysten/sui/faucet';
17
+ import { Transaction, TransactionCommands as Commands } from '@mysten/sui/transactions';
18
18
  import { decodeSuiPrivateKey } from '@mysten/sui/cryptography';
19
19
 
20
20
 
21
21
 
22
22
  /**
23
- * @typedef {import("@mysten/sui/client").SuiClient} SuiClient
23
+ * @typedef {import("@mysten/sui/jsonRpc").SuiJsonRpcClient} SuiJsonRpcClient
24
24
  * @typedef {import("@mysten/sui/cryptography").Signer} SuiSigner
25
25
  * @typedef {import("@mysten/sui/cryptography").Keypair} SuiKeypair
26
- * @typedef {import("@mysten/sui/client").SuiTransactionBlockResponse} SuiTransactionBlockResponse
26
+ * @typedef {import("@mysten/sui/jsonRpc").SuiTransactionBlockResponse} SuiTransactionBlockResponse
27
27
  */
28
28
 
29
29
  export default class SuiMaster extends SuiCommonMethods {
@@ -38,7 +38,7 @@ export default class SuiMaster extends SuiCommonMethods {
38
38
  * @param {?string} param.keypairAlgo - keypair algorithm to use with mnemonic phrase. One of 'ed25519' (default), 'secp256k1', 'secp256r1'
39
39
  * @param {?number} param.accountIndex - index of account to derive from mnemonic phrase. Default is 0
40
40
  * @param {?string} param.as - pseudo-random address generation seed string
41
- * @param {?SuiClient|string} params.client - instance of SuiClient or chain name to make SuiClient connected to it (like 'local', 'devnet', 'testnet', 'mainnet')
41
+ * @param {?SuiJsonRpcClient|string} params.client - instance of SuiJsonRpcClient or chain name to make SuiJsonRpcClient connected to it (like 'local', 'devnet', 'testnet', 'mainnet')
42
42
  */
43
43
  constructor(params) {
44
44
  super(params);
@@ -64,15 +64,7 @@ export default class SuiMaster extends SuiCommonMethods {
64
64
  this._keypair = params.keypair;
65
65
  } else if (params.privateKey) {
66
66
  const parsed = decodeSuiPrivateKey(params.privateKey);
67
- if (parsed && parsed.schema) {
68
- if (parsed.schema === 'ED25519') {
69
- this._keypair = Ed25519Keypair.fromSecretKey(parsed.secretKey);
70
- } else if (parsed.schema == 'Secp256k1') {
71
- this._keypair = Secp256k1Keypair.fromSecretKey(parsed.secretKey);
72
- } else if (parsed.schema == 'Secp256r1') {
73
- this._keypair = Secp256r1Keypair.fromSecretKey(parsed.secretKey);
74
- }
75
- } else if (parsed && parsed.scheme) {
67
+ if (parsed && parsed.scheme) {
76
68
  if (parsed.scheme === 'ED25519') {
77
69
  this._keypair = Ed25519Keypair.fromSecretKey(parsed.secretKey);
78
70
  } else if (parsed.scheme == 'Secp256k1') {
@@ -125,7 +117,7 @@ export default class SuiMaster extends SuiCommonMethods {
125
117
  this._providerName = this._client ? this._client.providerName : null;
126
118
 
127
119
  if (!this._client) {
128
- throw new Error('Can not do anything without SuiClient. Set params.client at least to `local`');
120
+ throw new Error('Can not do anything without Sui client. Set params.client at least to `local`, so we can make default one for the chain');
129
121
  }
130
122
 
131
123
  // we are differient single instances of object storage by provider name (so we can separate like devnet-testnet entities if needed)
@@ -362,6 +354,43 @@ export default class SuiMaster extends SuiCommonMethods {
362
354
  }
363
355
  }
364
356
 
357
+ /**
358
+ * Sign and execute a transaction on the Sui blockchain.
359
+ * Uses the connected keypair or signer or browser extension wallet adapter to sign the transaction before submitting it.
360
+ *
361
+ * @param {Object} params - Transaction parameters
362
+ * @param {Transaction} params.transaction - The Transaction object to sign and execute
363
+ * @param {Object} [params.options] - Options specifying what data to return in the response
364
+ * @param {boolean} [params.options.showEffects] - Whether to include transaction effects
365
+ * @param {boolean} [params.options.showEvents] - Whether to include emitted events
366
+ * @param {boolean} [params.options.showObjectChanges] - Whether to include object changes
367
+ * @param {boolean} [params.options.showBalanceChanges] - Whether to include balance changes
368
+ * @param {boolean} [params.options.showInput] - Whether to include transaction input
369
+ * @param {boolean} [params.options.showType] - Whether to include object types
370
+ * @param {boolean} [params.options.showContent] - Whether to include object content
371
+ * @param {boolean} [params.options.showOwner] - Whether to include object ownership info
372
+ * @param {boolean} [params.options.showDisplay] - Whether to include display data
373
+ * @param {string} [params.requestType] - Request type, use 'WaitForLocalExecution' to wait for transaction finality
374
+ * @param {string} [params.chain] - Chain identifier (defaults to connected chain, e.g., 'sui:mainnet')
375
+ * @param {Object} [params.account] - Account info (defaults to connected address)
376
+ * @param {string} [params.account.address] - The account address
377
+ *
378
+ * @returns {Promise<SuiTransactionBlockResponse>} The transaction execution response
379
+ *
380
+ * @example
381
+ * const tx = new Transaction();
382
+ * tx.moveCall({ target: '0x2::coin::transfer', arguments: [...] });
383
+ *
384
+ * const result = await suiMaster.signAndExecuteTransaction({
385
+ * transaction: tx,
386
+ * requestType: 'WaitForLocalExecution',
387
+ * options: {
388
+ * showEffects: true,
389
+ * showEvents: true,
390
+ * showObjectChanges: true,
391
+ * },
392
+ * });
393
+ */
365
394
  async signAndExecuteTransaction(params) {
366
395
  if (!params.chain) {
367
396
  const chainId = 'sui:'+(this._providerName.split('sui:').join('').toLowerCase());
@@ -406,16 +435,16 @@ export default class SuiMaster extends SuiCommonMethods {
406
435
  } else {
407
436
  const faucetHost = getFaucetHost(provider);
408
437
  this.log(`requesting sui from faucet... ${faucetHost}`);
409
- const requested = await requestSuiFromFaucetV0({
438
+ const requested = await requestSuiFromFaucetV2({
410
439
  host: faucetHost,
411
440
  recipient: this._address,
412
441
  });
413
442
 
414
443
  let objectsCount = 0;
415
444
 
416
- if (requested && requested.transferredGasObjects) {
417
- for (let transferredGasObject of requested.transferredGasObjects) {
418
- amount += BigInt(transferredGasObject.amount);
445
+ if (requested && requested.coins_sent) {
446
+ for (const transferred of requested.coins_sent) {
447
+ amount += BigInt(transferred.amount);
419
448
  objectsCount++;
420
449
  }
421
450
  }
package/lib/SuiUtils.js CHANGED
@@ -2,7 +2,7 @@ import SuiCommonMethods from './SuiCommonMethods.js';
2
2
  import { Inputs, Transaction } from '@mysten/sui/transactions';
3
3
  import { bcs } from '@mysten/sui/bcs';
4
4
  import { fromBase64 } from '@mysten/bcs';
5
- import { SuiClient, getFullnodeUrl, SuiHTTPTransport } from '@mysten/sui/client';
5
+ import { SuiJsonRpcClient, getJsonRpcFullnodeUrl, JsonRpcHTTPTransport } from '@mysten/sui/jsonRpc';
6
6
  import { normalizeSuiAddress } from '@mysten/sui/utils';
7
7
  import WebSocket from 'websocket';
8
8
 
@@ -112,23 +112,23 @@ export default class SuiUtils extends SuiCommonMethods {
112
112
  }
113
113
 
114
114
  /**
115
- * Makes an instance for SuiClient for a specific chain using RPC
115
+ * Makes an instance for SuiJsonRpcClient for a specific chain using RPC
116
116
  * @param {Object} params parameters
117
117
  * @param {string} params.chainname 'mainnet', 'devnet', 'testnet', 'localnet'
118
118
  * @param {string} params.url rpc url
119
119
  * @param {Object} params.rpc rpc settings
120
120
  * @param {Object.<string, string>} params.rpc.headers rpc headers
121
- * @returns {SuiClient}
121
+ * @returns {SuiJsonRpcClient}
122
122
  */
123
123
  static suiClientForRPC(params = {}) {
124
124
  const providerName = params.providerName || params.chainname || params.chain;
125
125
  delete params.providerName;
126
- delete params.chainName;
126
+ delete params.chainname;
127
127
  delete params.chain;
128
128
  params.WebSocketConstructor = SuiUtils.WebSocketConstructor();
129
129
 
130
- const transport = new SuiHTTPTransport(params);
131
- const client = new SuiClient({ transport: transport });
130
+ const transport = new JsonRpcHTTPTransport(params);
131
+ const client = new SuiJsonRpcClient({ transport: transport });
132
132
 
133
133
  client.providerName = providerName;
134
134
 
@@ -136,27 +136,30 @@ export default class SuiUtils extends SuiCommonMethods {
136
136
  }
137
137
 
138
138
  /**
139
- * Makes an instance for SuiClient for a specific chain, eg: 'mainnet'
139
+ * Makes an instance for SuiJsonRpcClient for a specific chain, eg: 'mainnet'
140
140
  * @param {string} chainname
141
- * @returns {SuiClient}
141
+ * @returns {SuiJsonRpcClient}
142
142
  */
143
143
  static suiClientFor(chainname) {
144
- return new SuiClient({
145
- transport: new SuiHTTPTransport({
146
- url: getFullnodeUrl(chainname),
144
+ const normalizedChainname = (''+chainname).toLowerCase().split('sui:').join('');
145
+ const client = new SuiJsonRpcClient({
146
+ transport: new JsonRpcHTTPTransport({
147
+ url: getJsonRpcFullnodeUrl(normalizedChainname),
147
148
  WebSocketConstructor: SuiUtils.WebSocketConstructor(),
148
149
  }),
149
150
  });
151
+ client.providerName = 'sui:'+normalizedChainname;
152
+ return client;
150
153
  }
151
154
 
152
155
  /**
153
- * Normalize SuiClient parameter, accepting:
156
+ * Normalize SuiJsonRpcClient parameter, accepting:
154
157
  * - different previous versions of sui.js library,
155
- * - object of SuiClient class
158
+ * - object of SuiJsonRpcClient class
156
159
  * - object of SuiLocalTestValidator class
157
160
  * - string of the chain name to connect to
158
161
  *
159
- * @returns {SuiClient}
162
+ * @returns {SuiJsonRpcClient}
160
163
  */
161
164
  static normalizeClient(clientParam) {
162
165
  let client = null;
@@ -194,7 +197,7 @@ export default class SuiUtils extends SuiCommonMethods {
194
197
 
195
198
  if (clientParam.providerName) {
196
199
  providerName = clientParam.providerName;
197
- if (['devnet', 'mainnet', 'testnet', 'localnet'].indexOf(clientParam.providerName) != -1) {
200
+ if (['devnet', 'mainnet', 'testnet', 'localnet'].indexOf(clientParam.providerName) !== -1) {
198
201
  providerName = 'sui:'+clientParam.providerName; // no prefix - add prefix
199
202
  }
200
203
  } else if (url.indexOf('devnet') !== -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suidouble",
3
- "version": "1.45.0",
3
+ "version": "2.5.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,15 +22,15 @@
22
22
  "author": "suidouble (https://github.com/suidouble)",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@mysten/bcs": "^1.9.2",
26
- "@mysten/sui": "^1.45.0",
27
- "@polymedia/coinmeta": "^0.0.17",
25
+ "@mysten/bcs": "^2.0.2",
26
+ "@mysten/sui": "^2.5.0",
27
+ "@polymedia/coinmeta": "^0.0.24",
28
28
  "@scure/bip39": "^1.6.0",
29
29
  "@wallet-standard/core": "^1.1.1",
30
30
  "websocket": "^1.0.35"
31
31
  },
32
32
  "devDependencies": {
33
- "tap": "^21.1.0"
33
+ "tap": "^21.5.0"
34
34
  },
35
35
  "browser": {
36
36
  "child_process": false,
@@ -1,26 +1,23 @@
1
- # @generated by Move, please check-in and do not edit manually.
1
+ # Generated by move; do not edit
2
+ # This file should be checked in.
2
3
 
3
4
  [move]
4
- version = 3
5
- manifest_digest = "782E5DC5571D50504E8D0062C1C45607FF5A73378BE161077BCEF58ADEC1A3F5"
6
- deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
7
- dependencies = [
8
- { id = "Sui", name = "Sui" },
9
- ]
5
+ version = 4
10
6
 
11
- [[move.package]]
12
- id = "MoveStdlib"
13
- source = { git = "https://github.com/MystenLabs/sui.git", rev = "testnet", subdir = "crates/sui-framework/packages/move-stdlib" }
7
+ [pinned.mainnet.MoveStdlib]
8
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "d4a0c80be6020093592b305853832e7b80c5e2f2" }
9
+ use_environment = "mainnet"
10
+ manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
11
+ deps = {}
14
12
 
15
- [[move.package]]
16
- id = "Sui"
17
- source = { git = "https://github.com/MystenLabs/sui.git", rev = "testnet", subdir = "crates/sui-framework/packages/sui-framework" }
13
+ [pinned.mainnet.Sui]
14
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "d4a0c80be6020093592b305853832e7b80c5e2f2" }
15
+ use_environment = "mainnet"
16
+ manifest_digest = "CD547CB1ACCE0880C835DAED2D8FFCB91D56C833AE5240D3AA5B918398263195"
17
+ deps = { MoveStdlib = "MoveStdlib" }
18
18
 
19
- dependencies = [
20
- { id = "MoveStdlib", name = "MoveStdlib" },
21
- ]
22
-
23
- [move.toolchain-version]
24
- compiler-version = "1.44.2"
25
- edition = "2024.beta"
26
- flavor = "sui"
19
+ [pinned.mainnet.different_types]
20
+ source = { root = true }
21
+ use_environment = "mainnet"
22
+ manifest_digest = "EC6E90369603CE16A65E2F7B784DCFCA80948E3C176AD82DC6EB101BAA942A89"
23
+ deps = { Sui = "Sui" }
@@ -27,25 +27,25 @@ module different_types::different_types {
27
27
  })
28
28
  }
29
29
 
30
- public entry fun put_u8(store: &mut Store, value: u8, _ctx: &mut TxContext) {
30
+ public fun put_u8(store: &mut Store, value: u8, _ctx: &mut TxContext) {
31
31
  store.numbers = store.numbers + (value as u256);
32
32
  }
33
- public entry fun put_u16(store: &mut Store, value: u16, _ctx: &mut TxContext) {
33
+ public fun put_u16(store: &mut Store, value: u16, _ctx: &mut TxContext) {
34
34
  store.numbers = store.numbers + (value as u256);
35
35
  }
36
- public entry fun put_u32(store: &mut Store, value: u32, _ctx: &mut TxContext) {
36
+ public fun put_u32(store: &mut Store, value: u32, _ctx: &mut TxContext) {
37
37
  store.numbers = store.numbers + (value as u256);
38
38
  }
39
- public entry fun put_u64(store: &mut Store, value: u64, _ctx: &mut TxContext) {
39
+ public fun put_u64(store: &mut Store, value: u64, _ctx: &mut TxContext) {
40
40
  store.numbers = store.numbers + (value as u256);
41
41
  }
42
- public entry fun put_u128(store: &mut Store, value: u128, _ctx: &mut TxContext) {
42
+ public fun put_u128(store: &mut Store, value: u128, _ctx: &mut TxContext) {
43
43
  store.numbers = store.numbers + (value as u256);
44
44
  }
45
- public entry fun put_u256(store: &mut Store, value: u256, _ctx: &mut TxContext) {
45
+ public fun put_u256(store: &mut Store, value: u256, _ctx: &mut TxContext) {
46
46
  store.numbers = store.numbers + (value as u256);
47
47
  }
48
- public entry fun put_vector_u16(store: &mut Store, value: vector<u16>, _ctx: &mut TxContext) {
48
+ public fun put_vector_u16(store: &mut Store, value: vector<u16>, _ctx: &mut TxContext) {
49
49
  let vec_length = vector::length(&value);
50
50
  let mut i = 0;
51
51
  while (i < vec_length) {
@@ -54,18 +54,18 @@ module different_types::different_types {
54
54
  i = i + 1;
55
55
  };
56
56
  }
57
- public entry fun put_address(store: &mut Store, value: address, _ctx: &mut TxContext) {
57
+ public fun put_address(store: &mut Store, value: address, _ctx: &mut TxContext) {
58
58
  store.v_address = value;
59
59
  }
60
- public entry fun put_bool(store: &mut Store, value: bool, _ctx: &mut TxContext) {
60
+ public fun put_bool(store: &mut Store, value: bool, _ctx: &mut TxContext) {
61
61
  store.v_bool = value;
62
62
  }
63
- public entry fun put_string(store: &mut Store, value: String, _ctx: &mut TxContext) {
63
+ public fun put_string(store: &mut Store, value: String, _ctx: &mut TxContext) {
64
64
  store.v_string = value;
65
65
  }
66
66
 
67
- public entry fun put_type<T>(store: &mut Store, _ctx: &mut TxContext) {
68
- let typen = type_name::get<T>();
67
+ public fun put_type<T>(store: &mut Store, _ctx: &mut TxContext) {
68
+ let typen = type_name::with_defining_ids<T>();
69
69
  let type_as_string = typen.into_string(); // returns ascii string
70
70
 
71
71
  store.v_string = string::from_ascii(type_as_string);
@@ -1,27 +1,23 @@
1
- # @generated by Move, please check-in and do not edit manually.
1
+ # Generated by move; do not edit
2
+ # This file should be checked in.
2
3
 
3
4
  [move]
4
- version = 3
5
- manifest_digest = "F8C73BB1CA5B2EEF078E6FD0C793EF387322A4AD49DECCFE6AAD9F5F81C198C8"
6
- deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
5
+ version = 4
7
6
 
8
- dependencies = [
9
- { id = "Sui", name = "Sui" },
10
- ]
7
+ [pinned.mainnet.MoveStdlib]
8
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "d4a0c80be6020093592b305853832e7b80c5e2f2" }
9
+ use_environment = "mainnet"
10
+ manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
11
+ deps = {}
11
12
 
12
- [[move.package]]
13
- id = "MoveStdlib"
14
- source = { git = "https://github.com/MystenLabs/sui.git", rev = "testnet", subdir = "crates/sui-framework/packages/move-stdlib" }
13
+ [pinned.mainnet.Sui]
14
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "d4a0c80be6020093592b305853832e7b80c5e2f2" }
15
+ use_environment = "mainnet"
16
+ manifest_digest = "CD547CB1ACCE0880C835DAED2D8FFCB91D56C833AE5240D3AA5B918398263195"
17
+ deps = { MoveStdlib = "MoveStdlib" }
15
18
 
16
- [[move.package]]
17
- id = "Sui"
18
- source = { git = "https://github.com/MystenLabs/sui.git", rev = "testnet", subdir = "crates/sui-framework/packages/sui-framework" }
19
-
20
- dependencies = [
21
- { id = "MoveStdlib", name = "MoveStdlib" },
22
- ]
23
-
24
- [move.toolchain-version]
25
- compiler-version = "1.44.2"
26
- edition = "2024"
27
- flavor = "sui"
19
+ [pinned.mainnet.suidouble_chat]
20
+ source = { root = true }
21
+ use_environment = "mainnet"
22
+ manifest_digest = "EC6E90369603CE16A65E2F7B784DCFCA80948E3C176AD82DC6EB101BAA942A89"
23
+ deps = { Sui = "Sui" }
@@ -93,7 +93,7 @@ module suidouble_chat::suidouble_chat {
93
93
  // }
94
94
 
95
95
  /// Mint (post) a ChatTopMessage object without referencing another object.
96
- public entry fun post(
96
+ public fun post(
97
97
  chat_shop: &ChatShop,
98
98
  text: vector<u8>,
99
99
  metadata: vector<u8>,
@@ -128,7 +128,7 @@ module suidouble_chat::suidouble_chat {
128
128
  }
129
129
 
130
130
  /// Mint (post) a ChatTopMessage object without referencing another object.
131
- public entry fun post_pay(
131
+ public fun post_pay(
132
132
  chat_shop: &mut ChatShop,
133
133
  sui: Coin<SUI>,
134
134
  text: vector<u8>,
@@ -169,7 +169,7 @@ module suidouble_chat::suidouble_chat {
169
169
  transfer::share_object(chat_top_message);
170
170
  }
171
171
 
172
- public entry fun post_pay_with_coin_vector(
172
+ public fun post_pay_with_coin_vector(
173
173
  chat_shop: &mut ChatShop,
174
174
  coins: vector<Coin<SUI>>,
175
175
  text: vector<u8>,
@@ -182,7 +182,8 @@ module suidouble_chat::suidouble_chat {
182
182
  }
183
183
 
184
184
  /// Mint (post) a ChatResponse object
185
- public entry fun reply(
185
+ #[allow(lint(self_transfer))]
186
+ public fun reply(
186
187
  chat_top_message: &mut ChatTopMessage,
187
188
  text: vector<u8>,
188
189
  metadata: vector<u8>,
@@ -215,7 +216,7 @@ module suidouble_chat::suidouble_chat {
215
216
  }
216
217
 
217
218
  /// Permanently delete `ChatResponse`
218
- public entry fun burn_response(chat_response: ChatResponse, _: &mut TxContext) {
219
+ public fun burn_response(chat_response: ChatResponse, _: &mut TxContext) {
219
220
  let ChatResponse { id, chat_top_message_id: _, author: _, text: _, metadata: _, seq_n: _ } = chat_response;
220
221
  object::delete(id)
221
222
  }
@@ -260,7 +261,8 @@ module suidouble_chat::suidouble_chat {
260
261
  // }
261
262
 
262
263
  /// Mint a lot of responses (we need this to unit test SuiPaginatedResponse faster)
263
- public entry fun fill(
264
+ #[allow(lint(self_transfer))]
265
+ public fun fill(
264
266
  chat_top_message: &mut ChatTopMessage,
265
267
  text: vector<u8>,
266
268
  metadata: vector<u8>,
@@ -336,7 +338,6 @@ module suidouble_chat::suidouble_chat {
336
338
  let chat_top_message = test_scenario::take_shared<ChatTopMessage>(scenario);
337
339
  // let chat_shop_ref = &chat_shop;
338
340
  debug::print(&chat_top_message);
339
- debug::print(&mut chat_top_message);
340
341
 
341
342
  // let chat_top_message_ref = &chat_top_message;
342
343
  reply(&mut chat_top_message, b"response", b"metadata", test_scenario::ctx(scenario));
@@ -368,7 +369,7 @@ module suidouble_chat::suidouble_chat {
368
369
  // let chat_top_message = test_scenario::take_from_sender<ChatTopMessage>(scenario);
369
370
  let chat_top_message = test_scenario::take_shared<ChatTopMessage>(scenario);
370
371
  // let chat_shop_ref = &chat_shop;
371
- debug::print(&mut chat_top_message);
372
+ debug::print(&chat_top_message);
372
373
 
373
374
  // let chat_top_message_ref = &chat_top_message;
374
375
  reply(&mut chat_top_message, b"response", b"metadata", test_scenario::ctx(scenario));