@mysten/sui 1.30.3 → 1.30.4

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui TypeScript API(Work in Progress)",
5
5
  "homepage": "https://sdk.mystenlabs.com",
6
- "version": "1.30.3",
6
+ "version": "1.30.4",
7
7
  "license": "Apache-2.0",
8
8
  "sideEffects": false,
9
9
  "files": [
@@ -154,6 +154,7 @@ export class JSONRpcTransport extends Experimental_CoreClient {
154
154
  showObjectChanges: true,
155
155
  showRawEffects: true,
156
156
  showEvents: true,
157
+ showEffects: true,
157
158
  },
158
159
  signal: options.signal,
159
160
  });
@@ -171,6 +172,7 @@ export class JSONRpcTransport extends Experimental_CoreClient {
171
172
  showEvents: true,
172
173
  showObjectChanges: true,
173
174
  showRawInput: true,
175
+ showEffects: true,
174
176
  },
175
177
  signal: options.signal,
176
178
  });
@@ -43,8 +43,16 @@ export type AsyncTransactionThunk<
43
43
  T extends TransactionResultArgument | void = TransactionResultArgument | void,
44
44
  > = (tx: Transaction) => Promise<T | void>;
45
45
 
46
- function createTransactionResult(index: number, length = Infinity): TransactionResult {
47
- const baseResult = { $kind: 'Result' as const, Result: index };
46
+ function createTransactionResult(
47
+ index: number | (() => number),
48
+ length = Infinity,
49
+ ): TransactionResult {
50
+ const baseResult = {
51
+ $kind: 'Result' as const,
52
+ get Result() {
53
+ return typeof index === 'function' ? index() : index;
54
+ },
55
+ };
48
56
 
49
57
  const nestedResults: {
50
58
  $kind: 'NestedResult';
@@ -58,7 +66,9 @@ function createTransactionResult(index: number, length = Infinity): TransactionR
58
66
  } =>
59
67
  (nestedResults[resultIndex] ??= {
60
68
  $kind: 'NestedResult' as const,
61
- NestedResult: [index, resultIndex],
69
+ get NestedResult() {
70
+ return [typeof index === 'function' ? index() : index, resultIndex] as [number, number];
71
+ },
62
72
  });
63
73
 
64
74
  return new Proxy(baseResult, {
@@ -454,6 +464,7 @@ export class Transaction {
454
464
  name: 'AsyncTransactionThunk',
455
465
  inputs: {},
456
466
  data: {
467
+ resultIndex: this.#data.commands.length,
457
468
  result: null as TransactionResult | null,
458
469
  },
459
470
  },
@@ -464,7 +475,7 @@ export class Transaction {
464
475
  placeholder.$Intent.data.result = result;
465
476
  }),
466
477
  );
467
- const txResult = createTransactionResult(this.#data.commands.length - 1);
478
+ const txResult = createTransactionResult(() => placeholder.$Intent.data.resultIndex);
468
479
  this.#added.set(command, txResult);
469
480
  return txResult;
470
481
  } else {
@@ -815,6 +826,16 @@ export class Transaction {
815
826
 
816
827
  return arg;
817
828
  });
829
+
830
+ for (const [i, cmd] of unorderedCommands.entries()) {
831
+ if (cmd.$Intent?.name === 'AsyncTransactionThunk') {
832
+ try {
833
+ cmd.$Intent.data.resultIndex = getOriginalIndex(i);
834
+ } catch (e) {
835
+ // If async thunk did not return a result, this will error, but is safe to ignore
836
+ }
837
+ }
838
+ }
818
839
  }
819
840
 
820
841
  async prepareForSerialization(options: SerializeTransactionOptions) {
package/src/version.ts CHANGED
@@ -3,5 +3,5 @@
3
3
 
4
4
  // This file is generated by genversion.mjs. Do not edit it directly.
5
5
 
6
- export const PACKAGE_VERSION = '1.30.3';
6
+ export const PACKAGE_VERSION = '1.30.4';
7
7
  export const TARGETED_RPC_VERSION = '1.50.0';