Skip to content

Commit

Permalink
Add fields to InitAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
DogLooksGood committed Aug 31, 2023
1 parent c7c18cd commit cc93ebd
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 34 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ members = [
]

[workspace.dependencies]
race-core = { path = "core", version = ">=0.0.9" }
race-proc-macro = { path = "proc-macro", version = ">=0.0.9" }
race-client = { path = "client", version = ">=0.0.9" }
race-encryptor = { path = "encryptor", version = ">=0.0.9" }
race-env = { path = "env", version = ">=0.0.9" }
race-test = { path = "test", version = ">=0.0.9" }
race-solana-types = { path = "contracts/solana-types", version = ">=0.0.9", default-features = false }
race-transport = { path = "transport", version = ">=0.0.9" }
race-core = { path = "core", version = ">=0.0.10" }
race-proc-macro = { path = "proc-macro", version = ">=0.0.10" }
race-client = { path = "client", version = ">=0.0.10" }
race-encryptor = { path = "encryptor", version = ">=0.0.10" }
race-env = { path = "env", version = ">=0.0.10" }
race-test = { path = "test", version = ">=0.0.10" }
race-solana-types = { path = "contracts/solana-types", version = ">=0.0.10", default-features = false }
race-transport = { path = "transport", version = ">=0.0.10" }
uuid = { version = "1.1.2", features = ["v4", "fast-rng"] }
syn = "1.0.107"
quote = "1.0.23"
Expand Down Expand Up @@ -79,7 +79,7 @@ regex = "1"

[workspace.package]
authors = ["RACE Foundation <race.game.team@gmail.com>"]
version = "0.0.9"
version = "0.0.10"
edition = "2021"
rust-version = "1.65.0"
license = "MPL-2.0"
Expand Down
12 changes: 12 additions & 0 deletions core/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ pub struct InitAccount {
pub data: Vec<u8>,
pub access_version: u64,
pub settle_version: u64,
pub max_players: u16,
pub min_deposit: u64,
pub max_deposit: u64,
}

impl InitAccount {
Expand All @@ -38,6 +41,9 @@ impl InitAccount {
data: game_account.data.clone(),
access_version,
settle_version,
max_players: game_account.max_players,
min_deposit: game_account.min_deposit,
max_deposit: game_account.min_deposit,
}
}

Expand All @@ -64,6 +70,9 @@ impl InitAccount {
data: game_account.data.clone(),
access_version: transactor_access_version,
settle_version: transactor_settle_version,
max_players: game_account.max_players,
min_deposit: game_account.min_deposit,
max_deposit: game_account.min_deposit,
}
}

Expand Down Expand Up @@ -105,6 +114,9 @@ impl Default for InitAccount {
data: Vec::new(),
access_version: 0,
settle_version: 0,
max_players: 10,
min_deposit: 0,
max_deposit: 9999,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/borsh/package-lock.json

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

2 changes: 1 addition & 1 deletion js/borsh/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/borsh",
"version": "0.0.26",
"version": "0.0.27",
"description": "A borsh implementation with decorator support",
"repository": {
"type": "git",
Expand Down
8 changes: 4 additions & 4 deletions js/package-lock.json

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

4 changes: 2 additions & 2 deletions js/sdk-core/package-lock.json

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

2 changes: 1 addition & 1 deletion js/sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/sdk-core",
"version": "0.0.26",
"version": "0.0.27",
"description": "The type definitions for Race SDK",
"scripts": {
"test": "jest",
Expand Down
16 changes: 16 additions & 0 deletions js/sdk-core/src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export interface IInitAccount {
data: Uint8Array;
accessVersion: bigint;
settleVersion: bigint;
maxPlayers: number;
minDeposit: bigint;
maxDeposit: bigint;
}

export class InitAccount {
Expand All @@ -32,13 +35,23 @@ export class InitAccount {
readonly accessVersion: bigint;
@field('u64')
readonly settleVersion: bigint;
@field('u16')
readonly maxPlayers: number;
@field('u64')
readonly minDeposit: bigint;
@field('u64')
readonly maxDeposit: bigint;

constructor(fields: IInitAccount) {
this.addr = fields.addr;
this.accessVersion = fields.accessVersion;
this.settleVersion = fields.settleVersion;
this.data = fields.data;
this.players = fields.players;
this.servers = fields.servers;
this.maxPlayers = fields.maxPlayers;
this.minDeposit = fields.minDeposit;
this.maxDeposit = fields.maxDeposit;
}
static createFromGameAccount(
gameAccount: GameAccount,
Expand All @@ -55,6 +68,9 @@ export class InitAccount {
servers,
accessVersion: transactorAccessVersion,
settleVersion: transactorSettleVersion,
maxPlayers: gameAccount.maxPlayers,
minDeposit: gameAccount.minDeposit,
maxDeposit: gameAccount.maxDeposit,
});
}
serialize(): Uint8Array {
Expand Down
2 changes: 1 addition & 1 deletion js/sdk-facade/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/sdk-facade",
"version": "0.0.26",
"version": "0.0.27",
"description": "The Facade integration for Race SDK",
"main": "lib/cjs/index.ts",
"module": "lib/esm/index.js",
Expand Down
4 changes: 2 additions & 2 deletions js/sdk-solana/package-lock.json

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

2 changes: 1 addition & 1 deletion js/sdk-solana/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@race-foundation/sdk-solana",
"version": "0.0.26",
"version": "0.0.27",
"description": "The Solana support for Race SDK",
"scripts": {
"test": "jest",
Expand Down

0 comments on commit cc93ebd

Please sign in to comment.