Async API Client
solana.rpc.async_api
Async API client to interact with the Solana JSON RPC Endpoint.
AsyncClient
Async client class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
endpoint
|
str | None
|
URL of the RPC endpoint. |
None
|
commitment
|
Commitment | None
|
Default bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
timeout
|
float | None
|
HTTP request timeout in seconds. |
None
|
extra_headers
|
dict[str, str] | None
|
Extra headers to pass for HTTP request. |
None
|
proxy
|
str | None
|
Proxy URL to pass to the HTTP client. |
None
|
rate_limit
|
float
|
Maximum requests per second. |
0
|
max_connections
|
int | None
|
Maximum number of concurrent connections. |
None
|
max_keepalive_connections
|
int | None
|
Maximum number of idle keep-alive connections. |
None
|
keepalive_expiry
|
float | None
|
Idle keep-alive connection expiry in seconds. |
None
|
http2
|
bool
|
Enable HTTP/2 support. |
True
|
max_transport_retries
|
int
|
Maximum number of times to retry httpx2 transport errors. |
DEFAULT_MAX_TRANSPORT_RETRIES
|
Source code in src/solana/rpc/async_api.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | |
__init__(endpoint=None, commitment=None, timeout=None, extra_headers=None, proxy=None, rate_limit=0, max_connections=None, max_keepalive_connections=None, keepalive_expiry=None, http2=True, max_transport_retries=async_http_provider.DEFAULT_MAX_TRANSPORT_RETRIES)
Init API client.
Source code in src/solana/rpc/async_api.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
close()
async
Use this when you are done with the client.
Source code in src/solana/rpc/async_api.py
150 151 152 | |
confirm_transaction(tx_sig, commitment=None, sleep_seconds=0.5, last_valid_block_height=None)
async
Confirm the transaction identified by the specified signature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_sig
|
Signature
|
the transaction signature to confirm. |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
sleep_seconds
|
float
|
The number of seconds to sleep when polling the signature status. |
0.5
|
last_valid_block_height
|
int | None
|
The block height by which the transaction would become invalid. |
None
|
Source code in src/solana/rpc/async_api.py
1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | |
get_account_info(pubkey, commitment=None, encoding='base64', data_slice=None)
async
Returns all the account info for the specified public key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of account to query |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
encoding
|
str
|
(optional) Encoding for Account data, either "base58" (slow), "base64", or "jsonParsed". Default is "base64".
If jsonParsed is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the data field is type. (jsonParsed encoding is UNSTABLE). |
'base64'
|
data_slice
|
DataSliceOpts | None
|
(optional) Option to limit the returned account data using the provided |
None
|
Example
from solders.pubkey import Pubkey solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_account_info(Pubkey([0] * 31 + [1]))).value # doctest: +SKIP Account( Account { lamports: 4104230290, data.len: 0, owner: 11111111111111111111111111111111, executable: false, rent_epoch: 371, }, )
Source code in src/solana/rpc/async_api.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
get_account_info_json_parsed(pubkey, commitment=None)
async
Returns all the account info for the specified public key.
If JSON formatting is not available for this account, base64 is returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of account to query |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
from solders.pubkey import Pubkey solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_account_info_json_parsed(Pubkey([0] * 31 + [1]))).value.owner # doctest: +SKIP Pubkey( 11111111111111111111111111111111, )
Source code in src/solana/rpc/async_api.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |
get_balance(pubkey, commitment=None)
async
Returns the balance of the account of provided Pubkey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of account to query |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
from solders.pubkey import Pubkey solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_balance(Pubkey([0] * 31 + [1]))).value # doctest: +SKIP 0
Source code in src/solana/rpc/async_api.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
get_block(slot, encoding='json', max_supported_transaction_version=None, transaction_details=None, rewards=None, commitment=None)
async
Returns identity and transaction information about a confirmed block in the ledger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
int
|
Slot, as u64 integer. |
required |
encoding
|
str
|
(optional) Encoding for the returned Transaction, either "json", "jsonParsed", "base58" (slow), or "base64". If parameter not provided, the default encoding is JSON. |
'json'
|
max_supported_transaction_version
|
int | None
|
(optional) The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned |
None
|
transaction_details
|
TransactionDetails | None
|
(optional) Level of transaction detail to return. |
None
|
rewards
|
bool | None
|
(optional) Whether to populate the rewards array. |
None
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_block(1)).value.blockhash # doctest: +SKIP Hash( EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG, )
Source code in src/solana/rpc/async_api.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | |
get_block_commitment(slot)
async
Fetch the commitment for particular block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
int
|
Block, identified by Slot. |
required |
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_block_commitment(0)).total_stake # doctest: +SKIP 497717120
Source code in src/solana/rpc/async_api.py
287 288 289 290 291 292 293 294 295 296 297 298 299 | |
get_block_height(commitment=None)
async
Returns the current block height of the node.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_block_height()).value # doctest: +SKIP 1233
Source code in src/solana/rpc/async_api.py
408 409 410 411 412 413 414 415 416 417 418 419 420 | |
get_block_time(slot)
async
Fetch the estimated production time of a block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slot
|
int
|
Block, identified by Slot. |
required |
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_block_time(5)).value # doctest: +SKIP 1598400007
Source code in src/solana/rpc/async_api.py
301 302 303 304 305 306 307 308 309 310 311 312 313 | |
get_blocks(start_slot, end_slot=None)
async
Returns a list of confirmed blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_slot
|
int
|
Start slot, as u64 integer. |
required |
end_slot
|
int | None
|
(optional) End slot, as u64 integer. |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_blocks(5, 10)).value # doctest: +SKIP [5, 6, 7, 8, 9, 10]
Source code in src/solana/rpc/async_api.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
get_cluster_nodes()
async
Returns information about all the nodes participating in the cluster.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_cluster_nodes()).value[0].tpu # doctest: +SKIP '139.178.65.155:8004'
Source code in src/solana/rpc/async_api.py
315 316 317 318 319 320 321 322 323 | |
get_epoch_info(commitment=None)
async
Returns information about the current epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_epoch_info()).value.epoch # doctest: +SKIP 0
Source code in src/solana/rpc/async_api.py
501 502 503 504 505 506 507 508 509 510 511 512 513 | |
get_epoch_schedule()
async
Returns epoch schedule information from this cluster's genesis config.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_epoch_schedule()).value.slots_per_epoch # doctest: +SKIP 8192
Source code in src/solana/rpc/async_api.py
515 516 517 518 519 520 521 522 523 | |
get_fee_for_message(message, commitment=None)
async
Returns the fee for a message.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
MessageV0
|
Message that the fee is requested for. |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
from solders.keypair import Keypair from solders.system_program import TransferParams, transfer from solders.message import MessageV0 leading_zeros = [0] * 31 sender, receiver = Keypair.from_seed(leading_zeros + [1]), Keypair.from_seed(leading_zeros + [2]) solana_client = AsyncClient("http://localhost:8899") msg = MessageV0.try_compile( # doctest: +SKIP ... payer=sender.pubkey(), ... instructions=[transfer(TransferParams( ... from_pubkey=sender.pubkey(), to_pubkey=receiver.pubkey(), lamports=1000))], ... address_lookup_table_accounts=[], ... recent_blockhash=(await solana_client.get_latest_blockhash()).value.blockhash, ... ) (await solana_client.get_fee_for_message(msg)).value # doctest: +SKIP 5000
Source code in src/solana/rpc/async_api.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
get_first_available_block()
async
Returns the slot of the lowest confirmed block that has not been purged from the ledger.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_first_available_block()).value # doctest: +SKIP 1
Source code in src/solana/rpc/async_api.py
554 555 556 557 558 559 560 561 562 | |
get_genesis_hash()
async
Returns the genesis hash.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_genesis_hash()).value # doctest: +SKIP Hash( EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG, )
Source code in src/solana/rpc/async_api.py
564 565 566 567 568 569 570 571 572 573 574 | |
get_identity()
async
Returns the identity pubkey for the current node.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_identity()).value.identity # doctest: +SKIP Pubkey( 2LVtX3Wq5bhqAYYaUYBRknWaYrsfYiXLQBHTxtHWD2mv, )
Source code in src/solana/rpc/async_api.py
576 577 578 579 580 581 582 583 584 585 586 | |
get_inflation_governor(commitment=None)
async
Returns the current inflation governor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") await (solana_client.get_inflation_governor()).value.foundation # doctest: +SKIP 0.05
Source code in src/solana/rpc/async_api.py
588 589 590 591 592 593 594 595 596 597 598 599 600 | |
get_inflation_rate()
async
Returns the specific inflation values for the current epoch.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_inflation_rate()).value.epoch # doctest: +SKIP 1
Source code in src/solana/rpc/async_api.py
602 603 604 605 606 607 608 609 610 | |
get_inflation_reward(pubkeys, epoch=None, commitment=None)
async
Returns the inflation / staking reward for a list of addresses for an epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkeys
|
list[Pubkey]
|
An array of addresses to query, as base-58 encoded strings |
required |
epoch
|
int | None
|
(optional) An epoch for which the reward occurs. If omitted, the previous epoch will be used |
None
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized" or "confirmed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_inflation_reward()).value.amount # doctest: +SKIP 2500
Source code in src/solana/rpc/async_api.py
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | |
get_largest_accounts(filter_opt=None, commitment=None)
async
Returns the 20 largest accounts, by lamport balance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filter_opt
|
str | None
|
Filter results by account type; currently supported: circulating|nonCirculating. |
None
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_largest_accounts()).value[0].lamports # doctest: +SKIP 500000000000000000
Source code in src/solana/rpc/async_api.py
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | |
get_latest_blockhash(commitment=None)
async
Returns the latest block hash from the ledger.
Response also includes the last valid block height.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_latest_blockhash()).value # doctest: +SKIP RpcBlockhash { blockhash: Hash( 4TLzN2RAACFnd5TYpHcUi76pC3V1qkggRF29HWk2VLeT, ), last_valid_block_height: 158286487, }
Source code in src/solana/rpc/async_api.py
819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | |
get_leader_schedule(epoch=None, commitment=None)
async
Returns the leader schedule for an epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
int | None
|
Fetch the leader schedule for the epoch that corresponds to the provided slot. If unspecified, the leader schedule for the current epoch is fetched. |
None
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") resp = await solana_client.get_leader_schedule() # doctest: +SKIP list(resp.value.items())[0] # doctest: +SKIP (Pubkey( HMU77m6WSL9Xew9YvVCgz1hLuhzamz74eD9avi4XPdr, ), [346448, 346449, 346450, 346451, 369140, 369141, 369142, 369143, 384204, 384205, 384206, 384207])
Source code in src/solana/rpc/async_api.py
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | |
get_minimum_balance_for_rent_exemption(usize, commitment=None)
async
Returns minimum balance required to make account rent exempt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
usize
|
int
|
Account data length. |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_minimum_balance_for_rent_exemption(50)).value # doctest: +SKIP 1238880
Source code in src/solana/rpc/async_api.py
671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | |
get_minimum_ledger_slot()
async
Returns the lowest slot that the node has information about in its ledger.
This value may increase over time if the node is configured to purge older ledger data.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_minimum_ledger_slot()).value # doctest: +SKIP 1234
Source code in src/solana/rpc/async_api.py
1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | |
get_multiple_accounts(pubkeys, commitment=None, encoding='base64', data_slice=None)
async
Returns all the account info for a list of public keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkeys
|
list[Pubkey]
|
list of Pubkeys to query |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
encoding
|
str
|
(optional) Encoding for Account data, either "base58" (slow) or "base64".
|
'base64'
|
data_slice
|
DataSliceOpts | None
|
(optional) Option to limit the returned account data using the provided |
None
|
Example
from solders.pubkey import Pubkey solana_client = AsyncClient("http://localhost:8899") pubkeys = [Pubkey.from_string("6ZWcsUiWJ63awprYmbZgBQSreqYZ4s6opowP4b7boUdh"), Pubkey.from_string("HkcE9sqQAnjJtECiFsqGMNmUho3ptXkapUPAqgZQbBSY")] (await solana_client.get_multiple_accounts(pubkeys)).value[0].lamports # doctest: +SKIP 1
Source code in src/solana/rpc/async_api.py
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | |
get_multiple_accounts_json_parsed(pubkeys, commitment=None)
async
Returns all the account info for a list of public keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkeys
|
list[Pubkey]
|
list of Pubkeys to query |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
from solders.pubkey import Pubkey solana_client = AsyncClient("http://localhost:8899") pubkeys = [Pubkey.from_string("6ZWcsUiWJ63awprYmbZgBQSreqYZ4s6opowP4b7boUdh"), Pubkey.from_string("HkcE9sqQAnjJtECiFsqGMNmUho3ptXkapUPAqgZQbBSY")] asyncio.run(solana_client.get_multiple_accounts(pubkeys)).value[0].lamports # doctest: +SKIP 1
Source code in src/solana/rpc/async_api.py
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | |
get_program_accounts(pubkey, commitment=None, encoding=None, data_slice=None, filters=None)
async
Returns all accounts owned by the provided program Pubkey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of program |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
encoding
|
str | None
|
(optional) Encoding for the returned Transaction, either jsonParsed", "base58" (slow), or "base64". |
None
|
data_slice
|
DataSliceOpts | None
|
(optional) Limit the returned account data using the provided |
None
|
filters
|
Sequence[int | MemcmpOpts] | None
|
(optional) Options to compare a provided series of bytes with program account data at a particular offset.
Note: an int entry is converted to a |
None
|
Example
from solana.rpc.models import MemcmpOpts solana_client = AsyncClient("http://localhost:8899") memcmp_opts = MemcmpOpts(offset=4, bytes="3Mc6vR") pubkey = Pubkey.from_string("4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T") filters: list[int | MemcmpOpts] = [17, memcmp_opts] (await solana_client.get_program_accounts(pubkey, filters=filters)).value[0].account.lamports # doctest: +SKIP 1
Source code in src/solana/rpc/async_api.py
749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | |
get_program_accounts_json_parsed(pubkey, commitment=None, filters=None)
async
Returns all accounts owned by the provided program Pubkey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of program |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
filters
|
Sequence[int | MemcmpOpts] | None
|
(optional) Options to compare a provided series of bytes with program account data at a particular offset.
Note: an int entry is converted to a |
None
|
Example
from solana.rpc.models import MemcmpOpts solana_client = AsyncClient("http://localhost:8899") memcmp_opts = MemcmpOpts(offset=4, bytes="3Mc6vR") pubkey = Pubkey.from_string("4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T") filters: list[int | MemcmpOpts] = [17, memcmp_opts] (await solana_client.get_program_accounts(pubkey, filters=filters)).value[0].account.lamports # doctest: +SKIP 1
Source code in src/solana/rpc/async_api.py
787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 | |
get_recent_performance_samples(limit=None)
async
Returns a list of recent performance samples, in reverse slot order.
Performance samples are taken every 60 seconds and include the number of transactions and slots that occur in a given time window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
limit
|
int | None
|
Limit (optional) number of samples to return (maximum 720) |
None
|
Examples:
>>> solana_client = AsyncClient("http://localhost:8899")
>>> (await solana_client.get_recent_performance_samples(1)).value[0]
RpcPerfSample(
RpcPerfSample {
slot: 168036172,
num_transactions: 7159,
num_slots: 158,
sample_period_secs: 60,
},
)
Source code in src/solana/rpc/async_api.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | |
get_recent_prioritization_fees(addresses=None)
async
Returns a list of recent prioritization fees, in reverse slot order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
addresses
|
Sequence[Pubkey] | None
|
Account addresses to query. If omitted, the response includes recent prioritization fees from the node's recent blocks. |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_recent_prioritization_fees()).value[0] # doctest: +SKIP RpcPrioritizationFee( RpcPrioritizationFee { slot: 348125, prioritization_fee: 1000, }, )
Source code in src/solana/rpc/async_api.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | |
get_signature_statuses(signatures, search_transaction_history=False)
async
Returns the statuses of a list of signatures.
Unless the search_transaction_history configuration parameter is included, this method only
searches the recent status cache of signatures, which retains statuses for all active slots plus
MAX_RECENT_BLOCKHASHES rooted slots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signatures
|
list[Signature]
|
An array of transaction signatures to confirm. |
required |
search_transaction_history
|
bool
|
If true, a Solana node will search its ledger cache for any signatures not found in the recent status cache. |
False
|
Example
solana_client = AsyncClient("http://localhost:8899") raw_sigs = [ ... "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW", ... "5j7s6NiJS3JAkvgkoc18WVAsiSaci2pxB2A6ueCJP4tprA2TFg9wSyTLeYouxPBJEMzJinENTkpA52YStRW5Dia7"] sigs = [Signature.from_string(sig) for sig in raw_sigs] (await solana_client.get_signature_statuses(sigs)).value[0].confirmations # doctest: +SKIP 10
Source code in src/solana/rpc/async_api.py
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | |
get_signatures_for_address(account, before=None, until=None, limit=None, commitment=None, min_context_slot=None)
async
Returns confirmed signatures for transactions involving an address.
Signatures are returned backwards in time from the provided signature or most recent confirmed block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
Pubkey
|
Account to be queried. |
required |
before
|
Signature | None
|
(optional) Start searching backwards from this transaction signature. If not provided the search starts from the top of the highest max confirmed block. |
None
|
until
|
Signature | None
|
(optional) Search until this transaction signature, if found before limit reached. |
None
|
limit
|
int | None
|
(optional) Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). |
None
|
commitment
|
Commitment | None
|
(optional) Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
min_context_slot
|
int | None
|
(optional) The minimum slot that the request can be evaluated at. |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") from solders.pubkey import Pubkey pubkey = Pubkey.from_string("Vote111111111111111111111111111111111111111") (await solana_client.get_signatures_for_address(pubkey, limit=1)).value[0].signature # doctest: +SKIP Signature( 1111111111111111111111111111111111111111111111111111111111111111, )
Source code in src/solana/rpc/async_api.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
get_slot(commitment=None)
async
Returns the current slot the node is processing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_slot()).value # doctest: +SKIP 7515
Source code in src/solana/rpc/async_api.py
866 867 868 869 870 871 872 873 874 875 876 877 878 | |
get_slot_leader(commitment=None)
async
Returns the current slot leader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_slot_leader()).value # doctest: +SKIP Pubkey( dv2eQHeP4RFrJZ6UeiZWoc3XTtmtZCUKxxCApCDcRNV, )
Source code in src/solana/rpc/async_api.py
880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | |
get_slot_leaders(start, limit)
async
Returns the list of slot leaders for the provided start slot and limit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
int
|
The start slot to get the slot leaders from. |
required |
limit
|
int
|
The number of slot leaders to return. |
required |
Returns:
| Type | Description |
|---|---|
GetSlotLeadersResp
|
A list of slot leaders. |
Source code in src/solana/rpc/async_api.py
896 897 898 899 900 901 902 903 904 905 906 907 | |
get_supply(commitment=None, exclude_non_circulating_accounts_list=False)
async
Returns information about the current supply.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
exclude_non_circulating_accounts_list
|
bool
|
If True, exclude non-circulating accounts from supply. |
False
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_supply()).value.circulating # doctest: +SKIP 683635192454157660
Source code in src/solana/rpc/async_api.py
909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | |
get_token_account_balance(pubkey, commitment=None)
async
Returns the token balance of an SPL Token account (UNSTABLE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of Token account to query |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") pubkey = Pubkey.from_string("7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7") (await solana_client.get_token_account_balance(pubkey)).value.amount # noqa: E501 # doctest: +SKIP '9864'
Source code in src/solana/rpc/async_api.py
928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | |
get_token_accounts_by_delegate(delegate, opts, commitment=None)
async
Returns all SPL Token accounts by approved Delegate (UNSTABLE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delegate
|
Pubkey
|
Public key of the delegate owner to query. |
required |
opts
|
TokenAccountOpts
|
Token account option specifying at least one of |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Source code in src/solana/rpc/async_api.py
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | |
get_token_accounts_by_delegate_json_parsed(delegate, opts, commitment=None)
async
Returns all SPL Token accounts by approved delegate in JSON format (UNSTABLE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
delegate
|
Pubkey
|
Public key of the delegate owner to query. |
required |
opts
|
TokenAccountOpts
|
Token account option specifying at least one of |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Source code in src/solana/rpc/async_api.py
962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | |
get_token_accounts_by_owner(owner, opts, commitment=None)
async
Returns all SPL Token accounts by token owner (UNSTABLE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
owner
|
Pubkey
|
Public key of the account owner to query. |
required |
opts
|
TokenAccountOpts
|
Token account option specifying at least one of |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Source code in src/solana/rpc/async_api.py
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | |
get_token_accounts_by_owner_json_parsed(owner, opts, commitment=None)
async
Returns all SPL Token accounts by token owner in JSON format (UNSTABLE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
owner
|
Pubkey
|
Public key of the account owner to query. |
required |
opts
|
TokenAccountOpts
|
Token account option specifying at least one of |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Source code in src/solana/rpc/async_api.py
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | |
get_token_largest_accounts(pubkey, commitment=None)
async
Returns the 20 largest accounts of a particular SPL Token type.
Source code in src/solana/rpc/async_api.py
1010 1011 1012 1013 1014 1015 | |
get_token_supply(pubkey, commitment=None)
async
Returns the total supply of an SPL Token type.
Source code in src/solana/rpc/async_api.py
1017 1018 1019 1020 | |
get_transaction(tx_sig, encoding='json', commitment=None, max_supported_transaction_version=None)
async
Returns transaction details for a confirmed transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tx_sig
|
Signature
|
Transaction signature as base-58 encoded string N encoding attempts to use program-specific
instruction parsers to return more human-readable and explicit data in the
|
required |
encoding
|
str
|
(optional) Encoding for the returned Transaction, either "json", "jsonParsed", "base58" (slow), or "base64". If parameter not provided, the default encoding is JSON. |
'json'
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
max_supported_transaction_version
|
int | None
|
(optional) The max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") from solders.signature import Signature sig = Signature.from_string("3PtGYH77LhhQqTXP4SmDVJ85hmDieWsgXCUbn14v7gYyVYPjZzygUQhTk3bSTYnfA48vCM1rmWY7zWL3j1EVKmEy") (await solana_client.get_transaction(sig)).value.block_time # doctest: +SKIP 1234
Source code in src/solana/rpc/async_api.py
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | |
get_transaction_count(commitment=None)
async
Returns the current Transaction count from the ledger.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_transaction_count()).value # doctest: +SKIP 4554
Source code in src/solana/rpc/async_api.py
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 | |
get_version()
async
Returns the current solana versions running on the node.
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_version()).value.solana_core # doctest: +SKIP '1.13.2'
Source code in src/solana/rpc/async_api.py
1048 1049 1050 1051 1052 1053 1054 1055 1056 | |
get_vote_accounts(vote_pubkey=None, commitment=None, keep_unstaked_delinquents=None, delinquent_slot_distance=None)
async
Returns the account info and associated stake for all the voting accounts in the current bank.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vote_pubkey
|
Pubkey | None
|
Only return results for this validator vote address. |
None
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
keep_unstaked_delinquents
|
bool | None
|
Filter out delinquent validators with no stake. |
None
|
delinquent_slot_distance
|
int | None
|
Specify the number of slots behind the tip that the validator must fall to be considered delinquent. |
None
|
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.get_vote_accounts()).value.current[0].commission # doctest: +SKIP 100
Source code in src/solana/rpc/async_api.py
1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | |
is_connected()
async
Health check.
solana_client = AsyncClient("http://localhost:8899") asyncio.run(solana_client.is_connected()) # doctest: +SKIP True
Returns:
| Type | Description |
|---|---|
bool
|
True if the client is connected. |
Source code in src/solana/rpc/async_api.py
187 188 189 190 191 192 193 194 195 196 197 198 199 | |
request_airdrop(pubkey, lamports, commitment=None)
async
Requests an airdrop of lamports to a Pubkey.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pubkey
|
Pubkey
|
Pubkey of account to receive lamports, as base-58 encoded string or public key object. |
required |
lamports
|
int
|
Amount of lamports. |
required |
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
Example
from solders.pubkey import Pubkey solana_client = AsyncClient("http://localhost:8899") (await solana_client.request_airdrop(Pubkey([0] * 31 + [1]), 10000)).value # doctest: +SKIP Signature( 1111111111111111111111111111111111111111111111111111111111111111, )
Source code in src/solana/rpc/async_api.py
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | |
send_raw_transaction(txn, opts=None)
async
Send a transaction that has already been signed and serialized into the wire format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
txn
|
bytes
|
Transaction bytes. |
required |
opts
|
TxOpts | None
|
(optional) Transaction options. |
None
|
Before submitting, the following preflight checks are performed (unless disabled with the skip_preflight option):
- The transaction signatures are verified.
- The transaction is simulated against the latest max confirmed bank and on failure an error
will be returned. Preflight checks may be disabled if desired.
Example
solana_client = AsyncClient("http://localhost:8899") full_signed_tx_hex = ( ... '01b3795ccfaac3eee838bb05c3b8284122c18acedcd645c914fe8e178c3b62640d8616d061cc818b26cab8ecf3855ecc' ... '72fa113f731ecbd0215e88edc0309d6f0a010001031398f62c6d1a457c51ba6a4b5f3dbd2f69fca93216218dc8997e41' ... '6bd17d93ca68ab4677ffb1f2894dd0a6153c231d45ec436ae53ae60149dbe15f32e4b8703f0000000000000000000000' ... '000000000000000000000000000000000000000000839618f701ba7e9ba27ae59825dd6d6bb66d14f6d5d0eae215161d7' ... '1851a106901020200010c0200000040420f0000000000' ... ) (await solana_client.send_raw_transaction(bytes.fromhex(full_signed_tx_hex))).value # doctest: +SKIP Signature( 1111111111111111111111111111111111111111111111111111111111111111, )
Source code in src/solana/rpc/async_api.py
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | |
send_rpc_request(request, result_type, *, error_parser=None)
async
send_rpc_request(
request: JsonRpcRequest,
result_type: type[TResult],
*,
error_parser: JsonRpcErrorParser | None = None,
) -> TResult
send_rpc_request(
request: JsonRpcRequest,
result_type: Any,
*,
error_parser: JsonRpcErrorParser | None = None,
) -> Any
Send a raw JSON-RPC request and parse the result with the provided type.
Source code in src/solana/rpc/async_api.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
send_transaction(txn, opts=None)
async
Send a transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
txn
|
VersionedTransaction
|
transaction object. |
required |
opts
|
TxOpts | None
|
(optional) Transaction options. |
None
|
Example
from solders.keypair import Keypair from solders.system_program import TransferParams, transfer from solders.message import MessageV0 from solders.transaction import VersionedTransaction leading_zeros = [0] * 31 sender, receiver = Keypair.from_seed(leading_zeros + [1]), Keypair.from_seed(leading_zeros + [2]) ixns = [transfer(TransferParams( ... from_pubkey=sender.pubkey(), to_pubkey=receiver.pubkey(), lamports=1000))] client = AsyncClient("http://localhost:8899") msg = MessageV0.try_compile( # doctest: +SKIP ... payer=sender.pubkey(), ... instructions=ixns, ... address_lookup_table_accounts=[], ... recent_blockhash=(await client.get_latest_blockhash()).value.blockhash, ... ) (await client.send_transaction(VersionedTransaction(msg, [sender]))) # doctest: +SKIP
Source code in src/solana/rpc/async_api.py
1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | |
simulate_transaction(txn, sig_verify=False, commitment=None, replace_recent_blockhash=False, min_context_slot=None, inner_instructions=False, accounts_addresses=None, accounts_encoding='base64')
async
Simulate sending a transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
txn
|
VersionedTransaction
|
A transaction object. |
required |
sig_verify
|
bool
|
If True the transaction signatures will be verified
(conflicts with |
False
|
commitment
|
Commitment | None
|
Bank state to query. It can be either "finalized", "confirmed" or "processed". |
None
|
replace_recent_blockhash
|
bool
|
If True the transaction recent blockhash
will be replaced with the most recent blockhash
(conflicts with |
False
|
min_context_slot
|
int | None
|
The minimum slot that the request can be evaluated at. |
None
|
inner_instructions
|
bool
|
If true the response will include inner instructions.
These inner instructions will be |
False
|
accounts_addresses
|
list[Pubkey] | None
|
An array of accounts to return, as base-58 encoded strings |
None
|
accounts_encoding
|
str
|
Encoding for returned Account data. Note: jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. If jsonParsed is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the returned accounts field is type string. |
'base64'
|
Example
solana_client = AsyncClient("http://localhost:8899") full_signed_tx_hex = ( ... '01b3795ccfaac3eee838bb05c3b8284122c18acedcd645c914fe8e178c3b62640d8616d061cc818b26cab8ecf3855ecc' ... '72fa113f731ecbd0215e88edc0309d6f0a010001031398f62c6d1a457c51ba6a4b5f3dbd2f69fca93216218dc8997e41' ... '6bd17d93ca68ab4677ffb1f2894dd0a6153c231d45ec436ae53ae60149dbe15f32e4b8703f0000000000000000000000' ... '000000000000000000000000000000000000000000839618f701ba7e9ba27ae59825dd6d6bb66d14f6d5d0eae215161d7' ... '1851a106901020200010c0200000040420f0000000000' ... ) tx = VersionedTransaction.from_bytes(bytes.fromhex(full_signed_tx_hex)) (await solana_client.simulate_transaction(tx)).value.logs # doctest: +SKIP ['BPF program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success']
Source code in src/solana/rpc/async_api.py
1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | |
validator_exit()
async
Request to have the validator exit.
Validator must have booted with RPC exit enabled (--enable-rpc-exit parameter).
Example
solana_client = AsyncClient("http://localhost:8899") (await solana_client.validator_exit()).value # doctest: +SKIP True
Source code in src/solana/rpc/async_api.py
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | |