-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backmerge develop into main #39
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
114f579
fix: deployment
bluecco dbeefc9
chore: revert vercel.json
bluecco 1dc96db
fix(deps): Update starknet-react packages to 3.0.0-beta.3
Inukares 8bbb323
Merge remote-tracking branch 'origin/develop' into develop
Inukares 63ef765
Revert "fix(deps): Update starknet-react packages to 3.0.0-beta.3"
Inukares 0e5c62f
fix(deps): use new hooks for minting
Inukares 20fc4d7
fix(deps): update deps for hooks
Inukares 41f4904
Revert "fix(deps): update deps for hooks"
Inukares 9020e4f
Revert "fix(deps): use new hooks for minting"
Inukares 6d98350
fix(deps): update deps for hooks
Inukares ae5fd0e
fix(deps): update deps for hooks v2
Inukares b026169
fix(deps): use new hooks.
Inukares 27dc8ba
fix(deps): use only newest starknet react
Inukares 4954330
fix(deps): delete unused code
Inukares c271e9b
Allow the submit
Inukares f3eb2be
Merge pull request #37 from argentlabs/update-deps
Inukares a00db1a
fix: Use the newest starknetkit
Inukares 00536cb
Merge remote-tracking branch 'origin/develop' into update-starknet-kit
Inukares 2f050eb
fix: update pnpm lock
Inukares e340842
Merge pull request #38 from argentlabs/update-starknet-kit
Inukares File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ | |
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint", | ||
"prepare": "husky" | ||
"prepare": "husky", | ||
"format": "prettier --write ." | ||
}, | ||
"dependencies": { | ||
"@argent/x-sessions": "^6.7.4", | ||
|
@@ -20,18 +21,18 @@ | |
"@starknet-react/core": "^2.8.2", | ||
"colord": "^2.9.3", | ||
"framer-motion": "^11.2.10", | ||
"get-starknet-core": "^3.2.0", | ||
"get-starknet-core": "^4.0.0", | ||
"jotai": "^2.8.2", | ||
"lodash-es": "^4.17.21", | ||
"next": "14.2.4", | ||
"popmotion": "^11.0.5", | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1", | ||
"starknet": "^6.11.0", | ||
"starknet-react-chains-next": "npm:@starknet-react/[email protected].2", | ||
"starknet-react-core-next": "npm:@starknet-react/[email protected].2", | ||
"starknet-react-chains-next": "npm:@starknet-react/[email protected].3", | ||
"starknet-react-core-next": "npm:@starknet-react/[email protected].3", | ||
"starknetkit-latest": "npm:starknetkit@^1.1.9", | ||
"starknetkit-next": "npm:starknetkit@^2.2.25" | ||
"starknetkit-next": "npm:starknetkit@2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash-es": "^4.17.12", | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[ | ||
{ | ||
"type": "function", | ||
"name": "transfer", | ||
"state_mutability": "external", | ||
"inputs": [ | ||
{ | ||
"name": "recipient", | ||
"type": "core::starknet::contract_address::ContractAddress" | ||
}, | ||
{ | ||
"name": "amount", | ||
"type": "core::integer::u256" | ||
} | ||
], | ||
"outputs": [] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/app/withStarknetReactNext/_components/TransferWithStarknetReact.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { ETHTokenAddress } from "@/constants" | ||
import { lastTxHashAtom, lastTxStatusAtom } from "@/state/transactionState" | ||
import { bigDecimal } from "@argent/x-shared" | ||
import { Button, Flex, Heading, Input } from "@chakra-ui/react" | ||
import { | ||
Abi, | ||
useAccount, | ||
useContract, | ||
useSendTransaction, | ||
} from "starknet-react-core-next" | ||
import { useAtom, useSetAtom } from "jotai" | ||
import { useState } from "react" | ||
import Erc20Abi from "@/abi/ERC20TransferAbi.json" | ||
|
||
export const TransferWithStarknetReact = () => { | ||
const { account } = useAccount() | ||
const [transferTo, setTransferTo] = useState("") | ||
const [transferAmount, setTransferAmount] = useState("1") | ||
|
||
const [transactionStatus, setTransactionStatus] = useAtom(lastTxStatusAtom) | ||
const setLastTransactionHash = useSetAtom(lastTxHashAtom) | ||
|
||
const { contract } = useContract({ | ||
abi: Erc20Abi as Abi, | ||
address: ETHTokenAddress, | ||
}) | ||
|
||
const { error, sendAsync: transferWithStarknetReact } = useSendTransaction({ | ||
calls: | ||
contract && account?.address | ||
? [ | ||
contract.populate("transfer", [ | ||
account.address, | ||
Number(bigDecimal.parseEther(transferAmount).value), | ||
]), | ||
] | ||
: undefined, | ||
}) | ||
|
||
const buttonsDisabled = ["approve", "pending"].includes(transactionStatus) | ||
|
||
const handleTransferSubmit = async (e: React.FormEvent) => { | ||
try { | ||
e.preventDefault() | ||
setTransactionStatus("approve") | ||
const { transaction_hash } = await transferWithStarknetReact() | ||
setLastTransactionHash(transaction_hash) | ||
setTransactionStatus("pending") | ||
} catch (e) { | ||
console.error(e) | ||
console.error(error) | ||
setTransactionStatus("idle") | ||
} | ||
} | ||
|
||
return ( | ||
<Flex flex={1} width="full" gap={10}> | ||
<Flex | ||
as="form" | ||
onSubmit={handleTransferSubmit} | ||
direction="column" | ||
flex={1} | ||
p="4" | ||
gap="3" | ||
borderRadius="lg" | ||
> | ||
<Heading as="h2">Transfer token</Heading> | ||
|
||
<Input | ||
type="text" | ||
id="transfer-to" | ||
name="fname" | ||
placeholder="To" | ||
value={transferTo} | ||
onChange={(e) => setTransferTo(e.target.value)} | ||
/> | ||
|
||
<Input | ||
type="text" | ||
id="transfer-amount" | ||
name="fname" | ||
placeholder="Amount" | ||
value={transferAmount} | ||
onChange={(e) => setTransferAmount(e.target.value)} | ||
/> | ||
<br /> | ||
<Button | ||
colorScheme="primary" | ||
type="submit" | ||
isDisabled={buttonsDisabled} | ||
maxW="200px" | ||
> | ||
Transfer | ||
</Button> | ||
</Flex> | ||
</Flex> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't they publish the official release? I thought I saw that yesterday on slack