Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions chain-test/src/unit/TestChaincodeStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,13 @@ export class TestChaincodeStub extends ChaincodeStub {
message: "This is a test success response"
};
}

public startWriteBatch(): void {
// This is a mock, so we don't need to do anything here.
}

public async finishWriteBatch(): Promise<void> {
// This is a mock, so we don't need to do anything here.
return Promise.resolve();
}
}
2 changes: 2 additions & 0 deletions chain-test/src/unit/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ type GalaChainStub = ChaincodeStub & {
getCachedState(key: string): Promise<Uint8Array>;
getCachedStateByPartialCompositeKey(objectType: string, attributes: string[]): FabricIterable<CachedKV>;
flushWrites(): Promise<void>;
startWriteBatch(): void;
finishWriteBatch(): Promise<void>;
getReads(): Record<string, Uint8Array>;
getWrites(): Record<string, Uint8Array>;
getWritesCount(): number;
Expand Down
22 changes: 22 additions & 0 deletions chaincode/src/types/GalaChainStub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,14 @@ class StubCache {
throw new NotImplementedError("Cannot flush writes in read-only mode");
}

this.startWriteBatch();

const deleteOps = Object.keys(this.deletes).map((key) => this.stub.deleteState(key));
const putOps = Object.entries(this.writes).map(([key, value]) => this.stub.putState(key, value));
await Promise.all(deleteOps);
await Promise.all(putOps);

await this.finishWriteBatch();
}

getReads(): Record<string, Uint8Array> {
Expand Down Expand Up @@ -207,6 +211,20 @@ class StubCache {
setDeletes(deletes: Record<string, true>): void {
this.deletes = { ...deletes };
}

startWriteBatch(): void {
const stub = this.stub as unknown as { handler: { startWriteBatch: () => void } };
if (stub.handler && typeof stub.handler.startWriteBatch === "function") {
stub.handler.startWriteBatch();
}
}

async finishWriteBatch(): Promise<void> {
const stub = this.stub as unknown as { handler: { finishWriteBatch: () => Promise<void> } };
if (stub.handler && typeof stub.handler.finishWriteBatch === "function") {
await stub.handler.finishWriteBatch();
}
}
}

export class DuplicateInvokeChaincodeError extends NotImplementedError {
Expand All @@ -225,6 +243,10 @@ export interface GalaChainStub extends ChaincodeStub {

flushWrites(): Promise<void>;

startWriteBatch(): void;

finishWriteBatch(): Promise<void>;

getReads(): Record<string, Uint8Array>;

getWrites(): Record<string, Uint8Array>;
Expand Down
13 changes: 1 addition & 12 deletions licenses/licenses.csv
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@
"@swc/[email protected]","@swc/counter","0.1.3","https://github.com/swc-project/pkgs","Downloade counter for the swc project","Apache-2.0"
"@swc/[email protected]","@swc/helpers","0.5.11","https://github.com/swc-project/swc","External helpers for the swc project.","Apache-2.0"
"@swc/[email protected]","@swc/types","0.1.12","https://github.com/swc-project/swc","Typings for the swc project.","Apache-2.0"
"@swc/[email protected].5","@swc/wasm","1.5.5","https://github.com/swc-project/swc","wasm module for swc","Apache-2.0"
"@swc/[email protected].29","@swc/wasm","1.5.29","https://github.com/swc-project/swc","wasm module for swc","Apache-2.0"
"@szmarczak/[email protected]","@szmarczak/http-timer","5.0.1","https://github.com/szmarczak/http-timer","Timings for HTTP requests","MIT"
"@ton/[email protected]","@ton/core","0.57.0","https://github.com/ton-org/ton-core","Core TypeScript library that implements low level primitives for TON blockchain.","MIT"
"@ton/[email protected]","@ton/crypto-primitives","2.1.0","https://github.com/ton-org/ton-crypto-primitives","Cross-platform crypto primitives for building apps for TON blockchain. For internal implementation of `@ton/crypto`.","MIT"
Expand Down Expand Up @@ -420,11 +420,6 @@
"@typescript-eslint/[email protected]","@typescript-eslint/visitor-keys","6.13.2","https://github.com/typescript-eslint/typescript-eslint","Visitor keys used to help traverse the TypeScript-ESTree AST","MIT"
"@typescript-eslint/[email protected]","@typescript-eslint/visitor-keys","7.18.0","https://github.com/typescript-eslint/typescript-eslint","Visitor keys used to help traverse the TypeScript-ESTree AST","MIT"
"@ungap/[email protected]","@ungap/structured-clone","1.2.0","https://github.com/ungap/structured-clone","A structuredClone polyfill","ISC"
"@vue/[email protected]","@vue/compiler-core","3.4.38","https://github.com/vuejs/core","@vue/compiler-core","MIT"
"@vue/[email protected]","@vue/compiler-dom","3.4.38","https://github.com/vuejs/core","@vue/compiler-dom","MIT"
"@vue/[email protected]","@vue/compiler-sfc","3.4.38","https://github.com/vuejs/core","@vue/compiler-sfc","MIT"
"@vue/[email protected]","@vue/compiler-ssr","3.4.38","https://github.com/vuejs/core","@vue/compiler-ssr","MIT"
"@vue/[email protected]","@vue/shared","3.4.38","https://github.com/vuejs/core","internal utils shared across @vue packages","MIT"
"@yarnpkg/[email protected]","@yarnpkg/lockfile","1.1.0","https://github.com/yarnpkg/yarn/blob/master/packages/lockfile","The parser/stringifier for Yarn lockfiles.","BSD-2-Clause"
"@yarnpkg/[email protected]","@yarnpkg/parsers","3.0.0-rc.46","https://github.com/yarnpkg/berry","","BSD-2-Clause"
"@zkochan/[email protected]","@zkochan/js-yaml","0.0.7","https://github.com/nodeca/js-yaml","YAML 1.2 parser and serializer","MIT"
Expand Down Expand Up @@ -475,7 +470,6 @@
"[email protected]","babel-plugin-istanbul","6.1.1","https://github.com/istanbuljs/babel-plugin-istanbul","A babel plugin that adds istanbul instrumentation to ES6 code","BSD-3-Clause"
"[email protected]","babel-plugin-jest-hoist","29.6.3","https://github.com/jestjs/jest","Babel plugin to hoist `jest.disableAutomock`, `jest.enableAutomock`, `jest.unmock`, `jest.mock`, calls above `import` statements. This plugin is automatically included when using [babel-jest](https://github.com/jestjs/jest/tree/main/packages/babel-jest).","MIT"
"[email protected]","babel-plugin-macros","2.8.0","https://github.com/kentcdodds/babel-plugin-macros","Allows you to build compile-time libraries","MIT"
"[email protected]","babel-plugin-macros","3.1.0","https://github.com/kentcdodds/babel-plugin-macros","Allows you to build compile-time libraries","MIT"
"[email protected]","babel-plugin-polyfill-corejs2","0.4.11","https://github.com/babel/babel-polyfills","A Babel plugin to inject imports to core-js@2 polyfills","MIT"
"[email protected]","babel-plugin-polyfill-corejs3","0.10.4","https://github.com/babel/babel-polyfills","A Babel plugin to inject imports to core-js@3 polyfills","MIT"
"[email protected]","babel-plugin-polyfill-regenerator","0.6.2","https://github.com/babel/babel-polyfills","A Babel plugin to inject imports to regenerator-runtime","MIT"
Expand Down Expand Up @@ -570,7 +564,6 @@
"[email protected]","core-js-compat","3.37.1","https://github.com/zloirock/core-js","core-js compat","MIT"
"[email protected]","corser","2.0.1","https://github.com/agrueneberg/Corser","A highly configurable, middleware compatible implementation of CORS.","MIT"
"[email protected]","cosmiconfig","6.0.0","https://github.com/davidtheclark/cosmiconfig","Find and load configuration from a package.json property, rc file, or CommonJS module","MIT"
"[email protected]","cosmiconfig","7.1.0","https://github.com/davidtheclark/cosmiconfig","Find and load configuration from a package.json property, rc file, or CommonJS module","MIT"
"[email protected]","create-jest","29.7.0","https://github.com/jestjs/jest","Create a new Jest project","MIT"
"[email protected]","create-require","1.1.1","https://github.com/nuxt-contrib/create-require","Polyfill for Node.js module.createRequire (<= v12.2.0)","MIT"
"[email protected]","cross-spawn","6.0.6","https://github.com/moxystudio/node-cross-spawn","Cross platform child_process#spawn and child_process#spawnSync","MIT"
Expand Down Expand Up @@ -681,7 +674,6 @@
"[email protected]","esrecurse","4.3.0","https://github.com/estools/esrecurse","ECMAScript AST recursive visitor","BSD-2-Clause"
"[email protected]","estraverse","4.3.0","https://github.com/estools/estraverse","ECMAScript JS AST traversal functions","BSD-2-Clause"
"[email protected]","estraverse","5.3.0","https://github.com/estools/estraverse","ECMAScript JS AST traversal functions","BSD-2-Clause"
"[email protected]","estree-walker","2.0.2","https://github.com/Rich-Harris/estree-walker","Traverse an ESTree-compliant AST","MIT"
"[email protected]","esutils","2.0.3","https://github.com/estools/esutils","utility box for ECMAScript language tools","BSD-2-Clause"
"[email protected]","ethers","6.13.2","https://github.com/ethers-io/ethers.js","A complete and compact Ethereum library, for dapps, wallets and any other tools.","MIT"
"[email protected]","eventemitter3","4.0.7","https://github.com/primus/eventemitter3","EventEmitter3 focuses on performance while maintaining a Node.js AND browser compatible interface.","MIT"
Expand Down Expand Up @@ -938,7 +930,6 @@
"[email protected]","lru-cache","5.1.1","https://github.com/isaacs/node-lru-cache","A cache object that deletes the least-recently-used items.","ISC"
"[email protected]","lunr","2.3.9","https://github.com/olivernn/lunr.js","Simple full-text search in your browser.","MIT"
"[email protected]","madge","5.0.2","https://github.com/pahen/madge","Create graphs from module dependencies.","MIT"
"[email protected]","magic-string","0.30.11","https://github.com/rich-harris/magic-string","Modify strings, generate sourcemaps","MIT"
"[email protected]","make-dir","3.1.0","https://github.com/sindresorhus/make-dir","Make a directory and its parents if needed - Think `mkdir -p`","MIT"
"[email protected]","make-dir","4.0.0","https://github.com/sindresorhus/make-dir","Make a directory and its parents if needed - Think `mkdir -p`","MIT"
"[email protected]","make-error","1.3.6","https://github.com/JsCommunity/make-error","Make your own error types!","ISC"
Expand Down Expand Up @@ -969,7 +960,6 @@
"[email protected]","multimap","1.1.0","https://github.com/villadora/multi-map","multi-map which allow multiple values for the same key","MIT"
"[email protected]","mute-stream","0.0.8","https://github.com/isaacs/mute-stream","Bytes go in, but they don't come out (when muted).","ISC"
"[email protected]","mute-stream","1.0.0","https://github.com/npm/mute-stream","Bytes go in, but they don't come out (when muted).","ISC"
"[email protected]","nan","2.18.0","https://github.com/nodejs/nan","Native Abstractions for Node.js: C++ header for Node 0.8 -> 20 compatibility","MIT"
"[email protected]","nano","10.1.2","https://github.com/apache/couchdb-nano","The official CouchDB client for Node.js","Apache-2.0"
"[email protected]","nanoid","3.3.9","https://github.com/ai/nanoid","A tiny (116 bytes), secure URL-friendly unique string ID generator","MIT"
"[email protected]","natural-compare","1.4.0","https://github.com/litejs/natural-compare-lite","Compare strings containing a mix of letters and numbers in the way a human being would in sort order.","MIT"
Expand Down Expand Up @@ -1044,7 +1034,6 @@
"[email protected]","picocolors","1.1.1","https://github.com/alexeyraspopov/picocolors","The tiniest and the fastest library for terminal output formatting with ANSI colors","ISC"
"[email protected]","picomatch","2.3.1","https://github.com/micromatch/picomatch","Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.","MIT"
"[email protected]","pirates","4.0.6","https://github.com/danez/pirates","Properly hijack require, i.e., properly define require hooks and customizations","MIT"
"[email protected]","pkcs11js","1.3.1","https://github.com/PeculiarVentures/pkcs11js","A Node.js implementation of the PKCS#11 2.30 interface","MIT"
"[email protected]","pkg-dir","4.2.0","https://github.com/sindresorhus/pkg-dir","Find the root directory of a Node.js project or npm package","MIT"
"[email protected]","pluralize","8.0.0","https://github.com/blakeembrey/pluralize","Pluralize and singularize any word","MIT"
"[email protected]","portfinder","1.0.32","https://github.com/http-party/node-portfinder","A simple tool to find an open port on the current machine","MIT"
Expand Down
118 changes: 0 additions & 118 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading