diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index f9ec64b..37c834f 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/Montoya/slots-snap.git" }, "source": { - "shasum": "O/+ZVQFR2cwcTKp8gspU2aOtftRCXGNP197GPwbFxUI=", + "shasum": "uMrnux+cyVW+3+Dnnkgo2Rr2jNJONehPIs7lsj1vys8=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/index.tsx b/packages/snap/src/index.tsx index ddbb526..151408b 100644 --- a/packages/snap/src/index.tsx +++ b/packages/snap/src/index.tsx @@ -11,13 +11,13 @@ const svgArr = [ ]; const svgStaticArr = [ - ``, - ``, - ``, + ``, + ``, + ``, `` ] -const reel = ['🦊','🍒','🍊','🍌','🍌','🍎','🍎']; +let reel = ['🦊','🍒','🍊','🍌','🍌','🍎','🍎']; const getRandom = () => { @@ -45,7 +45,7 @@ export const onHomePage: OnHomePageHandler = async () => { const playerState = await snap.request({ method: "snap_manageState", params: { operation: "get" }, - }) || { balance: 1000, new: true, lastBet: 0, lastResult: [reel[0],reel[0],reel[0]] }; + }) || { balance: 1000, new: true, lastBet: 0, lastResult: [reel[0],reel[0],reel[0]], reel: "fox" }; const interfaceId = await snap.request({ method: "snap_createInterface", params: { @@ -66,7 +66,17 @@ export const onUserInput: OnUserInputHandler = async ({id, event}) => { const playerState = await snap.request({ method: "snap_manageState", params: { operation: "get" }, - }) || { balance: 1000, new: true, lastBet: 0, lastResult: [reel[0],reel[0],reel[0]] }; + }) || { balance: 1000, new: true, lastBet: 0, lastResult: [reel[0],reel[0],reel[0]], reel: "fox" }; + + switch(playerState.reel) { + case 'gator': + reel = ['🦊','🍒','🍊','🍌','🍌','🍎','🍎']; + break; + case 'fox': + default: + reel = ['🦊','🍒','🍊','🍌','🍌','🍎','🍎']; + break; + } switch (event.name) { case "new": @@ -102,10 +112,11 @@ export const onUserInput: OnUserInputHandler = async ({id, event}) => { {"$"+playerState.balance} - + + ) @@ -181,10 +192,11 @@ export const onUserInput: OnUserInputHandler = async ({id, event}) => { {"$"+playerState.balance} {win?"You won $"+win+"!":"Try again..."} - + + ) @@ -195,6 +207,20 @@ export const onUserInput: OnUserInputHandler = async ({id, event}) => { }); return prom; break; + case 'settings': + await snap.request({ + method: "snap_updateInterface", + params: { + id, + ui: ( + + Settings go here... + + + ), + }, + }); + break; } };