Skip to content

Commit

Permalink
chore: Regenerated TS bindings & fixed errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nami-Webisoft committed Nov 27, 2024
1 parent 82afdcb commit a84385c
Show file tree
Hide file tree
Showing 2 changed files with 604 additions and 237 deletions.
136 changes: 89 additions & 47 deletions bindings/typescript/contracts.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,139 +4,181 @@ import * as models from "./models.gen";

export async function setupWorld(provider: DojoProvider) {

const action_system_draw = async (account: Account, drawsFive: boolean) => {
const game_system_start = async (snAccount: Account, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "action_system",
entryPoint: "draw",
calldata: [drawsFive],
}
contractName: "game_system",
entrypoint: "start",
calldata: [table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const game_system_endTurn = async (snAccount: Account, table: string) => {
try {
return await provider.execute(
snAccount,
{
contractName: "game_system",
entrypoint: "end_turn",
calldata: [table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const game_system_end = async (snAccount: Account, table: string) => {
try {
return await provider.execute(
snAccount,
{
contractName: "game_system",
entrypoint: "end",
calldata: [table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const action_system_play = async (account: Account, card: models.EnumCard) => {
const action_system_draw = async (snAccount: Account, drawsFive: boolean, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "action_system",
entryPoint: "play",
calldata: [card],
}
entrypoint: "draw",
calldata: [drawsFive, table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const action_system_move = async (account: Account, card: models.EnumCard) => {
const action_system_play = async (snAccount: Account, card: models.EnumCard, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "action_system",
entryPoint: "move",
calldata: [card],
}
entrypoint: "play",
calldata: [card, table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const action_system_payFee = async (account: Account, pay: Array<EnumCard>, recipient: string, payee: string) => {
const action_system_move = async (snAccount: Account, card: models.EnumCard, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "action_system",
entryPoint: "pay_fee",
calldata: [pay, recipient, payee],
}
entrypoint: "move",
calldata: [card, table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const game_system_start = async (account: Account) => {
const action_system_payFee = async (snAccount: Account, pay: Array<models.EnumCard>, recipient: string, payee: string, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "game_system",
entryPoint: "start",
calldata: [],
}
contractName: "action_system",
entrypoint: "pay_fee",
calldata: [pay, recipient, payee, table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const game_system_endTurn = async (account: Account) => {
const player_system_join = async (snAccount: Account, username: string, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "game_system",
entryPoint: "end_turn",
calldata: [],
}
contractName: "player_system",
entrypoint: "join",
calldata: [username, table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const player_system_join = async (account: Account, username: string) => {
const player_system_setReady = async (snAccount: Account, ready: boolean, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "player_system",
entryPoint: "join",
calldata: [username],
}
entrypoint: "set_ready",
calldata: [ready, table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

const player_system_leave = async (account: Account) => {
const player_system_leave = async (snAccount: Account, table: string) => {
try {
return await provider.execute(
account,
snAccount,
{
contractName: "player_system",
entryPoint: "leave",
calldata: [],
}
entrypoint: "leave",
calldata: [table],
},
"zktt",
);
} catch (error) {
console.error(error);
}
};

return {
game_system: {
start: game_system_start,
endTurn: game_system_endTurn,
end: game_system_end,
},
action_system: {
draw: action_system_draw,
play: action_system_play,
move: action_system_move,
payFee: action_system_payFee,
},
game_system: {
start: game_system_start,
endTurn: game_system_endTurn,
},
player_system: {
join: player_system_join,
setReady: player_system_setReady,
leave: player_system_leave,
},
};
Expand Down
Loading

0 comments on commit a84385c

Please sign in to comment.