diff --git a/www/docs/guides/connect_account.md b/www/docs/guides/connect_account.md index 4db2ebdb6..b5c0edb5b 100644 --- a/www/docs/guides/connect_account.md +++ b/www/docs/guides/connect_account.md @@ -80,10 +80,11 @@ As a consequence of account abstraction, you can find accounts that uses Ethereu To connect to this type of account: ```typescript -const myEthPrivateKey = "0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de"; -const myEthAccountAddressInStarknet = "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641"; +const myEthPrivateKey = '0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de'; +const myEthAccountAddressInStarknet = + '0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641'; const myEthSigner = new EthSigner(myEthPrivateKey); -const myEthAccount = new Account(provider, myEthAccountAddressInStarknet, myEthSigner) +const myEthAccount = new Account(provider, myEthAccountAddressInStarknet, myEthSigner); ``` And if you need a random Ethereum private key: diff --git a/www/docs/guides/create_account.md b/www/docs/guides/create_account.md index ac1ac2d2f..a8b13e284 100644 --- a/www/docs/guides/create_account.md +++ b/www/docs/guides/create_account.md @@ -25,7 +25,7 @@ This contract is coded in Cairo 1. import { Account, constants, ec, json, stark, RpcProvider, hash, CallData } from 'starknet'; ``` -### compute address +### Compute address ```typescript // connect provider (Mainnet or Sepolia) @@ -66,7 +66,7 @@ curl -X POST http://127.0.0.1:5050/mint -d '{"address":"0x04a093c37ab61065d00155 // {"new_balance":50000000000000000000,"tx_hash":null,"unit":"wei"} ``` -### deployment of the new account +### Deployment of the new account If you have sent enough funds to this new address, you can go forward to the final step: @@ -91,7 +91,7 @@ Here, we will create a wallet with the Argent smart contract v0.3.0. The contrac import { Account, ec, json, stark, RpcProvider, hash, CallData } from 'starknet'; ``` -### compute address +### Compute address ```typescript // connect provider @@ -124,7 +124,7 @@ If you want a specific private key, replace `stark.randomAddress`()` with your c Then you have to fund this address. -### deployment of the new account +### Deployment of the new account If you have sent enough funds to this new address, you can go forward to the final step: @@ -223,8 +223,10 @@ The computed address has been funded automatically by minting a new dummy ETH in ## Create an Ethereum account -Thanks to account abstraction, you can create in Starknet an account that old the cryptographic logic of an Ethereum account. By this way, you can use Ethereum private and public keys. -OpenZeppelin has released an account contract for a such Ethereum account. Here an example of account creation in Sepolia Testnet. +Thanks to account abstraction, you can create an account in Starknet that holds the cryptographic logic of an Ethereum account. This way, you can use Ethereum private and public keys! +OpenZeppelin has released an account contract for such an Ethereum account. + +Below is an example of account creation in Sepolia Testnet. ### Compute address @@ -249,7 +251,7 @@ console.log('Pre-calculated ETH account address =', contractETHaddress); Then you have to fund this address. -### deployment of the new account +### Deployment of the new account If you have sent enough funds to this new address, you can go forward to the final step: @@ -274,7 +276,7 @@ console.log('✅ New Ethereum account final address =', contract_address); You are not limited to these 3 contracts. You can create your own contract for the wallet. It's the concept of Account Abstraction. -You can customize entirely the wallet - for example: +You can entirely customize the wallet - for example: - use a different concept of keys. diff --git a/www/docs/guides/define_call_message.md b/www/docs/guides/define_call_message.md index b2ca4715d..8aa2965cd 100644 --- a/www/docs/guides/define_call_message.md +++ b/www/docs/guides/define_call_message.md @@ -198,7 +198,7 @@ To construct your tuple: const myTpl = { '0': '0x0a', '1': 200 }; ``` -### named tuple +### Named tuple > [!IMPORTANT] Only for Cairo 0. @@ -242,28 +242,24 @@ If your abi is requesting this type : `core::starknet::secp256k1::Secp256k1Point - If you are using a calldata construction method using the Abi, you have just to use a 512 bits number (so, without parity) : ```typescript -const privateKeyETH = "0x45397ee6ca34cb49060f1c303c6cb7ee2d6123e617601ef3e31ccf7bf5bef1f9"; +const privateKeyETH = '0x45397ee6ca34cb49060f1c303c6cb7ee2d6123e617601ef3e31ccf7bf5bef1f9'; const ethSigner = new EthSigner(privateKeyETH); const ethFullPublicKey = await ethSigner.getPubKey(); // 512 bits number const myCallData = new CallData(ethAccountAbi); -const accountETHconstructorCalldata = myCallData.compile( - "constructor", - { - public_key: ethFullPublicKey - } -); +const accountETHconstructorCalldata = myCallData.compile('constructor', { + public_key: ethFullPublicKey, +}); ``` - If you are using a calldata construction method without the Abi, you have to send a tuple of 2 u256 : ```typescript -const ethFullPublicKey = "0x0178bb97615b49070eefad71cb2f159392274404e41db748d9397147cb25cf597ebfcf2f399e635b72b99b8f76e9080763c65a42c842869815039d912150ddfe"; // 512 bits number -const pubKeyETH = encode.addHexPrefix(encode.removeHexPrefix(ethFullPublicKey).padStart(128, "0")); +const ethFullPublicKey = + '0x0178bb97615b49070eefad71cb2f159392274404e41db748d9397147cb25cf597ebfcf2f399e635b72b99b8f76e9080763c65a42c842869815039d912150ddfe'; // 512 bits number +const pubKeyETH = encode.addHexPrefix(encode.removeHexPrefix(ethFullPublicKey).padStart(128, '0')); const pubKeyETHx = cairo.uint256(addAddressPadding(encode.addHexPrefix(pubKeyETH.slice(2, -64)))); const pubKeyETHy = cairo.uint256(addAddressPadding(encode.addHexPrefix(pubKeyETH.slice(-64)))); -const accountETHconstructorCalldata = CallData.compile([ - cairo.tuple(pubKeyETHx, pubKeyETHy) -]); +const accountETHconstructorCalldata = CallData.compile([cairo.tuple(pubKeyETHx, pubKeyETHy)]); ``` ### struct @@ -290,7 +286,7 @@ await myContract.my_function(myArray); > It's also applicable for Cairo `Span` type. -### complex types +### Complex types You can mix and nest literals, arrays, structs, and tuples. @@ -321,7 +317,7 @@ await myContract.my_function(param1, param2, param3, param4); There are 12 methods using contract parameters. Some types are authorized for each method: -### list of parameters +### List of parameters Only meta-class methods are using a list of parameters (as illustrated in the previous chapter). A Meta-Class is a Class that has any of its properties determined at run-time. The Contract object uses a Contract's ABI to determine what methods are available. @@ -494,7 +490,7 @@ const getResponse = await myAccount.get_bal(specialParameters, { parseRequest: f To use with `parseRequest: false` (see hereunder). -### summary table for arguments +### Summary table for arguments These types of arguments can't be used at your convenience everywhere. Here is a table showing which types can be used in which function: diff --git a/www/docs/guides/signature.md b/www/docs/guides/signature.md index 30ab34f8a..35bbacad7 100644 --- a/www/docs/guides/signature.md +++ b/www/docs/guides/signature.md @@ -196,10 +196,11 @@ try { All the previous examples are using the standard Starknet signature process, but you can also use the Ethereum one. ```typescript -const myEthPrivateKey = "0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de"; -const myEthAccountAddressInStarknet = "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641"; +const myEthPrivateKey = '0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de'; +const myEthAccountAddressInStarknet = + '0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641'; const myEthSigner = new EthSigner(myEthPrivateKey); -console.log("Complete public key =", await myEthSigner.getPubKey()); +console.log('Complete public key =', await myEthSigner.getPubKey()); const sig0 = await myEthSigner.signMessage(message, myEthAccountAddressInStarknet); -console.log("signature message =", sig0); +console.log('signature message =', sig0); ``` diff --git a/www/versioned_docs/version-5.24.3/guides/events.md b/www/versioned_docs/version-5.24.3/guides/events.md index ba7de16bb..9de3e26f8 100644 --- a/www/versioned_docs/version-5.24.3/guides/events.md +++ b/www/versioned_docs/version-5.24.3/guides/events.md @@ -120,7 +120,7 @@ In this example, if you want to read the events recorded in the last 10 blocks, ```typescript import { RpcProvider } from 'starknet'; const providerRPC = new RpcProvider({ - nodeUrl: "{ nodeUrl: 'https://starknet-goerli.infura.io/v3/' + infuraKey }", + nodeUrl: 'https://starknet-goerli.infura.io/v3/' + infuraKey, }); // for an Infura node on Testnet const lastBlock = await providerRPC.getBlock('latest'); const keyFilter = [num.toHex(hash.starknetKeccak('EventPanic')), '0x8'];