diff --git a/demo/with-next/abi/Andy.json b/demo/with-next/abi/Andy.json index 0c5f1086..fb5c9790 100644 --- a/demo/with-next/abi/Andy.json +++ b/demo/with-next/abi/Andy.json @@ -1,125 +1,4 @@ [ - { - "inputs": [ - { "internalType": "address", "name": "_usdcAddress", "type": "address" }, - { "internalType": "address", "name": "_permit2", "type": "address" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "id", "type": "uint256" } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" } - ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -159,180 +38,5 @@ "outputs": [], "stateMutability": "nonpayable", "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "createNFT", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "freeMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "getApproved", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "isApprovedForAll", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintPrice", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }], - "name": "ownerOf", - "outputs": [ - { "internalType": "address", "name": "owner", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "permit2", - "outputs": [ - { - "internalType": "contract ISignatureTransfer", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "id", "type": "uint256" } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "id", "type": "uint256" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "operator", "type": "address" }, - { "internalType": "bool", "name": "approved", "type": "bool" } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } - ], - "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenCounter", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } - ], - "name": "tokenURI", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "id", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "newOwner", "type": "address" } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "usdcToken", - "outputs": [ - { "internalType": "contract IERC20", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" } ] diff --git a/demo/with-next/abi/orb.json b/demo/with-next/abi/orb.json new file mode 100644 index 00000000..b36cb031 --- /dev/null +++ b/demo/with-next/abi/orb.json @@ -0,0 +1,30 @@ +[ + { + "type": "function", + "name": "mint", + "inputs": [ + { + "name": "signal", + "type": "address", + "internalType": "address" + }, + { + "name": "root", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "nullifierHash", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proof", + "type": "uint256[8]", + "internalType": "uint256[8]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + } +] diff --git a/demo/with-next/components/ClientContent/Transaction.tsx b/demo/with-next/components/ClientContent/Transaction.tsx index 992c41f2..a90b388d 100644 --- a/demo/with-next/components/ClientContent/Transaction.tsx +++ b/demo/with-next/components/ClientContent/Transaction.tsx @@ -10,7 +10,13 @@ import * as yup from "yup"; import { validateSchema } from "./helpers/validate-schema"; import DEXABI from "../../abi/DEX.json"; import ANDYABI from "../../abi/Andy.json"; -import { createPublicClient, http } from "viem"; +import ORBABI from "../../abi/orb.json"; +import { + createPublicClient, + decodeAbiParameters, + http, + parseAbiParameters, +} from "viem"; import { worldchain } from "viem/chains"; const sendTransactionSuccessPayloadSchema = yup.object({ @@ -181,6 +187,66 @@ export const SendTransaction = () => { setTransactionData(payload); }; + const onSendOrbTransactionClick = () => { + const deadline = Math.floor( + (Date.now() + 30 * 60 * 1000) / 1000 + ).toString(); + + const address = "0xf3f92a60e6004f3982f0fde0d43602fc0a30a0db"; + const permitTransfer = { + permitted: { + token: testTokens.worldchain.USDCE, + amount: "1000000", + }, + nonce: Date.now().toString(), + deadline, + }; + + console.log( + decodeAbiParameters( + parseAbiParameters("uint256[8]"), + "0x0ee140e3516f1ca89a95ac6960af057157447001e0009196d9617e5794d1394d04713410762300e0c8e5238f5faa1adde5a07da079aa4a5b9bf3fdafe61374131149c5f57bb5c9209fc34f04bf558f929d271a7c9511c4a9207a5bdc851f000b1c16b42ec819f6dbc70d041ddf34aed6b7104750c59094edd9ae3f043ae9e3290e173a4f750b8de4498fccbf3e769a04e122f92f60c5ca5a156b6ca73d9cb1571148d2ffd954a3feedc9a398fa197e7a6a64a2ee712e2b5ac43892ea9ec816c6083d1aea790eefba30eff83ce233c6472ad4f48417bde2d2b38c1494de22efed1cec8897a4ef913334967ffbf94102d95b70ae6d6578c66fdbf64c55418b5ac3" as `0x${string}` + )[0] + ); + + const permitTransferArgsForm = [ + [permitTransfer.permitted.token, permitTransfer.permitted.amount], + permitTransfer.nonce, + permitTransfer.deadline, + ]; + + const transferDetails = { + to: "0x640487Ce2c45bD05D03b65783c15aa1ac694cDb6", + requestedAmount: "1000000", + }; + + const transferDetailsArgsForm = [ + transferDetails.to, + transferDetails.requestedAmount, + ]; + + const payload = MiniKit.commands.sendTransaction({ + transaction: [ + { + address: "0xF3F92A60e6004f3982F0FdE0d43602fC0a30a0dB", + abi: ORBABI, + functionName: "mint", + args: [ + address, + "0x7548694f0144d414a064e50b83655679567706d5570055a63058c2a3e77e763", + "0x1a07348bdd01a39b3e4d6b0e50539b56639f1b173dfb1ec845251f319d33817a", + decodeAbiParameters( + parseAbiParameters("uint256[8]"), + "0x0f5af932c5ba8960596f1b2f668742d3618092318353318ec5166fe9eaaf44381893a22e5ab311bd9853f4832eb76f6020519b6e13bfa2f3e097d37435261bca066bc6cea60df41dbd0a91f2c6758c95e29c5b430108f0bdacf73f2401f2cdd90bf5f5bfac2ca6eacf15a11c6d1a15aa3da5ebd920771739fd1afbbbc948b6f505408f2293b1a1d719a48d6606af0ab7cbe2d368f8a3b1a464725b5e680a94c204079b1b7ba5508e852b3c7575ac41decb06fe39e335255bd1a5f04268eb560b269b0ee009fac478068465a6c9cf68541317d15180a57c31323569ed83c634df1c880ae470127f807c1ff7a3dc5d815a55fd95a463bf03810c82594e7c6ee02d" as `0x${string}` + )[0].map(String), + ], + }, + ], + }); + + console.log(JSON.stringify(payload, null, 2)); + }; + const onSendNestedTransactionClick = () => { const deadline = Math.floor( (Date.now() + 30 * 60 * 1000) / 1000 @@ -364,6 +430,12 @@ export const SendTransaction = () => { > Purchase NFT Permit2 +
diff --git a/packages/core/package.json b/packages/core/package.json index f7a4a994..47c67bb4 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,8 +1,8 @@ { "name": "@worldcoin/minikit-js", - "version": "0.0.38-internal-alpha", - "homepage": "https://docs.worldcoin.org/id/minikit", - "description": "Internal Alpha: Mini-kit JS is a lightweight sdk for building mini-apps compatible with World App", + "version": "1.0", + "homepage": "https://docs.worldcoin.org/mini-apps", + "description": "Minikit-js is our SDK for building mini-apps.", "license": "MIT", "private": false, "type": "module", diff --git a/packages/react/package.json b/packages/react/package.json index 031d49bd..85ec1181 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,8 +1,8 @@ { "name": "@worldcoin/minikit-react", - "version": "0.0.38-internal-alpha", - "homepage": "https://docs.worldcoin.org/id/minikit", - "description": "Internal Alpha: Mini-kit React is a set of hooks for building mini-apps", + "version": "1.0", + "homepage": "https://docs.worldcoin.org/mini-apps", + "description": "Minikit-react is a set of hooks for building mini-apps", "license": "MIT", "private": false, "type": "module",