-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add support for getTransaction RPC method
#68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 28 commits
67f829f
0243fa4
535a8e6
d8e3142
67eff6f
7cb6bfe
aacae82
11e2872
4a49327
8384ecf
bdd3069
2e5b5f6
1981470
fc01635
f91e335
ad43948
9b32a69
eb0f7b7
a5a4675
055997f
f499758
a2a35e8
e650430
0a6f8fa
20af877
1c7f4be
566e2ba
47b5964
9cf518a
f5a592a
fdb5640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,6 +189,14 @@ type GetAccountInfoParams = record { | |
| // Example: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" | ||
| type Pubkey = text; | ||
|
|
||
| // Ed25519 signature as a base-58 encoded string. | ||
| // Example: "5LrcE2f6uvydKRquEJ8xp19heGxSvqsVbcqUeFoiWbXe8JNip7ftPQNTAVPyTK7ijVdpkzmKKaAQR7MWMmujAhXD" | ||
| type Signature = text; | ||
|
|
||
| // A Solana blockhash as a bse58-encoded string. | ||
| // Example: "DzfXchZJoLMG3cNftcf2sw7qatkkuwQf4xH15N5wkKAb" | ||
| type Blockhash = text; | ||
|
|
||
| // Solana account info. | ||
| type AccountInfo = record { | ||
| // Number of lamports assigned to this account. | ||
|
|
@@ -241,6 +249,15 @@ type AccountEncoding = variant { | |
| jsonParsed; | ||
| }; | ||
|
|
||
| // The parameters for a Solana `getTransaction` RPC method call. | ||
| // TODO XC-293: documentation | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO |
||
| type GetTransactionParams = record { | ||
| signature: Signature; | ||
| commitment: opt CommitmentLevel; | ||
| maxSupportedTransactionVersion: opt nat8; | ||
| encoding: opt variant { base58; base64 }; | ||
| }; | ||
|
|
||
| // The parameters for a Solana `sendTransaction` RPC method call. | ||
| type SendTransactionParams = record { | ||
| // Fully-signed transaction, as encoded string. | ||
|
|
@@ -283,6 +300,9 @@ type MultiGetAccountInfoResult = variant { | |
| type GetBlockParams = record { | ||
| // Slot number of the block to fetch. | ||
| slot: Slot; | ||
| // Specifies what transaction details to include in the response. | ||
| // If this field is not specified, the default value of "none" will be used. | ||
| transactionDetails: opt variant { none; signatures }; | ||
|
ninegua marked this conversation as resolved.
Outdated
|
||
| // The commitment describes how finalized a block is at that point in time. | ||
| commitment: opt variant { confirmed; finalized }; | ||
| // The max transaction version to return in responses. | ||
|
|
@@ -303,15 +323,18 @@ type Timestamp = int64; | |
| type ConfirmedBlock = record { | ||
| // The blockhash of this block's parent, as base-58 encoded string; if the parent block is not | ||
| // available due to ledger cleanup, this field will return "11111111111111111111111111111111". | ||
| previousBlockhash: text; | ||
| previousBlockhash: Blockhash; | ||
| // The blockhash of this block, as base-58 encoded string. | ||
| blockhash: text; | ||
| blockhash: Blockhash; | ||
| // The slot index of this block's parent. | ||
| parentSlot: nat64; | ||
| // Estimated production time. | ||
| blockTime: opt Timestamp; | ||
| // The number of blocks beneath this block. | ||
| blockHeight: opt nat64; | ||
| // The signatures of the transactions in this block. Included if the request parameter `transactionDetails` is not | ||
| // `none`. | ||
| signatures: opt vec Signature; | ||
| }; | ||
|
|
||
| // Represents the result of a call to the `getBlock` Solana RPC method. | ||
|
|
@@ -324,6 +347,172 @@ type MultiGetBlockResult = variant { | |
| Inconsistent : vec record { RpcSource; GetBlockResult }; | ||
| }; | ||
|
|
||
| // TODO XC-293: Format and add documentation | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO |
||
| type CompiledInstruction = record { | ||
| data : text; | ||
| accounts : blob; | ||
| program_id_index : nat8; | ||
| stack_height : opt nat32; | ||
| }; | ||
| type EncodedTransaction = variant { | ||
| Binary : record { text; variant { base58; base64 } }; | ||
| LegacyBinary : text; | ||
| }; | ||
| type Instruction = variant { Compiled : CompiledInstruction }; | ||
| type InnerInstructions = record { | ||
| instructions : vec Instruction; | ||
| index : nat8; | ||
| }; | ||
| type InstructionError = variant { | ||
| ModifiedProgramId; | ||
| CallDepth; | ||
| Immutable; | ||
| GenericError; | ||
| ExecutableAccountNotRentExempt; | ||
| IncorrectAuthority; | ||
| PrivilegeEscalation; | ||
| ReentrancyNotAllowed; | ||
| InvalidInstructionData; | ||
| RentEpochModified; | ||
| IllegalOwner; | ||
| ComputationalBudgetExceeded; | ||
| ExecutableDataModified; | ||
| ExecutableLamportChange; | ||
| UnbalancedInstruction; | ||
| ProgramEnvironmentSetupFailure; | ||
| IncorrectProgramId; | ||
| UnsupportedSysvar; | ||
| UnsupportedProgramId; | ||
| AccountDataTooSmall; | ||
| NotEnoughAccountKeys; | ||
| AccountBorrowFailed; | ||
| InvalidRealloc; | ||
| AccountNotExecutable; | ||
| AccountNotRentExempt; | ||
| Custom : nat32; | ||
| AccountDataSizeChanged; | ||
| MaxAccountsDataAllocationsExceeded; | ||
| ExternalAccountLamportSpend; | ||
| ExternalAccountDataModified; | ||
| MissingAccount; | ||
| ProgramFailedToComplete; | ||
| MaxInstructionTraceLengthExceeded; | ||
| InvalidAccountData; | ||
| ProgramFailedToCompile; | ||
| ExecutableModified; | ||
| InvalidAccountOwner; | ||
| MaxSeedLengthExceeded; | ||
| AccountAlreadyInitialized; | ||
| AccountBorrowOutstanding; | ||
| ReadonlyDataModified; | ||
| UninitializedAccount; | ||
| InvalidArgument; | ||
| BorshIoError : text; | ||
| BuiltinProgramsMustConsumeComputeUnits; | ||
| MissingRequiredSignature; | ||
| DuplicateAccountOutOfSync; | ||
| MaxAccountsExceeded; | ||
| ArithmeticOverflow; | ||
| InvalidError; | ||
| InvalidSeeds; | ||
| DuplicateAccountIndex; | ||
| ReadonlyLamportChange; | ||
| InsufficientFunds; | ||
| }; | ||
| type LoadedAddresses = record { writable : vec Pubkey; readonly : vec Pubkey }; | ||
| type Reward = record { | ||
| lamports : int64; | ||
| commission : opt nat8; | ||
| pubkey : Pubkey; | ||
| reward_type : opt variant { Fee; Rent; Voting; Staking }; | ||
| post_balance : nat64; | ||
| }; | ||
| type TokenAmount = record { | ||
| decimals : nat8; | ||
| ui_amount : opt float64; | ||
| ui_amount_string : text; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: CamelCase (check also all the other added types like TransactionInfo, TransactionStatusMeta, etc)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah good point, I almost forgot. I didn't rename enum variants for the new types, I don't think this should be necessary. WDYT?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you mean here, could you clarify?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, yes, sorry, I meant that I didn't add
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ha I see, this I would actually do to follow the Solana API
Can also be done in a separate PR. |
||
| amount : text; | ||
| }; | ||
| type TransactionDetails = variant { none; signatures }; | ||
| type TransactionError = variant { | ||
|
lpahlavi marked this conversation as resolved.
|
||
| ProgramCacheHitMaxLimit; | ||
| InvalidAccountForFee; | ||
| AddressLookupTableNotFound; | ||
| MissingSignatureForFee; | ||
| WouldExceedAccountDataBlockLimit; | ||
| AccountInUse; | ||
| DuplicateInstruction : nat8; | ||
| AccountNotFound; | ||
| TooManyAccountLocks; | ||
| InvalidAccountIndex; | ||
| AlreadyProcessed; | ||
| WouldExceedAccountDataTotalLimit; | ||
| InvalidAddressLookupTableIndex; | ||
| SanitizeFailure; | ||
| ResanitizationNeeded; | ||
| InvalidRentPayingAccount; | ||
| MaxLoadedAccountsDataSizeExceeded; | ||
| InvalidAddressLookupTableData; | ||
| InvalidWritableAccount; | ||
| WouldExceedMaxAccountCostLimit; | ||
| InvalidLoadedAccountsDataSizeLimit; | ||
| InvalidProgramForExecution; | ||
| InstructionError : record { nat8; InstructionError }; | ||
| InsufficientFundsForRent : record { account_index : nat8 }; | ||
| UnsupportedVersion; | ||
| ClusterMaintenance; | ||
| WouldExceedMaxVoteCostLimit; | ||
| SignatureFailure; | ||
| ProgramAccountNotFound; | ||
| AccountLoadedTwice; | ||
| ProgramExecutionTemporarilyRestricted : record { account_index : nat8 }; | ||
| AccountBorrowOutstanding; | ||
| WouldExceedMaxBlockCostLimit; | ||
| InvalidAddressLookupTableOwner; | ||
| InsufficientFundsForFee; | ||
| CallChainTooDeep; | ||
| UnbalancedTransaction; | ||
| CommitCancelled; | ||
| BlockhashNotFound; | ||
| }; | ||
| type TransactionInfo = record { | ||
| block_time : opt Timestamp; | ||
| meta : opt TransactionStatusMeta; | ||
| transaction : EncodedTransaction; | ||
| slot : nat64; | ||
| version : opt variant { Legacy; Number : nat8 }; | ||
| }; | ||
| type TransactionStatusMeta = record { | ||
| fee : nat64; | ||
| status : variant { Ok; Err: TransactionError }; | ||
| inner_instructions : opt vec InnerInstructions; | ||
| post_token_balances : opt vec TransactionTokenBalance; | ||
| pre_balances : vec nat64; | ||
| post_balances : vec nat64; | ||
| return_data : opt record { data : text; program_id : Pubkey }; | ||
| log_messages : opt vec text; | ||
| rewards : opt vec Reward; | ||
| loaded_addresses : opt LoadedAddresses; | ||
| pre_token_balances : opt vec TransactionTokenBalance; | ||
| compute_units_consumed : opt nat64; | ||
| }; | ||
| type TransactionTokenBalance = record { | ||
| owner : opt Pubkey; | ||
| mint : text; | ||
| program_id : opt Pubkey; | ||
| account_index : nat8; | ||
| ui_token_amount : TokenAmount; | ||
| }; | ||
|
|
||
| // Represents the result of a call to the `getTransaction` Solana RPC method. | ||
| type GetTransactionResult = variant { Ok : opt TransactionInfo; Err : RpcError }; | ||
|
|
||
| // Represents an aggregated result from multiple RPC calls to the `getTransaction` Solana RPC method. | ||
| type MultiGetTransactionResult = variant { | ||
| Consistent : GetTransactionResult; | ||
| Inconsistent : vec record { RpcSource; GetTransactionResult }; | ||
| }; | ||
|
|
||
| // Represents a Solana slot | ||
| type Slot = nat64; | ||
|
|
||
|
|
@@ -336,11 +525,8 @@ type MultiGetSlotResult = variant { | |
| Inconsistent : vec record { RpcSource; GetSlotResult }; | ||
| }; | ||
|
|
||
| // First transaction signature embedded in the transaction, as base-58 encoded string. | ||
| type TransactionId = text; | ||
|
|
||
| // Represents the result of a call to the `sendTransaction` Solana RPC method. | ||
| type SendTransactionResult = variant { Ok : TransactionId; Err : RpcError }; | ||
| type SendTransactionResult = variant { Ok : Signature; Err : RpcError }; | ||
|
|
||
| // Represents an aggregated result from multiple RPC calls to the `sendTransaction` Solana RPC method. | ||
| type MultiSendTransactionResult = variant { | ||
|
|
@@ -435,6 +621,10 @@ service : (InstallArgs,) -> { | |
| getSlot : (RpcSources, opt GetSlotRpcConfig, opt GetSlotParams) -> (MultiGetSlotResult); | ||
| getSlotCyclesCost : (RpcSources, opt GetSlotRpcConfig, opt GetSlotParams) -> (RequestCostResult) query; | ||
|
|
||
| // Call the Solana `getTransaction` RPC method and return the resulting slot. | ||
| getTransaction : (RpcSources, opt RpcConfig, GetTransactionParams) -> (MultiGetTransactionResult); | ||
| getTransactionCyclesCost : (RpcSources, opt RpcConfig, GetTransactionParams) -> (RequestCostResult) query; | ||
|
|
||
| // Call the Solana `sendTransaction` RPC method and return the resulting transaction ID. | ||
| sendTransaction : (RpcSources, opt RpcConfig, SendTransactionParams) -> (MultiSendTransactionResult); | ||
| sendTransactionCyclesCost : (RpcSources, opt RpcConfig, SendTransactionParams) -> (RequestCostResult) query; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.