Skip to content

Commit

Permalink
Revert rename of TokenHold.created to createdAt (#192)
Browse files Browse the repository at this point in the history
* Revert "156 created to createdat2 (#168)"

This reverts commit f911b65.

* Fix remaining createdAt in test
  • Loading branch information
dzikowski authored Apr 18, 2024
1 parent 821fc6c commit bd56a85
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 83 deletions.
2 changes: 1 addition & 1 deletion chain-api/src/types/TokenBalance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function createHold(instance: BigNumber, expires: number, quantity?: BigNumber,
createdBy: "user1",
instanceId: instance,
quantity: quantity ?? new BigNumber(1),
createdAt: 1,
created: 1,
expires: expires,
name: name
});
Expand Down
14 changes: 7 additions & 7 deletions chain-api/src/types/TokenBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ export class TokenBalance extends ChainObject {

public ensureCanLockQuantity(hold: TokenHold): { lock(): void } {
this.ensureTokenQuantityHoldIsFungible(hold);
this.ensureQuantityIsSpendable(hold.quantity, hold.createdAt);
this.ensureQuantityIsSpendable(hold.quantity, hold.created);

const lock = () => {
this.lockedHolds = [...this.getUnexpiredLockedHolds(hold.createdAt), hold];
this.lockedHolds = [...this.getUnexpiredLockedHolds(hold.created), hold];
};

return { lock };
Expand Down Expand Up @@ -503,7 +503,7 @@ export class TokenBalance extends ChainObject {

const partialQuantityHold = new TokenHold({
createdBy: hold.createdBy,
createdAt: hold.createdAt,
created: hold.created,
instanceId: hold.instanceId,
expires: hold.expires,
name: hold.name,
Expand Down Expand Up @@ -570,7 +570,7 @@ export class TokenHold {

@IsPositive()
@IsInt()
public readonly createdAt: number;
public readonly created: number;

@Min(0)
@IsInt()
Expand All @@ -594,7 +594,7 @@ export class TokenHold {
createdBy: string;
instanceId: BigNumber;
quantity: BigNumber;
createdAt: number;
created: number;
expires?: number;
name?: string;
lockAuthority?: string;
Expand All @@ -603,7 +603,7 @@ export class TokenHold {
this.createdBy = params.createdBy;
this.instanceId = params.instanceId;
this.quantity = params.quantity;
this.createdAt = params.createdAt;
this.created = params.created;
this.expires = params.expires ?? TokenHold.DEFAULT_EXPIRES;
if (params.name) {
this.name = params.name;
Expand All @@ -618,7 +618,7 @@ export class TokenHold {
createdBy: string;
instanceId: BigNumber;
quantity: BigNumber;
createdAt: number;
created: number;
expires: number | undefined;
name: string | undefined;
lockAuthority: string | undefined;
Expand Down
64 changes: 32 additions & 32 deletions chain-cli/chaincode-template/e2e/__snapshots__/api.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -1574,7 +1574,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -1585,7 +1585,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -1619,7 +1619,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -3834,7 +3834,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -3868,7 +3868,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -3879,7 +3879,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -3913,7 +3913,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -4114,7 +4114,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -4148,7 +4148,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -4159,7 +4159,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -4193,7 +4193,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -4891,7 +4891,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -4925,7 +4925,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -4936,7 +4936,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -4970,7 +4970,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -5354,7 +5354,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -5388,7 +5388,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -5399,7 +5399,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -5433,7 +5433,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -5604,7 +5604,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -5638,7 +5638,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -5649,7 +5649,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -5683,7 +5683,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -5866,7 +5866,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -5900,7 +5900,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -5911,7 +5911,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -5945,7 +5945,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down Expand Up @@ -6318,7 +6318,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"inUseHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -6352,7 +6352,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand All @@ -6363,7 +6363,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"lockedHolds": {
"items": {
"properties": {
"createdAt": {
"created": {
"exclusiveMinimum": 0,
"type": "number",
},
Expand Down Expand Up @@ -6397,7 +6397,7 @@ The key is generated by the caller and should be unique for each DTO. You can us
"createdBy",
"instanceId",
"quantity",
"createdAt",
"created",
"expires",
],
"type": "object",
Expand Down
Loading

0 comments on commit bd56a85

Please sign in to comment.