Skip to content

Commit ce609b9

Browse files
committed
fix: versions, update: docs
1 parent cc146bd commit ce609b9

File tree

12 files changed

+450
-336
lines changed

12 files changed

+450
-336
lines changed

docs/pages/clients/client_async.mdx

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ import Callout from 'nextra-theme-docs/callout'
4949
- [get_transaction](#get_transaction)
5050
- [request_airdrop](#request_airdrop)
5151
- [send_transaction](#send_transaction)
52+
- [get_signature_statuses](#get_signature_statuses)
53+
- [get_slot](#get_slot)
5254

5355

5456
#### Attributes
@@ -394,10 +396,14 @@ Returns balance of tokens held in the specified token account.
394396

395397
<Code>
396398
```python
397-
def get_token_account_balance(public_key: PublicKey | str, **kwargs)
399+
async def get_token_account_balance(token_account: PublicKey | str, commitment: Optional[Commitment]=None)
398400
```
399401
</Code>
400402

403+
Parameters:
404+
- `token_account`: The public key of the token account
405+
- `commitment` (optional): The level of commitment desired when querying state
406+
401407
Example:
402408

403409
<Code>
@@ -416,14 +422,17 @@ print(tokens)
416422
</Code>
417423

418424
#### .get_transaction
419-
Sends a request to the Solana RPC endpoint to retrieve a transaction by its signature.
425+
Returns transaction details for a confirmed transaction signature.
420426

421427
<Code>
422428
```python
423-
async def get_transaction(self, signature: Text, commitment: Optional[Commitment]=None) -> RPCResponse[TransactionElementType] | TransactionElement
429+
async def get_transaction(signature: Text) -> RPCResponse
424430
```
425431
</Code>
426432

433+
Parameters:
434+
- `signature`: Transaction signature as base-58 encoded string
435+
427436
#### .request_airdrop
428437
Requests the amount of lamport specified to be airdropped to the public key.
429438

@@ -480,6 +489,37 @@ asyncio.run(main())
480489
```
481490
</Code>
482491

492+
#### .get_signature_statuses
493+
Returns signature statuses for confirmed transactions that include the given address in their accountKeys list. Returns signatures backwards in time from the provided signature or most recent confirmed block
494+
495+
<Code>
496+
```python
497+
async def get_signature_statuses()
498+
```
499+
</Code>
500+
501+
#### .get_slot
502+
Returns the current slot of the node.
503+
504+
<Code>
505+
```python
506+
async def get_slot()
507+
```
508+
</Code>
509+
510+
#### .build_and_send_request_async
511+
Internal method used to construct and send RPC requests to the Solana network.
512+
513+
<Code>
514+
```python
515+
async def build_and_send_request_async(method: Text, params: List[Any]) -> RPCResponse
516+
```
517+
</Code>
518+
519+
Parameters:
520+
- `method`: The RPC method name to call
521+
- `params`: List of parameters to pass to the RPC method
522+
483523

484524
## Attributes
485525
#### .endpoint

docs/pages/models/keypair.mdx

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,70 @@
11
import { Code } from '/components/Code';
22

33
# Keypair
4-
**Keypair is the combination of a public key and private key, any authorized action requires this.**
4+
**Keypair is the combination of a public key and private key. It handles key generation, signing, and key management.**
55

66
<Code>
7-
```python
8-
class Keypair(value: NaclPrivateKey | None = None)
9-
```
7+
```python
8+
class Keypair(value: NaclPrivateKey | None = None)
9+
```
1010
</Code>
1111

12-
> The value is required to initialise the object with an existing [nacl.Public.PrivateKey](https://pynacl.readthedocs.io/en/latest/public/#nacl.public.PrivateKey) object. To initialize with a private key as a string or bytes, use [from_private_key](#from_private_key) class method. Without the value a new keypair is generated.
12+
> The value is optional. Without a value, a new keypair is generated. If provided, it must be a [nacl.public.PrivateKey](https://pynacl.readthedocs.io/en/latest/public/#nacl.public.PrivateKey) object. To initialize with a private key as a string or bytes, use [from_private_key](#from_private_key) class method.
1313

1414
#### Methods
1515
- [sign](#sign)
1616
- [from_private_key](#from_private_key)
17+
- [from_file](#from_file)
1718

1819
#### Attributes
1920
- [public_key](#public_key)
2021
- [private_key](#private_key)
2122
- [key_pair](#key_pair)
2223

23-
2424
## Methods
2525

2626
#### .sign
27-
Signs a message which can be either a string or bytes.
27+
Signs a message using the keypair's private key.
2828

2929
<Code>
3030
```python
31-
def sign(message: str | bytes)
31+
def sign(message: str | bytes) -> SignedMessage
3232
```
3333
</Code>
3434

35+
> Returns a SignedMessage object from PyNaCl. The message can be either a UTF-8 string or bytes.
36+
3537
#### .from_private_key
36-
Initializes the keypair object using a private key, which can be either a string or bytes.
38+
Class method that creates a Keypair from an existing private key.
39+
40+
<Code>
41+
```python
42+
@classmethod
43+
def from_private_key(cls, private_key: str | List[int]) -> Keypair
44+
```
45+
</Code>
46+
47+
> Accepts either a base58-encoded string or a list of integers representing the private key. Returns a new Keypair instance.
48+
49+
#### .from_file
50+
Class method that loads a Keypair from a JSON file containing the private key.
3751

3852
<Code>
3953
```python
40-
def from_private_key(private_key: str | bytes)
54+
@staticmethod
55+
def from_file(file_path: str) -> Keypair
4156
```
4257
</Code>
4358

59+
> Reads a JSON file containing the private key data and returns a new Keypair instance.
4460

4561
## Attributes
4662

4763
#### .public_key
48-
Returns the keypair object's public key.
64+
The keypair's public key as a PublicKey instance.
4965

5066
#### .private_key
51-
Returns the keypair object's private key.
67+
The keypair's private key as a PrivateKey instance.
5268

5369
#### .key_pair
54-
Returns the keypair value itself in bytes.
70+
The underlying NaclPrivateKey object used in bytes

docs/pages/models/publickey.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Code } from '/components/Code';
99
```
1010
</Code>
1111

12-
> The class requires one value argument to initialize which can be string, bytes, bytearray or int array form of the public key.
12+
> The class requires one value argument to initialize which can be string, bytes, bytearray or int array form of the public key. The public key must be exactly 32 bytes in length.
1313

1414
#### Methods
1515
- [base58_encode](#base58_encode)

docs/pages/models/transaction/instructions.mdx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ from solathon.core.instructions import *
2121

2222
## Instructions
2323
#### create_account
24-
Creates a program account. When sending the transaction, both existing account and new account keypairs need to be passed in the signers argument of the `Transaction` object.
24+
Creates a new program account. Both the funding account and new account must sign the transaction.
2525

2626
<Code>
2727
```python
@@ -31,7 +31,7 @@ def create_account(
3131
lamports: int,
3232
space: int,
3333
program_id: PublicKey
34-
)
34+
) -> Instruction
3535
```
3636
</Code>
3737

@@ -64,7 +64,7 @@ print("Transaction response: ", result)
6464
</Code>
6565

6666
#### create_account_with_seed
67-
Creates a program account using seed
67+
Creates a new program account at an address derived from a base public key and seed string.
6868

6969
<Code>
7070
```python
@@ -76,12 +76,14 @@ def create_account_with_seed(
7676
lamports: int,
7777
space: int,
7878
program_id: PublicKey
79-
)
79+
) -> Instruction
8080
```
8181
</Code>
8282

83+
> Note: If base_public_key is different from from_public_key, the base public key must also sign the transaction.
84+
8385
#### allocate
84-
Allocates bytes for an account, this can only be used once for an account without any space already.
86+
Allocates space in an account without transferring lamports.
8587

8688
<Code>
8789
```python
@@ -117,7 +119,7 @@ print("Transaction response: ", result)
117119
</Code>
118120

119121
#### allocate_with_seed
120-
Allocates bytes for an account with seed.
122+
Allocates space in an account at an address derived from a base public key and seed string.
121123

122124
<Code>
123125
```python
@@ -127,19 +129,19 @@ def allocate_with_seed(
127129
seed: str,
128130
space: int,
129131
program_id: PublicKey
130-
)
132+
) -> Instruction
131133
```
132134
</Code>
133135

134136
#### assign
135-
Assigns an existing account to a program.
137+
Assigns an account to a program.
136138

137139
<Code>
138140
```python
139141
def assign(
140142
account_public_key: PublicKey,
141143
program_id: PublicKey
142-
)
144+
) -> Instruction
143145
```
144146
</Code>
145147

@@ -170,15 +172,15 @@ print("Transaction response: ", result)
170172

171173

172174
#### transfer
173-
Transfers lamports between accounts
175+
Transfers lamports between accounts. The sender must sign the transaction.
174176

175177
<Code>
176178
```python
177179
def transfer(
178180
from_public_key: PublicKey | str,
179181
to_public_key: PublicKey | str,
180182
lamports: int
181-
)
183+
) -> Instruction
182184
```
183185
</Code>
184186

docs/pages/models/transaction/transaction.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { Code } from '/components/Code';
22
import Callout from 'nextra-theme-docs/callout'
33

44
# Transaction
5-
**Class representing a transaction model. This object is passed in [send_transaction](/models/client#send_transaction) method**
5+
**Class representing a Solana transaction. This object is used in [send_transaction](/models/client#send_transaction) method**
66

77
<Code>
8-
```python
9-
class Transaction(self, **config)
10-
```
8+
```python
9+
class Transaction(**config)
10+
```
1111
</Code>
1212

1313
> A completely empty transaction can be initialized without any config, the table below shows the available config options

0 commit comments

Comments
 (0)