diff --git a/examples/simple-react/src/components/sections/ConfirmTask.tsx b/examples/simple-react/src/components/sections/ConfirmTask.tsx index 7eac3ae..ce90c31 100644 --- a/examples/simple-react/src/components/sections/ConfirmTask.tsx +++ b/examples/simple-react/src/components/sections/ConfirmTask.tsx @@ -6,9 +6,9 @@ import { Button } from "../Button"; export function ConfirmTask() { const [taskId, setTaskId] = useState("2460577971"); const [github, setGithub] = useState("wfnuser"); - + const [taskPoints, setTaskPoints] = useState(10); const tryMe = async () => { - const taskInfo = await sdk.contract.confirmTask(taskId, github); + const taskInfo = await sdk.contract.confirmTask(taskId, github, taskPoints); console.log(taskInfo); }; @@ -17,15 +17,19 @@ export function ConfirmTask() {
- setTaskId(e.target.value)} - /> + setTaskId(e.target.value)} />
setGithub(e.target.value)} />
+
+ + setTaskPoints(e.target.value)} + /> +
diff --git a/examples/simple-react/src/lib/youbet-sdk/options.ts b/examples/simple-react/src/lib/youbet-sdk/options.ts index ec0d843..99d0bdf 100644 --- a/examples/simple-react/src/lib/youbet-sdk/options.ts +++ b/examples/simple-react/src/lib/youbet-sdk/options.ts @@ -13,7 +13,7 @@ export const openCampusTestOptions: SdkCtorOptions = { networkOptions: { rpcUrl: 'https://open-campus-codex-sepolia.drpc.org', chainId: 656476, - contractAddress: '0xD5C57B49b58744202EB1e67F4b7e6cB1aD06844f', + contractAddress: '0xd8dcbd828a40f6590a5bee5095c38994dab3bdee', }, chainName: 'OpenCampus-Testnet', }; \ No newline at end of file diff --git a/packages/youbet-sdk/package.json b/packages/youbet-sdk/package.json index 69827d1..60b2796 100644 --- a/packages/youbet-sdk/package.json +++ b/packages/youbet-sdk/package.json @@ -1,6 +1,6 @@ { "name": "youbet-sdk", - "version": "0.0.14", + "version": "0.0.15", "description": "Awesome SDK it is.", "main": "./dist/cjs/main.js", "module": "./dist/esm/index.js", diff --git a/packages/youbet-sdk/src/lib/abi/bet.json b/packages/youbet-sdk/src/lib/abi/bet.json index 04ba9be..faec647 100644 --- a/packages/youbet-sdk/src/lib/abi/bet.json +++ b/packages/youbet-sdk/src/lib/abi/bet.json @@ -1,5 +1,12 @@ [ { "type": "constructor", "inputs": [], "stateMutability": "nonpayable" }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [{ "name": "", "type": "string", "internalType": "string" }], + "stateMutability": "view" + }, { "type": "function", "name": "_createGoal", @@ -42,7 +49,8 @@ "name": "confirmTask", "inputs": [ { "name": "_taskId", "type": "string", "internalType": "string" }, - { "name": "github", "type": "string", "internalType": "string" } + { "name": "github", "type": "string", "internalType": "string" }, + { "name": "taskPoints", "type": "uint256", "internalType": "uint256" } ], "outputs": [], "stateMutability": "nonpayable" @@ -57,13 +65,6 @@ "outputs": [], "stateMutability": "nonpayable" }, - { - "type": "function", - "name": "contractOwner", - "inputs": [], - "outputs": [{ "name": "", "type": "address", "internalType": "address" }], - "stateMutability": "view" - }, { "type": "function", "name": "createGoal", @@ -349,6 +350,15 @@ "outputs": [{ "name": "", "type": "address", "internalType": "address" }], "stateMutability": "view" }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { "name": "initialOwner", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "linkWallet", @@ -359,6 +369,27 @@ "outputs": [], "stateMutability": "nonpayable" }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [{ "name": "", "type": "address", "internalType": "address" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [{ "name": "", "type": "bytes32", "internalType": "bytes32" }], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, { "type": "function", "name": "settleGoal", @@ -377,6 +408,29 @@ "outputs": [], "stateMutability": "payable" }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { "name": "newOwner", "type": "address", "internalType": "address" } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { "name": "data", "type": "bytes", "internalType": "bytes" } + ], + "outputs": [], + "stateMutability": "payable" + }, { "type": "event", "name": "DebugLog", @@ -508,6 +562,38 @@ ], "anonymous": false }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, { "type": "event", "name": "ProjectCreated", @@ -615,6 +701,19 @@ ], "anonymous": false }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, { "type": "event", "name": "WalletLinked", @@ -633,5 +732,47 @@ } ], "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { "name": "target", "type": "address", "internalType": "address" } + ] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { "type": "error", "name": "ERC1967NonPayable", "inputs": [] }, + { "type": "error", "name": "FailedInnerCall", "inputs": [] }, + { "type": "error", "name": "InvalidInitialization", "inputs": [] }, + { "type": "error", "name": "NotInitializing", "inputs": [] }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { "name": "owner", "type": "address", "internalType": "address" } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { "name": "account", "type": "address", "internalType": "address" } + ] + }, + { "type": "error", "name": "UUPSUnauthorizedCallContext", "inputs": [] }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [{ "name": "slot", "type": "bytes32", "internalType": "bytes32" }] } ] diff --git a/packages/youbet-sdk/src/modules/contractModule.ts b/packages/youbet-sdk/src/modules/contractModule.ts index a721d06..8bc3f7b 100644 --- a/packages/youbet-sdk/src/modules/contractModule.ts +++ b/packages/youbet-sdk/src/modules/contractModule.ts @@ -110,9 +110,9 @@ export class ContractModule { await tx.wait(); } - async confirmTask(taskId: string, github: string): Promise { + async confirmTask(taskId: string, github: string, taskPoints: number): Promise { const contract = await this._getContract(); - const tx = await contract.confirmTask(taskId, github); + const tx = await contract.confirmTask(taskId, github, taskPoints); await tx.wait(); }