@mysten/sui
Advanced tools
Comparing version 0.0.0-experimental-20240717170421 to 0.0.0-experimental-20240717170531
# @mysten/sui.js | ||
## 0.0.0-experimental-20240717170421 | ||
## 0.0.0-experimental-20240717170531 | ||
### Minor Changes | ||
- 086b2bc: Add waitForLastTransaction methods to all executor classes | ||
- cdedf69: Add Argument helpers for constructing transaction arguments without a Transaction | ||
@@ -17,3 +18,3 @@ instance | ||
- Updated dependencies [0f27a97] | ||
- @mysten/bcs@0.0.0-experimental-20240717170421 | ||
- @mysten/bcs@0.0.0-experimental-20240717170531 | ||
@@ -20,0 +21,0 @@ ## 1.2.1 |
@@ -30,2 +30,3 @@ import { bcs } from '../../bcs/index.js'; | ||
applyEffects(effects: typeof bcs.TransactionEffects.$inferType): Promise<void>; | ||
waitForLastTransaction(): Promise<void>; | ||
} |
@@ -34,3 +34,3 @@ "use strict"; | ||
var import_Transaction = require("../Transaction.js"); | ||
var _client; | ||
var _client, _lastDigest; | ||
class CachingTransactionExecutor { | ||
@@ -42,2 +42,3 @@ constructor({ | ||
__privateAdd(this, _client); | ||
__privateAdd(this, _lastDigest, null); | ||
__privateSet(this, _client, client); | ||
@@ -51,4 +52,7 @@ this.cache = new import_ObjectCache.ObjectCache(options); | ||
async reset() { | ||
await this.cache.clearOwnedObjects(); | ||
await this.cache.clearCustom(); | ||
await Promise.all([ | ||
this.cache.clearOwnedObjects(), | ||
this.cache.clearCustom(), | ||
this.waitForLastTransaction() | ||
]); | ||
} | ||
@@ -101,6 +105,14 @@ async buildTransaction({ | ||
async applyEffects(effects) { | ||
__privateSet(this, _lastDigest, effects.V2?.transactionDigest ?? null); | ||
await this.cache.applyEffects(effects); | ||
} | ||
async waitForLastTransaction() { | ||
if (__privateGet(this, _lastDigest)) { | ||
await __privateGet(this, _client).waitForTransaction({ digest: __privateGet(this, _lastDigest) }); | ||
__privateSet(this, _lastDigest, null); | ||
} | ||
} | ||
} | ||
_client = new WeakMap(); | ||
_lastDigest = new WeakMap(); | ||
//# sourceMappingURL=caching.js.map |
@@ -31,2 +31,3 @@ import type { SuiClient } from '../../client/index.js'; | ||
resetCache(): Promise<void>; | ||
waitForLastTransaction(): Promise<void>; | ||
executeTransaction(transaction: Transaction): Promise<{ | ||
@@ -33,0 +34,0 @@ digest: string; |
@@ -95,2 +95,5 @@ "use strict"; | ||
} | ||
async waitForLastTransaction() { | ||
await __privateMethod(this, _ParallelTransactionExecutor_instances, updateCache_fn).call(this, () => __privateMethod(this, _ParallelTransactionExecutor_instances, waitForLastDigest_fn).call(this)); | ||
} | ||
async executeTransaction(transaction) { | ||
@@ -349,3 +352,3 @@ const { promise, resolve, reject } = promiseWithResolvers(); | ||
txb.transferObjects(coinResults, address); | ||
await __privateMethod(this, _ParallelTransactionExecutor_instances, updateCache_fn).call(this, () => __privateMethod(this, _ParallelTransactionExecutor_instances, waitForLastDigest_fn).call(this)); | ||
await this.waitForLastTransaction(); | ||
const result = await __privateGet(this, _client).signAndExecuteTransaction({ | ||
@@ -352,0 +355,0 @@ transaction: txb, |
@@ -14,3 +14,4 @@ import { bcs } from '../../bcs/index.js'; | ||
buildTransaction(transaction: Transaction): Promise<Uint8Array>; | ||
resetCache(): Promise<[void, void]>; | ||
resetCache(): Promise<void>; | ||
waitForLastTransaction(): Promise<void>; | ||
executeTransaction(transaction: Transaction | Uint8Array): Promise<{ | ||
@@ -17,0 +18,0 @@ digest: string; |
@@ -26,3 +26,2 @@ "use strict"; | ||
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); | ||
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); | ||
var serial_exports = {}; | ||
@@ -39,3 +38,3 @@ __export(serial_exports, { | ||
var import_queue = require("./queue.js"); | ||
var _queue, _signer, _cache, _client, _lastDigest, _cacheGasCoin, _buildTransaction, _SerialTransactionExecutor_instances, waitForLastTransaction_fn; | ||
var _queue, _signer, _cache, _cacheGasCoin, _buildTransaction; | ||
class SerialTransactionExecutor { | ||
@@ -46,8 +45,5 @@ constructor({ | ||
}) { | ||
__privateAdd(this, _SerialTransactionExecutor_instances); | ||
__privateAdd(this, _queue, new import_queue.SerialQueue()); | ||
__privateAdd(this, _signer); | ||
__privateAdd(this, _cache); | ||
__privateAdd(this, _client); | ||
__privateAdd(this, _lastDigest, null); | ||
__privateAdd(this, _cacheGasCoin, async (effects) => { | ||
@@ -74,3 +70,2 @@ if (!effects.V2) { | ||
__privateSet(this, _signer, signer); | ||
__privateSet(this, _client, options.client); | ||
__privateSet(this, _cache, new import_caching.CachingTransactionExecutor({ | ||
@@ -88,4 +83,7 @@ client: options.client, | ||
resetCache() { | ||
return Promise.all([__privateGet(this, _cache).reset(), __privateMethod(this, _SerialTransactionExecutor_instances, waitForLastTransaction_fn).call(this)]); | ||
return __privateGet(this, _cache).reset(); | ||
} | ||
waitForLastTransaction() { | ||
return __privateGet(this, _cache).waitForLastTransaction(); | ||
} | ||
executeTransaction(transaction) { | ||
@@ -105,3 +103,2 @@ return __privateGet(this, _queue).runTask(async () => { | ||
await this.applyEffects(effects); | ||
__privateSet(this, _lastDigest, results.digest); | ||
return { | ||
@@ -117,13 +114,4 @@ digest: results.digest, | ||
_cache = new WeakMap(); | ||
_client = new WeakMap(); | ||
_lastDigest = new WeakMap(); | ||
_cacheGasCoin = new WeakMap(); | ||
_buildTransaction = new WeakMap(); | ||
_SerialTransactionExecutor_instances = new WeakSet(); | ||
waitForLastTransaction_fn = async function() { | ||
if (__privateGet(this, _lastDigest)) { | ||
await __privateGet(this, _client).waitForTransaction({ digest: __privateGet(this, _lastDigest) }); | ||
__privateSet(this, _lastDigest, null); | ||
} | ||
}; | ||
function getGasCoinFromEffects(effects) { | ||
@@ -130,0 +118,0 @@ if (!effects.V2) { |
@@ -1,2 +0,2 @@ | ||
export declare const PACKAGE_VERSION = "0.0.0-experimental-20240717170421"; | ||
export declare const PACKAGE_VERSION = "0.0.0-experimental-20240717170531"; | ||
export declare const TARGETED_RPC_VERSION = "1.30.0"; |
@@ -25,4 +25,4 @@ "use strict"; | ||
module.exports = __toCommonJS(version_exports); | ||
const PACKAGE_VERSION = "0.0.0-experimental-20240717170421"; | ||
const PACKAGE_VERSION = "0.0.0-experimental-20240717170531"; | ||
const TARGETED_RPC_VERSION = "1.30.0"; | ||
//# sourceMappingURL=version.js.map |
@@ -30,2 +30,3 @@ import { bcs } from '../../bcs/index.js'; | ||
applyEffects(effects: typeof bcs.TransactionEffects.$inferType): Promise<void>; | ||
waitForLastTransaction(): Promise<void>; | ||
} |
@@ -8,3 +8,3 @@ var __typeError = (msg) => { | ||
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); | ||
var _client; | ||
var _client, _lastDigest; | ||
import { bcs } from "../../bcs/index.js"; | ||
@@ -19,2 +19,3 @@ import { ObjectCache } from "../ObjectCache.js"; | ||
__privateAdd(this, _client); | ||
__privateAdd(this, _lastDigest, null); | ||
__privateSet(this, _client, client); | ||
@@ -28,4 +29,7 @@ this.cache = new ObjectCache(options); | ||
async reset() { | ||
await this.cache.clearOwnedObjects(); | ||
await this.cache.clearCustom(); | ||
await Promise.all([ | ||
this.cache.clearOwnedObjects(), | ||
this.cache.clearCustom(), | ||
this.waitForLastTransaction() | ||
]); | ||
} | ||
@@ -78,6 +82,14 @@ async buildTransaction({ | ||
async applyEffects(effects) { | ||
__privateSet(this, _lastDigest, effects.V2?.transactionDigest ?? null); | ||
await this.cache.applyEffects(effects); | ||
} | ||
async waitForLastTransaction() { | ||
if (__privateGet(this, _lastDigest)) { | ||
await __privateGet(this, _client).waitForTransaction({ digest: __privateGet(this, _lastDigest) }); | ||
__privateSet(this, _lastDigest, null); | ||
} | ||
} | ||
} | ||
_client = new WeakMap(); | ||
_lastDigest = new WeakMap(); | ||
export { | ||
@@ -84,0 +96,0 @@ CachingTransactionExecutor |
@@ -31,2 +31,3 @@ import type { SuiClient } from '../../client/index.js'; | ||
resetCache(): Promise<void>; | ||
waitForLastTransaction(): Promise<void>; | ||
executeTransaction(transaction: Transaction): Promise<{ | ||
@@ -33,0 +34,0 @@ digest: string; |
@@ -72,2 +72,5 @@ var __typeError = (msg) => { | ||
} | ||
async waitForLastTransaction() { | ||
await __privateMethod(this, _ParallelTransactionExecutor_instances, updateCache_fn).call(this, () => __privateMethod(this, _ParallelTransactionExecutor_instances, waitForLastDigest_fn).call(this)); | ||
} | ||
async executeTransaction(transaction) { | ||
@@ -326,3 +329,3 @@ const { promise, resolve, reject } = promiseWithResolvers(); | ||
txb.transferObjects(coinResults, address); | ||
await __privateMethod(this, _ParallelTransactionExecutor_instances, updateCache_fn).call(this, () => __privateMethod(this, _ParallelTransactionExecutor_instances, waitForLastDigest_fn).call(this)); | ||
await this.waitForLastTransaction(); | ||
const result = await __privateGet(this, _client).signAndExecuteTransaction({ | ||
@@ -329,0 +332,0 @@ transaction: txb, |
@@ -14,3 +14,4 @@ import { bcs } from '../../bcs/index.js'; | ||
buildTransaction(transaction: Transaction): Promise<Uint8Array>; | ||
resetCache(): Promise<[void, void]>; | ||
resetCache(): Promise<void>; | ||
waitForLastTransaction(): Promise<void>; | ||
executeTransaction(transaction: Transaction | Uint8Array): Promise<{ | ||
@@ -17,0 +18,0 @@ digest: string; |
@@ -8,4 +8,3 @@ var __typeError = (msg) => { | ||
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); | ||
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method); | ||
var _queue, _signer, _cache, _client, _lastDigest, _cacheGasCoin, _buildTransaction, _SerialTransactionExecutor_instances, waitForLastTransaction_fn; | ||
var _queue, _signer, _cache, _cacheGasCoin, _buildTransaction; | ||
import { toB64 } from "@mysten/bcs"; | ||
@@ -21,8 +20,5 @@ import { bcs } from "../../bcs/index.js"; | ||
}) { | ||
__privateAdd(this, _SerialTransactionExecutor_instances); | ||
__privateAdd(this, _queue, new SerialQueue()); | ||
__privateAdd(this, _signer); | ||
__privateAdd(this, _cache); | ||
__privateAdd(this, _client); | ||
__privateAdd(this, _lastDigest, null); | ||
__privateAdd(this, _cacheGasCoin, async (effects) => { | ||
@@ -49,3 +45,2 @@ if (!effects.V2) { | ||
__privateSet(this, _signer, signer); | ||
__privateSet(this, _client, options.client); | ||
__privateSet(this, _cache, new CachingTransactionExecutor({ | ||
@@ -63,4 +58,7 @@ client: options.client, | ||
resetCache() { | ||
return Promise.all([__privateGet(this, _cache).reset(), __privateMethod(this, _SerialTransactionExecutor_instances, waitForLastTransaction_fn).call(this)]); | ||
return __privateGet(this, _cache).reset(); | ||
} | ||
waitForLastTransaction() { | ||
return __privateGet(this, _cache).waitForLastTransaction(); | ||
} | ||
executeTransaction(transaction) { | ||
@@ -80,3 +78,2 @@ return __privateGet(this, _queue).runTask(async () => { | ||
await this.applyEffects(effects); | ||
__privateSet(this, _lastDigest, results.digest); | ||
return { | ||
@@ -92,13 +89,4 @@ digest: results.digest, | ||
_cache = new WeakMap(); | ||
_client = new WeakMap(); | ||
_lastDigest = new WeakMap(); | ||
_cacheGasCoin = new WeakMap(); | ||
_buildTransaction = new WeakMap(); | ||
_SerialTransactionExecutor_instances = new WeakSet(); | ||
waitForLastTransaction_fn = async function() { | ||
if (__privateGet(this, _lastDigest)) { | ||
await __privateGet(this, _client).waitForTransaction({ digest: __privateGet(this, _lastDigest) }); | ||
__privateSet(this, _lastDigest, null); | ||
} | ||
}; | ||
function getGasCoinFromEffects(effects) { | ||
@@ -105,0 +93,0 @@ if (!effects.V2) { |
@@ -1,2 +0,2 @@ | ||
export declare const PACKAGE_VERSION = "0.0.0-experimental-20240717170421"; | ||
export declare const PACKAGE_VERSION = "0.0.0-experimental-20240717170531"; | ||
export declare const TARGETED_RPC_VERSION = "1.30.0"; |
@@ -1,2 +0,2 @@ | ||
const PACKAGE_VERSION = "0.0.0-experimental-20240717170421"; | ||
const PACKAGE_VERSION = "0.0.0-experimental-20240717170531"; | ||
const TARGETED_RPC_VERSION = "1.30.0"; | ||
@@ -3,0 +3,0 @@ export { |
@@ -6,3 +6,3 @@ { | ||
"homepage": "https://sdk.mystenlabs.com", | ||
"version": "0.0.0-experimental-20240717170421", | ||
"version": "0.0.0-experimental-20240717170531", | ||
"license": "Apache-2.0", | ||
@@ -136,3 +136,3 @@ "sideEffects": false, | ||
"valibot": "^0.36.0", | ||
"@mysten/bcs": "0.0.0-experimental-20240717170421" | ||
"@mysten/bcs": "0.0.0-experimental-20240717170531" | ||
}, | ||
@@ -139,0 +139,0 @@ "scripts": { |
@@ -15,2 +15,3 @@ // Copyright (c) Mysten Labs, Inc. | ||
#client: SuiClient; | ||
#lastDigest: string | null = null; | ||
cache: ObjectCache; | ||
@@ -33,4 +34,7 @@ | ||
async reset() { | ||
await this.cache.clearOwnedObjects(); | ||
await this.cache.clearCustom(); | ||
await Promise.all([ | ||
this.cache.clearOwnedObjects(), | ||
this.cache.clearCustom(), | ||
this.waitForLastTransaction(), | ||
]); | ||
} | ||
@@ -99,4 +103,12 @@ | ||
async applyEffects(effects: typeof bcs.TransactionEffects.$inferType) { | ||
this.#lastDigest = effects.V2?.transactionDigest ?? null; | ||
await this.cache.applyEffects(effects); | ||
} | ||
async waitForLastTransaction() { | ||
if (this.#lastDigest) { | ||
await this.#client.waitForTransaction({ digest: this.#lastDigest }); | ||
this.#lastDigest = null; | ||
} | ||
} | ||
} |
@@ -103,2 +103,6 @@ // Copyright (c) Mysten Labs, Inc. | ||
async waitForLastTransaction() { | ||
await this.#updateCache(() => this.#waitForLastDigest()); | ||
} | ||
async executeTransaction(transaction: Transaction) { | ||
@@ -408,3 +412,3 @@ const { promise, resolve, reject } = promiseWithResolvers<{ | ||
await this.#updateCache(() => this.#waitForLastDigest()); | ||
await this.waitForLastTransaction(); | ||
@@ -411,0 +415,0 @@ const result = await this.#client.signAndExecuteTransaction({ |
@@ -18,4 +18,2 @@ // Copyright (c) Mysten Labs, Inc. | ||
#cache: CachingTransactionExecutor; | ||
#client: SuiClient; | ||
#lastDigest: string | null = null; | ||
@@ -30,3 +28,2 @@ constructor({ | ||
this.#signer = signer; | ||
this.#client = options.client; | ||
this.#cache = new CachingTransactionExecutor({ | ||
@@ -77,10 +74,7 @@ client: options.client, | ||
resetCache() { | ||
return Promise.all([this.#cache.reset(), this.#waitForLastTransaction()]); | ||
return this.#cache.reset(); | ||
} | ||
async #waitForLastTransaction() { | ||
if (this.#lastDigest) { | ||
await this.#client.waitForTransaction({ digest: this.#lastDigest }); | ||
this.#lastDigest = null; | ||
} | ||
waitForLastTransaction() { | ||
return this.#cache.waitForLastTransaction(); | ||
} | ||
@@ -108,3 +102,2 @@ | ||
await this.applyEffects(effects); | ||
this.#lastDigest = results.digest; | ||
@@ -111,0 +104,0 @@ return { |
@@ -6,3 +6,3 @@ // Copyright (c) Mysten Labs, Inc. | ||
export const PACKAGE_VERSION = '0.0.0-experimental-20240717170421'; | ||
export const PACKAGE_VERSION = '0.0.0-experimental-20240717170531'; | ||
export const TARGETED_RPC_VERSION = '1.30.0'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5254843
89231
+ Added@mysten/bcs@0.0.0-experimental-20240717170531(transitive)
- Removed@mysten/bcs@0.0.0-experimental-20240717170421(transitive)