-
-
Notifications
You must be signed in to change notification settings - Fork 946
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b915696
commit 5b6e1cf
Showing
8 changed files
with
117 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
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
This file was deleted.
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
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
25 changes: 23 additions & 2 deletions
25
wallet/how-to/use-non-evm-networks/starknet/sign-starknet-data.md
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 |
---|---|---|
@@ -1,6 +1,27 @@ | ||
--- | ||
description: Sign Starknet data in MetaMask. | ||
description: Sign Starknet transactions in MetaMask. | ||
sidebar_position: 5 | ||
--- | ||
|
||
# Sign Starknet data | ||
# Sign Starknet transactions | ||
|
||
After the account is connected, you can sign a transaction using the `wallet.account.signer.signTransaction` function: | ||
```typescript | ||
const signStarknetTransaction = async (wallet, contractAddress, entrypoint, calldata) => { | ||
try { | ||
if(wallet?.isConnected !== true){ | ||
throw('Wallet not connected'); | ||
} | ||
|
||
// Send the transaction | ||
const result = await wallet?.account?.signer.signTransaction({ | ||
contractAddress: contractAddress, // The address of the contract | ||
entrypoint: entrypoint, // The function to call in the contract | ||
calldata: calldata // The parameters to pass to the function | ||
}); | ||
console.log('Transaction signed successfully:', result); | ||
return result; | ||
} catch (error) { | ||
console.error('Error signing transaction:', error); | ||
} | ||
}; |
Oops, something went wrong.