Skip to content

Commit f121a75

Browse files
ivpavici9oelM
andauthored
docs: small guides cleanup (#1048)
* docs: fix nodeUrl code typo (#1046) * docs: small guides cleanup --------- Co-authored-by: Joel Mun <[email protected]>
1 parent 5265995 commit f121a75

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

www/docs/guides/connect_account.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,11 @@ As a consequence of account abstraction, you can find accounts that uses Ethereu
8080
To connect to this type of account:
8181

8282
```typescript
83-
const myEthPrivateKey = "0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de";
84-
const myEthAccountAddressInStarknet = "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641";
83+
const myEthPrivateKey = '0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de';
84+
const myEthAccountAddressInStarknet =
85+
'0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641';
8586
const myEthSigner = new EthSigner(myEthPrivateKey);
86-
const myEthAccount = new Account(provider, myEthAccountAddressInStarknet, myEthSigner)
87+
const myEthAccount = new Account(provider, myEthAccountAddressInStarknet, myEthSigner);
8788
```
8889

8990
And if you need a random Ethereum private key:

www/docs/guides/create_account.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This contract is coded in Cairo 1.
2525
import { Account, constants, ec, json, stark, RpcProvider, hash, CallData } from 'starknet';
2626
```
2727

28-
### compute address
28+
### Compute address
2929

3030
```typescript
3131
// connect provider (Mainnet or Sepolia)
@@ -66,7 +66,7 @@ curl -X POST http://127.0.0.1:5050/mint -d '{"address":"0x04a093c37ab61065d00155
6666
// {"new_balance":50000000000000000000,"tx_hash":null,"unit":"wei"}
6767
```
6868

69-
### deployment of the new account
69+
### Deployment of the new account
7070

7171
If you have sent enough funds to this new address, you can go forward to the final step:
7272

@@ -91,7 +91,7 @@ Here, we will create a wallet with the Argent smart contract v0.3.0. The contrac
9191
import { Account, ec, json, stark, RpcProvider, hash, CallData } from 'starknet';
9292
```
9393

94-
### compute address
94+
### Compute address
9595

9696
```typescript
9797
// connect provider
@@ -124,7 +124,7 @@ If you want a specific private key, replace `stark.randomAddress`()` with your c
124124

125125
Then you have to fund this address.
126126

127-
### deployment of the new account
127+
### Deployment of the new account
128128

129129
If you have sent enough funds to this new address, you can go forward to the final step:
130130

@@ -223,8 +223,10 @@ The computed address has been funded automatically by minting a new dummy ETH in
223223

224224
## Create an Ethereum account
225225

226-
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.
227-
OpenZeppelin has released an account contract for a such Ethereum account. Here an example of account creation in Sepolia Testnet.
226+
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!
227+
OpenZeppelin has released an account contract for such an Ethereum account.
228+
229+
Below is an example of account creation in Sepolia Testnet.
228230

229231
### Compute address
230232

@@ -249,7 +251,7 @@ console.log('Pre-calculated ETH account address =', contractETHaddress);
249251

250252
Then you have to fund this address.
251253

252-
### deployment of the new account
254+
### Deployment of the new account
253255

254256
If you have sent enough funds to this new address, you can go forward to the final step:
255257

@@ -274,7 +276,7 @@ console.log('✅ New Ethereum account final address =', contract_address);
274276

275277
You are not limited to these 3 contracts. You can create your own contract for the wallet. It's the concept of Account Abstraction.
276278

277-
You can customize entirely the wallet - for example:
279+
You can entirely customize the wallet - for example:
278280

279281
- use a different concept of keys.
280282

www/docs/guides/define_call_message.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ To construct your tuple:
198198
const myTpl = { '0': '0x0a', '1': 200 };
199199
```
200200

201-
### named tuple
201+
### Named tuple
202202

203203
> [!IMPORTANT] Only for Cairo 0.
204204
@@ -242,28 +242,24 @@ If your abi is requesting this type : `core::starknet::secp256k1::Secp256k1Point
242242
- If you are using a calldata construction method using the Abi, you have just to use a 512 bits number (so, without parity) :
243243

244244
```typescript
245-
const privateKeyETH = "0x45397ee6ca34cb49060f1c303c6cb7ee2d6123e617601ef3e31ccf7bf5bef1f9";
245+
const privateKeyETH = '0x45397ee6ca34cb49060f1c303c6cb7ee2d6123e617601ef3e31ccf7bf5bef1f9';
246246
const ethSigner = new EthSigner(privateKeyETH);
247247
const ethFullPublicKey = await ethSigner.getPubKey(); // 512 bits number
248248
const myCallData = new CallData(ethAccountAbi);
249-
const accountETHconstructorCalldata = myCallData.compile(
250-
"constructor",
251-
{
252-
public_key: ethFullPublicKey
253-
}
254-
);
249+
const accountETHconstructorCalldata = myCallData.compile('constructor', {
250+
public_key: ethFullPublicKey,
251+
});
255252
```
256253

257254
- If you are using a calldata construction method without the Abi, you have to send a tuple of 2 u256 :
258255

259256
```typescript
260-
const ethFullPublicKey = "0x0178bb97615b49070eefad71cb2f159392274404e41db748d9397147cb25cf597ebfcf2f399e635b72b99b8f76e9080763c65a42c842869815039d912150ddfe"; // 512 bits number
261-
const pubKeyETH = encode.addHexPrefix(encode.removeHexPrefix(ethFullPublicKey).padStart(128, "0"));
257+
const ethFullPublicKey =
258+
'0x0178bb97615b49070eefad71cb2f159392274404e41db748d9397147cb25cf597ebfcf2f399e635b72b99b8f76e9080763c65a42c842869815039d912150ddfe'; // 512 bits number
259+
const pubKeyETH = encode.addHexPrefix(encode.removeHexPrefix(ethFullPublicKey).padStart(128, '0'));
262260
const pubKeyETHx = cairo.uint256(addAddressPadding(encode.addHexPrefix(pubKeyETH.slice(2, -64))));
263261
const pubKeyETHy = cairo.uint256(addAddressPadding(encode.addHexPrefix(pubKeyETH.slice(-64))));
264-
const accountETHconstructorCalldata = CallData.compile([
265-
cairo.tuple(pubKeyETHx, pubKeyETHy)
266-
]);
262+
const accountETHconstructorCalldata = CallData.compile([cairo.tuple(pubKeyETHx, pubKeyETHy)]);
267263
```
268264

269265
### struct
@@ -290,7 +286,7 @@ await myContract.my_function(myArray);
290286
291287
> It's also applicable for Cairo `Span` type.
292288
293-
### complex types
289+
### Complex types
294290

295291
You can mix and nest literals, arrays, structs, and tuples.
296292

@@ -321,7 +317,7 @@ await myContract.my_function(param1, param2, param3, param4);
321317

322318
There are 12 methods using contract parameters. Some types are authorized for each method:
323319

324-
### list of parameters
320+
### List of parameters
325321

326322
Only meta-class methods are using a list of parameters (as illustrated in the previous chapter).
327323
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
494490

495491
To use with `parseRequest: false` (see hereunder).
496492

497-
### summary table for arguments
493+
### Summary table for arguments
498494

499495
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:
500496

www/docs/guides/signature.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ try {
196196
All the previous examples are using the standard Starknet signature process, but you can also use the Ethereum one.
197197

198198
```typescript
199-
const myEthPrivateKey = "0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de";
200-
const myEthAccountAddressInStarknet = "0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641";
199+
const myEthPrivateKey = '0x525bc68475c0955fae83869beec0996114d4bb27b28b781ed2a20ef23121b8de';
200+
const myEthAccountAddressInStarknet =
201+
'0x65a822fbee1ae79e898688b5a4282dc79e0042cbed12f6169937fddb4c26641';
201202
const myEthSigner = new EthSigner(myEthPrivateKey);
202-
console.log("Complete public key =", await myEthSigner.getPubKey());
203+
console.log('Complete public key =', await myEthSigner.getPubKey());
203204
const sig0 = await myEthSigner.signMessage(message, myEthAccountAddressInStarknet);
204-
console.log("signature message =", sig0);
205+
console.log('signature message =', sig0);
205206
```

www/versioned_docs/version-5.24.3/guides/events.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ In this example, if you want to read the events recorded in the last 10 blocks,
120120
```typescript
121121
import { RpcProvider } from 'starknet';
122122
const providerRPC = new RpcProvider({
123-
nodeUrl: "{ nodeUrl: 'https://starknet-goerli.infura.io/v3/' + infuraKey }",
123+
nodeUrl: 'https://starknet-goerli.infura.io/v3/' + infuraKey,
124124
}); // for an Infura node on Testnet
125125
const lastBlock = await providerRPC.getBlock('latest');
126126
const keyFilter = [num.toHex(hash.starknetKeccak('EventPanic')), '0x8'];

0 commit comments

Comments
 (0)