Skip to content

Commit

Permalink
Merge branch 'main' into 134-validate-user-inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
felipe.fuerback authored Apr 11, 2024
2 parents 1d9715c + d0840f5 commit 4befcd5
Show file tree
Hide file tree
Showing 47 changed files with 332 additions and 333 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/publish-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -172,14 +172,22 @@ jobs:
run: |
git config --global user.name "galachain-release-bot"
git config --global user.email "[email protected]"
- 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
2 changes: 1 addition & 1 deletion chain-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gala-chain/api",
"version": "1.1.9",
"version": "1.1.10",
"description": "Common types, DTOs (Data Transfer Objects), APIs, signatures, and utils for GalaChain.",
"license": "Apache-2.0",
"dependencies": {
Expand Down
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),
created: 1,
createdAt: 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.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 };
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -570,7 +570,7 @@ export class TokenHold {

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

@Min(0)
@IsInt()
Expand All @@ -594,7 +594,7 @@ export class TokenHold {
createdBy: string;
instanceId: BigNumber;
quantity: BigNumber;
created: number;
createdAt: 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.created = params.created;
this.createdAt = params.createdAt;
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;
created: number;
createdAt: number;
expires: number | undefined;
name: string | undefined;
lockAuthority: string | undefined;
Expand Down
9 changes: 9 additions & 0 deletions chain-api/src/types/TokenMintRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions chain-api/src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion chain-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ npm install -g @gala-chain/cli
$ galachain COMMAND
running command...
$ galachain (--version)
@gala-chain/cli/1.1.9 linux-x64 node-v18.17.0
@gala-chain/cli/1.1.10 linux-x64 node-v18.17.1
$ galachain --help [COMMAND]
USAGE
$ galachain COMMAND
Expand Down
Loading

0 comments on commit 4befcd5

Please sign in to comment.