Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/challenge-3-dice-game' into nada…
Browse files Browse the repository at this point in the history
…i/challenge-3-update
  • Loading branch information
Nadai2010 committed Oct 7, 2024
2 parents d4646b2 + 2d78fe9 commit 74e59c5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import { useReducer, useState } from "react";
import dynamic from "next/dynamic";
import { ContractReadMethods } from "./ContractReadMethods";
import { Address, Balance } from "~~/components/scaffold-stark";
import {
useDeployedContractInfo,
useNetworkColor,
} from "~~/hooks/scaffold-stark";
import { useDeployedContractInfo } from "~~/hooks/scaffold-stark";
import { useTargetNetwork } from "~~/hooks/scaffold-stark/useTargetNetwork";
import { ContractName } from "~~/utils/scaffold-stark/contract";
import { ContractVariables } from "./ContractVariables";
Expand Down
39 changes: 10 additions & 29 deletions packages/nextjs/utils/scaffold-stark/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,22 @@ export type ExtractAbiFunctionNamesScaffold<
TAbiStateMutability extends AbiStateMutability = AbiStateMutability,
> = ExtractAbiFunctionsScaffold<TAbi, TAbiStateMutability>["name"];

// helper function will only take from interfaces : //TODO: see if we can make it more generic
// helper function will only take from interfaces : //TODO: see if we can make it more generic
export type ExtractAbiFunctionsScaffold<
TAbi extends Abi,
TAbiStateMutability extends AbiStateMutability = AbiStateMutability,
> = Extract<
ExtractAbiInterfaces<TAbi>["items"][number],
{
type: "function";
state_mutability: TAbiStateMutability;
}
| {
state_mutability: TAbiStateMutability;
}
| Extract<
TAbi[number],
{
type: "function";
}
>
>;

// helper function will only take from interfaces : //TODO: see if we can make it more generic
Expand Down Expand Up @@ -328,31 +334,6 @@ export type AbiFunctionOutputs<
TFunctionName extends string,
> = ExtractAbiFunctionScaffold<TAbi, TFunctionName>["outputs"];

/*export type AbiEventInputs<TAbi extends Abi, TEventName extends ExtractAbiEventNames<TAbi>> = ExtractAbiEvent<
TAbi,
TEventName
>["inputs"];
type IndexedEventInputs<
TContractName extends ContractName,
TEventName extends ExtractAbiEventNames<ContractAbi<TContractName>>,
> = Extract<AbiEventInputs<ContractAbi<TContractName>, TEventName>[number], { indexed: true }>;
export type EventFilters<
TContractName extends ContractName,
TEventName extends ExtractAbiEventNames<ContractAbi<TContractName>>,
> = IsContractDeclarationMissing<
any,
IndexedEventInputs<TContractName, TEventName> extends never
? never
: {
[Key in IsContractDeclarationMissing<
any,
IndexedEventInputs<TContractName, TEventName>["name"]
>]?: AbiParameterToPrimitiveType<Extract<IndexedEventInputs<TContractName, TEventName>, { name: Key }>>;
}
>;*/

export type UseScaffoldEventHistoryConfig<
TContractName extends ContractName,
TEventName extends ExtractAbiEventNames<ContractAbi<TContractName>>,
Expand Down
18 changes: 18 additions & 0 deletions packages/snfoundry/scripts_js/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const { deployer, deployContract } = require("./deploy_contract");
const deployScript = async () => {
const { address: diceGameAddr } = await deployContract(null, "DiceGame");

await deployContract(
{
dice_game_address: diceGameAddr,
owner: deployer.address,
},
"RiggedRoll"
);
};

deployScript()
.then(() => {
console.log("All Setup Done");
})
.catch(console.error);

0 comments on commit 74e59c5

Please sign in to comment.