Crate turdle_client

source ·
Expand description

Trdelnik is a suite of tools and libraries for testing, auditing and developing Solana / Anchor programs (smart contracts).

Trdelnik could be useful for writing Rust dApps, too.

Re-exports

Modules

Structs

Enums

Traits

  • An extension trait for Futures that provides a variety of convenient adapters.
  • Defines the id of a program.
  • Calculates the data for an instruction invocation, where the data is Sha256(<namespace>:<method_name>)[..8] || BorshSerialize(args). args is a borsh serialized struct of named fields for each argument given to an instruction.
  • Utility trait for printing transaction results.
  • The Signer trait declares operations that all digital signature providers must support. It is the primary interface by which signers are specified in Transaction signing interfaces
  • The TempClone trait is used as a workaround for making non-cloneable foreign types cloneable.
  • Transformation to AccountMeta structs.

Functions

  • Returns a recognisable Keypair / wallet that can be used for the mint account for example. The public key will start with Txxx, where xxx are the three digits of the number. You shouldn’t call the method with the same n twice. o is used instead of 0, as 0 is not part of the base58 charset. The n must be a number between 0 and 255.
  • Returns a recognisable Keypair of your created program. The public key will start with Pxx, where xx are the three digits of the number. o is used instead of 0, as 0 is not part of the base58 charset. You shouldn’t call the method with the same n twice. The n must be a number between 0 and 29.
  • Generate a random keypair.
  • Returns a system wallet (wallet which is owned by the system) but it is not required, you can also use the keypair method bellow. The public key will start with Sxx, where xx are the three digits of the number. You shouldn’t call the method with the same n twice. o is used instead of 0, as 0 is not part of the base58 charset. Returns a recognisable Keypair. This is NOT the same as anchor_lang::system_program::System::id()! The n must be a number between 0 and 29.

Attribute Macros

  • Define a fixture that you can use in all rstest’s test arguments. You should just mark your function as #[fixture] and then use it as a test’s argument. Fixture functions can also use other fixtures.
  • The attribute that you should use for your tests. Your annotated function’s arguments can be injected with [fixture]s, provided by parametrized cases or by value lists.
  • The macro starts the Solana validator (localnet), runs your program test and then shuts down the validator.