Skip to content

Commit

Permalink
feat: added tabs and v2 (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfrosty authored Nov 7, 2024
1 parent 8c084d1 commit 8d391c4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions content/cookbook/wallets/create-keypair.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,28 @@ are [connecting to a wallet](/content/cookbook/wallets/connect-wallet-react),
you do not need to worry about the keypair. Otherwise a keypair must be
generated for signing transactions.

<Tabs groupId="language" items={['web3.js v2', 'web3.js v1']}>

<Tab value="web3.js v2">

```javascript
import { generateKeyPairSigner } from "@solana/web3.js";

const signer = await generateKeyPairSigner();
console.log("address: ", signer.address);
```

</Tab>

<Tab value="web3.js v1">

```javascript
import { Keypair } from "@solana/web3.js";

const keypair = Keypair.generate();
console.log("address:", keypair.publicKey.toBase58());
```

</Tab>

</Tabs>

0 comments on commit 8d391c4

Please sign in to comment.