From b96e02e899f080b7e73738ada77184b5002655d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mital?= <7765376+herr-bubu@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:07:25 +0200 Subject: [PATCH 1/7] Fix bump version CI step (#147) * Fix bump version CI step --- .github/workflows/publish-on-tag.yml | 24 ++++++++++++++++-------- chain-cli/README.md | 2 +- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish-on-tag.yml b/.github/workflows/publish-on-tag.yml index 6aa68f83e8..bb2d27bd45 100644 --- a/.github/workflows/publish-on-tag.yml +++ b/.github/workflows/publish-on-tag.yml @@ -12,7 +12,7 @@ jobs: publish: name: Publish Release if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -156,7 +156,7 @@ jobs: needs: [publish, publish-cli-image] if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) name: Bump SDK Version - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -172,14 +172,22 @@ jobs: run: | git config --global user.name "galachain-release-bot" git config --global user.email "galachain-release-bot@users.noreply.github.com" - - name: Bump version + - name: Set a new version run: | VERSION="$(semver "$(< package.json jq -r '.version')" -i)" + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Create a new branch + run: | + BRANCH_NAME="bump-version-to-$VERSION" + git checkout -b $BRANCH_NAME main + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + - name: Bump version and commit changes + run: | ./unifyVersions.js $VERSION npm i git commit -am "Bump version to $VERSION" - - name: Push next version release - uses: ad-m/github-push-action@master - with: - branch: "main" - github_token: ${{ secrets.RELEASE_BOT_TOKEN }} + git push --set-upstream origin bump-version-to-$VERSION + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh pr create --title "Bump Version to $VERSION" --body "Bump Version to $VERSION" --label "bump-version-pr" --head "bump-version-to-$VERSION" --base main diff --git a/chain-cli/README.md b/chain-cli/README.md index f0ccb5aff7..7b280489a3 100644 --- a/chain-cli/README.md +++ b/chain-cli/README.md @@ -18,7 +18,7 @@ $ npm install -g @gala-chain/cli $ galachain COMMAND running command... $ galachain (--version) -@gala-chain/cli/1.1.10 darwin-arm64 node-v16.20.2 +@gala-chain/cli/1.1.10 linux-x64 node-v18.17.1 $ galachain --help [COMMAND] USAGE $ galachain COMMAND From aeb2187a8d79fba03e48bdd910a18ac4c9c45407 Mon Sep 17 00:00:00 2001 From: "felipe.fuerback" Date: Wed, 10 Apr 2024 12:06:08 -0700 Subject: [PATCH 2/7] Remove unused function (#173) --- chaincode/src/mint/fetchMintAllowanceSupply.ts | 16 ---------------- chaincode/src/mint/index.ts | 3 +-- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/chaincode/src/mint/fetchMintAllowanceSupply.ts b/chaincode/src/mint/fetchMintAllowanceSupply.ts index 9923183ed1..3f792d0401 100644 --- a/chaincode/src/mint/fetchMintAllowanceSupply.ts +++ b/chaincode/src/mint/fetchMintAllowanceSupply.ts @@ -115,19 +115,3 @@ export async function fetchMintAllowanceSupply( return updatedKnownMintAllowancesCount; } - -export async function fetchMintAllowanceSupplyForToken(ctx: GalaChainContext, data: TokenClassKeyProperties) { - const { collection, category, type, additionalKey } = data; - - const keyList = [collection, category, type, additionalKey]; - const compositeKey = ChainObject.getCompositeKeyFromParts(TokenClass.INDEX_KEY, keyList); - const tokenClass: TokenClass = await getObjectByKey(ctx, TokenClass, compositeKey); - - const supply = await fetchMintAllowanceSupply(ctx, tokenClass); - - const response = plainToInstance(FetchTokenSupplyResponse, { - supply - }); - - return response; -} diff --git a/chaincode/src/mint/index.ts b/chaincode/src/mint/index.ts index dac2170b96..d19a2d3988 100644 --- a/chaincode/src/mint/index.ts +++ b/chaincode/src/mint/index.ts @@ -19,7 +19,7 @@ import { indexedMintOperationsByTokenClass } from "./batchMintToken"; import { constructVerifiedMints } from "./constructVerifiedMints"; -import { fetchMintAllowanceSupply, fetchMintAllowanceSupplyForToken } from "./fetchMintAllowanceSupply"; +import { fetchMintAllowanceSupply } from "./fetchMintAllowanceSupply"; import { fetchMintSupply } from "./fetchMintSupply"; import { fetchTokenClassesWithSupply } from "./fetchTokenClassWithSupply"; import { fulfillMintRequest } from "./fulfillMint"; @@ -52,7 +52,6 @@ export { validateMintRequest, fetchMintAllowanceSupply, fetchMintSupply, - fetchMintAllowanceSupplyForToken, fetchTokenClassesWithSupply, mintTokenWithAllowance, MintTokenWithAllowanceParams From 7f97141bb006a887d5c9b136e4d2897917fcfa3b Mon Sep 17 00:00:00 2001 From: "felipe.fuerback" Date: Wed, 10 Apr 2024 12:17:59 -0700 Subject: [PATCH 3/7] Add input validation for MintRequestDto (#172) * Add input validation for MintRequestDto * Add public --- chain-api/src/types/TokenMintRequest.ts | 9 +++++++++ chain-api/src/types/common.ts | 9 +++++++++ chaincode/src/mint/fulfillMintAllowance.ts | 14 +++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/chain-api/src/types/TokenMintRequest.ts b/chain-api/src/types/TokenMintRequest.ts index f80976cda8..26fc12ac6d 100644 --- a/chain-api/src/types/TokenMintRequest.ts +++ b/chain-api/src/types/TokenMintRequest.ts @@ -82,6 +82,15 @@ export class TokenMintRequest extends RangedChainObject { @IsNotEmpty() public allowanceKey?: AllowanceKey; + public isTimeKeyValid(): boolean { + try { + new BigNumber(this.timeKey); + return true; + } catch (e) { + return false; + } + } + public requestId(): string { const { collection, category, type, additionalKey, totalKnownMintsCount, requestor, owner, created } = this; diff --git a/chain-api/src/types/common.ts b/chain-api/src/types/common.ts index a77e5ac236..6c1d10fc07 100644 --- a/chain-api/src/types/common.ts +++ b/chain-api/src/types/common.ts @@ -116,4 +116,13 @@ export class MintRequestDto { @Type(() => AllowanceKey) @IsNotEmpty() public allowanceKey?: AllowanceKey; + + public isTimeKeyValid(): boolean { + try { + new BigNumber(this.timeKey); + return true; + } catch (e) { + return false; + } + } } diff --git a/chaincode/src/mint/fulfillMintAllowance.ts b/chaincode/src/mint/fulfillMintAllowance.ts index 95ba6a3a67..3bad945493 100644 --- a/chaincode/src/mint/fulfillMintAllowance.ts +++ b/chaincode/src/mint/fulfillMintAllowance.ts @@ -54,7 +54,7 @@ export async function fulfillMintAllowanceRequest( // todo: type this failures array and work it into response const failures: any[] = []; - for (const [key, values] of Object.entries(reqIdx)) { + for (const [_, values] of Object.entries(reqIdx)) { // Entries in the Request Index represent // some number of mint requests for the same token, at the same running total height. // Because our original GrantAllowance implementation allowed (potentially large) arrays, @@ -84,6 +84,18 @@ export async function fulfillMintAllowanceRequest( for (const req of values) { // timeKeys are inverted timestamps, lowest = most recent, highest = oldest + if (req.isTimeKeyValid() === false) { + throw new Error( + `FulfillMintAllowance failure: Invalid timeKey value: ${ + req.timeKey + }. The value of timeKey should be a valid BigNumber, ${inspect(req, { + depth: 4, + breakLength: Infinity, + compact: true + })}` + ); + } + const reqTime = new BigNumber(req.timeKey); if (reqTime.isLessThan(mostRecentTimeInversion)) { mostRecentTimeInversion = reqTime; From d60a0ec7396a9410710218a071dcd4aa98e81535 Mon Sep 17 00:00:00 2001 From: "felipe.fuerback" Date: Wed, 10 Apr 2024 12:58:28 -0700 Subject: [PATCH 4/7] Fix comment typo (#171) --- chaincode/src/burns/fetchBurns.ts | 2 +- chaincode/src/mint/fetchMintAllowanceSupply.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chaincode/src/burns/fetchBurns.ts b/chaincode/src/burns/fetchBurns.ts index 917d6d5b81..185467cecb 100644 --- a/chaincode/src/burns/fetchBurns.ts +++ b/chaincode/src/burns/fetchBurns.ts @@ -115,7 +115,7 @@ export async function fetchKnownBurnCount( // inverted timeKeys read most recent first; using unshift sorts a new array as oldest first. // essentially, we rewind the tape and then play it forward. - // covering the following possible scensarios: + // covering the following possible scenarios: // a) no results yet - empty array, start with zero below. // b) no recent results. continue back toward the beginning of the ledger until we find at least one. // c) recent results. Get all results within two past block spans to cover any missing timestamp gaps from concurrent recent transactions. diff --git a/chaincode/src/mint/fetchMintAllowanceSupply.ts b/chaincode/src/mint/fetchMintAllowanceSupply.ts index 3f792d0401..01cca1b71a 100644 --- a/chaincode/src/mint/fetchMintAllowanceSupply.ts +++ b/chaincode/src/mint/fetchMintAllowanceSupply.ts @@ -85,7 +85,7 @@ export async function fetchMintAllowanceSupply( // inverted timeKeys read most recent first; using unshift sorts a new array as oldest first. // essentially, we rewind the tape and then play it forward. - // covering the following possible scensarios: + // covering the following possible scenarios: // a) no results yet - empty array, start with zero below. // b) no recent results. continue back toward the beginning of the ledger until we find at least one. // c) recent results. Get all results within two past block spans to cover any missing timestamp gaps from concurrent recent transactions. From 1c7a7d3a9942e807964b94c09620ec9960f6e94c Mon Sep 17 00:00:00 2001 From: "felipe.fuerback" Date: Wed, 10 Apr 2024 13:09:07 -0700 Subject: [PATCH 5/7] Remove redundant variable (#170) --- chaincode/src/mint/fulfillMint.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/chaincode/src/mint/fulfillMint.ts b/chaincode/src/mint/fulfillMint.ts index 69c6bac396..ad91aa6f2a 100644 --- a/chaincode/src/mint/fulfillMint.ts +++ b/chaincode/src/mint/fulfillMint.ts @@ -198,9 +198,6 @@ export async function fulfillMintRequest( ); if (requestEntries.length < 1) { - const recentTimeKey = mostRecentTimeInversion.toString().padStart(inverseKeyLength, "0"); - const oldestTimeKey = oldestTimeInversion.toString().padStart(inverseKeyLength, "0"); - throw GalaChainResponse.Error( new Error( `FulfillMint failure: No TokenMintRequest(s) found on chain. ` + From b08410c296867c27e0fa80bb8e7d715c00fcb373 Mon Sep 17 00:00:00 2001 From: "felipe.fuerback" Date: Thu, 11 Apr 2024 04:20:46 -0700 Subject: [PATCH 6/7] Remove duplicate code (#169) --- chain-client/src/rest-api/RestApiClient.ts | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/chain-client/src/rest-api/RestApiClient.ts b/chain-client/src/rest-api/RestApiClient.ts index ce03306bdb..a4188aca59 100644 --- a/chain-client/src/rest-api/RestApiClient.ts +++ b/chain-client/src/rest-api/RestApiClient.ts @@ -13,10 +13,11 @@ * limitations under the License. */ import { ChainCallDTO, ContractAPI, GalaChainResponse, Inferred } from "@gala-chain/api"; -import axios, { AxiosError } from "axios"; +import axios from "axios"; import { ChainClient, ChainClientBuilder, ClassType, ContractConfig, isClassType } from "../generic"; import { RestApiAdminCredentials, SetContractApiParams, globalRestApiConfig } from "./GlobalRestApiConfig"; +import { catchAxiosError } from "./catchAxiosError"; import { RestApiConfig } from "./loadRestApiConfig"; async function getPath( @@ -44,18 +45,6 @@ async function getPath( return `${restApiUrl}/${contractPath}/${methodApi.apiMethodName ?? methodApi.methodName}`; } -function catchAxiosError(e?: AxiosError<{ error?: { Status?: number } }>) { - // if data object contains { error: { Status: 0 } }, it means this is GalaChainResponse - if (e?.response?.data?.error?.Status === 0) { - return { data: e?.response?.data?.error }; - } else { - const data = { axiosError: { message: e?.message, data: e?.response?.data } }; - console.warn(`Axios error:`, JSON.stringify(data)); - - return { data: data }; - } -} - export class RestApiClient extends ChainClient { private readonly restApiUrl: Promise; From f911b659d2c4b8230665a13c8c0bd436c355fd70 Mon Sep 17 00:00:00 2001 From: "felipe.fuerback" Date: Thu, 11 Apr 2024 04:38:56 -0700 Subject: [PATCH 7/7] 156 created to createdat2 (#168) * Update create field to createdAt * Update snapshot * Update snapshot e2e --- chain-api/src/types/TokenBalance.spec.ts | 2 +- chain-api/src/types/TokenBalance.ts | 14 ++-- .../e2e/__snapshots__/api.spec.ts.snap | 64 +++++++++---------- .../src/token/__snapshots__/api.spec.ts.snap | 64 +++++++++---------- chaincode/src/locks/lockTokens.spec.ts | 2 +- chaincode/src/locks/lockTokens.ts | 2 +- chaincode/src/locks/unlockToken.spec.ts | 8 +-- chaincode/src/transfer/transferToken.spec.ts | 4 +- chaincode/src/use/useToken.spec.ts | 2 +- chaincode/src/use/useToken.ts | 2 +- 10 files changed, 82 insertions(+), 82 deletions(-) diff --git a/chain-api/src/types/TokenBalance.spec.ts b/chain-api/src/types/TokenBalance.spec.ts index 4147d5c620..8aad39ad35 100644 --- a/chain-api/src/types/TokenBalance.spec.ts +++ b/chain-api/src/types/TokenBalance.spec.ts @@ -34,7 +34,7 @@ function createHold(instance: BigNumber, expires: number, quantity?: BigNumber, createdBy: "user1", instanceId: instance, quantity: quantity ?? new BigNumber(1), - created: 1, + createdAt: 1, expires: expires, name: name }); diff --git a/chain-api/src/types/TokenBalance.ts b/chain-api/src/types/TokenBalance.ts index ccb469cc72..393f8eab27 100644 --- a/chain-api/src/types/TokenBalance.ts +++ b/chain-api/src/types/TokenBalance.ts @@ -458,10 +458,10 @@ export class TokenBalance extends ChainObject { public ensureCanLockQuantity(hold: TokenHold): { lock(): void } { this.ensureTokenQuantityHoldIsFungible(hold); - this.ensureQuantityIsSpendable(hold.quantity, hold.created); + this.ensureQuantityIsSpendable(hold.quantity, hold.createdAt); const lock = () => { - this.lockedHolds = [...this.getUnexpiredLockedHolds(hold.created), hold]; + this.lockedHolds = [...this.getUnexpiredLockedHolds(hold.createdAt), hold]; }; return { lock }; @@ -503,7 +503,7 @@ export class TokenBalance extends ChainObject { const partialQuantityHold = new TokenHold({ createdBy: hold.createdBy, - created: hold.created, + createdAt: hold.createdAt, instanceId: hold.instanceId, expires: hold.expires, name: hold.name, @@ -570,7 +570,7 @@ export class TokenHold { @IsPositive() @IsInt() - public readonly created: number; + public readonly createdAt: number; @Min(0) @IsInt() @@ -594,7 +594,7 @@ export class TokenHold { createdBy: string; instanceId: BigNumber; quantity: BigNumber; - created: number; + createdAt: number; expires?: number; name?: string; lockAuthority?: string; @@ -603,7 +603,7 @@ export class TokenHold { this.createdBy = params.createdBy; this.instanceId = params.instanceId; this.quantity = params.quantity; - this.created = params.created; + this.createdAt = params.createdAt; this.expires = params.expires ?? TokenHold.DEFAULT_EXPIRES; if (params.name) { this.name = params.name; @@ -618,7 +618,7 @@ export class TokenHold { createdBy: string; instanceId: BigNumber; quantity: BigNumber; - created: number; + createdAt: number; expires: number | undefined; name: string | undefined; lockAuthority: string | undefined; diff --git a/chain-cli/chaincode-template/e2e/__snapshots__/api.spec.ts.snap b/chain-cli/chaincode-template/e2e/__snapshots__/api.spec.ts.snap index 94ca5b3024..7272ba453e 100644 --- a/chain-cli/chaincode-template/e2e/__snapshots__/api.spec.ts.snap +++ b/chain-cli/chaincode-template/e2e/__snapshots__/api.spec.ts.snap @@ -1540,7 +1540,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -1574,7 +1574,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -1585,7 +1585,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -1619,7 +1619,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -3834,7 +3834,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -3868,7 +3868,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -3879,7 +3879,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -3913,7 +3913,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4114,7 +4114,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4148,7 +4148,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4159,7 +4159,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4193,7 +4193,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4891,7 +4891,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4925,7 +4925,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4936,7 +4936,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4970,7 +4970,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5354,7 +5354,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5388,7 +5388,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5399,7 +5399,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5433,7 +5433,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5594,7 +5594,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5628,7 +5628,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5639,7 +5639,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5673,7 +5673,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5856,7 +5856,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5890,7 +5890,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5901,7 +5901,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5935,7 +5935,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -6308,7 +6308,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -6342,7 +6342,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -6353,7 +6353,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -6387,7 +6387,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", diff --git a/chain-cli/chaincode-template/src/token/__snapshots__/api.spec.ts.snap b/chain-cli/chaincode-template/src/token/__snapshots__/api.spec.ts.snap index 1fc59bf08e..a976a5d8de 100644 --- a/chain-cli/chaincode-template/src/token/__snapshots__/api.spec.ts.snap +++ b/chain-cli/chaincode-template/src/token/__snapshots__/api.spec.ts.snap @@ -1057,7 +1057,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -1091,7 +1091,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -1102,7 +1102,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -1136,7 +1136,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -3391,7 +3391,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -3425,7 +3425,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -3436,7 +3436,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -3470,7 +3470,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -3674,7 +3674,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -3708,7 +3708,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -3719,7 +3719,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -3753,7 +3753,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4463,7 +4463,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4497,7 +4497,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4508,7 +4508,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4542,7 +4542,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4932,7 +4932,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -4966,7 +4966,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -4977,7 +4977,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5011,7 +5011,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5175,7 +5175,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5209,7 +5209,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5220,7 +5220,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5254,7 +5254,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5440,7 +5440,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5474,7 +5474,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5485,7 +5485,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5519,7 +5519,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5898,7 +5898,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "inUseHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5932,7 +5932,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", @@ -5943,7 +5943,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "lockedHolds": { "items": { "properties": { - "created": { + "createdAt": { "exclusiveMinimum": 0, "type": "number", }, @@ -5977,7 +5977,7 @@ The key is generated by the caller and should be unique for each DTO. You can us "createdBy", "instanceId", "quantity", - "created", + "createdAt", "expires", ], "type": "object", diff --git a/chaincode/src/locks/lockTokens.spec.ts b/chaincode/src/locks/lockTokens.spec.ts index 1fc2cbbf38..ec139a4020 100644 --- a/chaincode/src/locks/lockTokens.spec.ts +++ b/chaincode/src/locks/lockTokens.spec.ts @@ -66,7 +66,7 @@ describe("LockTokens", () => { createdBy: users.testUser1Id, instanceId: nftInstanceKey.instance, quantity: new BigNumber("1"), - created: ctx.txUnixTime, + createdAt: ctx.txUnixTime, lockAuthority: users.testUser1Id, expires: 0 }); diff --git a/chaincode/src/locks/lockTokens.ts b/chaincode/src/locks/lockTokens.ts index b9e3f2efcd..9f7edb3444 100644 --- a/chaincode/src/locks/lockTokens.ts +++ b/chaincode/src/locks/lockTokens.ts @@ -113,7 +113,7 @@ export async function lockToken( createdBy: callingOnBehalf, instanceId: tokenInstance.instance, quantity: quantity, - created: ctx.txUnixTime, + createdAt: ctx.txUnixTime, expires: expires, name: name, lockAuthority diff --git a/chaincode/src/locks/unlockToken.spec.ts b/chaincode/src/locks/unlockToken.spec.ts index 7ff9866de4..c3421d6a3e 100644 --- a/chaincode/src/locks/unlockToken.spec.ts +++ b/chaincode/src/locks/unlockToken.spec.ts @@ -34,7 +34,7 @@ describe("UnlockToken", () => { createdBy: users.testUser1Id, instanceId: nftInstance.instance, quantity: new BigNumber("1"), - created: 1, + createdAt: 1, expires: 0 } ] @@ -70,7 +70,7 @@ describe("UnlockToken", () => { createdBy: users.testUser1Id, instanceId: nftInstance.instance, quantity: new BigNumber("1"), - created: 1, + createdAt: 1, expires: 0 } ] @@ -114,7 +114,7 @@ describe("UnlockToken", () => { createdBy: users.testUser1Id, instanceId: nftInstance.instance, quantity: new BigNumber("1"), - created: 1, + createdAt: 1, expires: 0 } ] @@ -151,7 +151,7 @@ describe("UnlockToken", () => { createdBy: users.testUser1Id, instanceId: nftInstance.instance, quantity: new BigNumber("1"), - created: 1, + createdAt: 1, expires: 0 } ] diff --git a/chaincode/src/transfer/transferToken.spec.ts b/chaincode/src/transfer/transferToken.spec.ts index a661e9976d..ce0331a857 100644 --- a/chaincode/src/transfer/transferToken.spec.ts +++ b/chaincode/src/transfer/transferToken.spec.ts @@ -43,7 +43,7 @@ describe("TransferToken", () => { createdBy: users.testUser1Id, instanceId: nftInstanceKey.instance, quantity: new BigNumber("1"), - created: 1, + createdAt: 1, expires: 0 }); const tokenBalance = nft.tokenBalance(); @@ -82,7 +82,7 @@ describe("TransferToken", () => { createdBy: users.testUser1Id, instanceId: nftInstanceKey.instance, quantity: new BigNumber("1"), - created: 1, + createdAt: 1, expires: 0 }); const tokenBalance = nft.tokenBalance(); diff --git a/chaincode/src/use/useToken.spec.ts b/chaincode/src/use/useToken.spec.ts index c2bb8823cb..90d3c7f761 100644 --- a/chaincode/src/use/useToken.spec.ts +++ b/chaincode/src/use/useToken.spec.ts @@ -55,7 +55,7 @@ describe("UseToken", () => { createdBy: users.testUser1Id, instanceId: nftInstanceKey.instance, quantity: new BigNumber("1"), - created: ctx.txUnixTime, + createdAt: ctx.txUnixTime, expires: 0 }); diff --git a/chaincode/src/use/useToken.ts b/chaincode/src/use/useToken.ts index 38dc6a6f10..a0307f050a 100644 --- a/chaincode/src/use/useToken.ts +++ b/chaincode/src/use/useToken.ts @@ -86,7 +86,7 @@ export async function useToken( createdBy: callingOnBehalf, instanceId: tokenInstance.instance, quantity: quantity, - created: ctx.txUnixTime, + createdAt: ctx.txUnixTime, expires: 0, name: undefined, lockAuthority: undefined