Documentation
¶
Index ¶
- Constants
- type AccountBuilder
- type GetTransactionResponseBuilder
- func (b *GetTransactionResponseBuilder) Build() protocol.GetTransactionResponse
- func (b *GetTransactionResponseBuilder) WithLedger(ledger uint32) *GetTransactionResponseBuilder
- func (b *GetTransactionResponseBuilder) WithResultXDR(resultXDR string) *GetTransactionResponseBuilder
- func (b *GetTransactionResponseBuilder) WithStatus(status string) *GetTransactionResponseBuilder
- type MockRPCClient
- func (m *MockRPCClient) GetLedgerEntries(ctx context.Context, req protocol.GetLedgerEntriesRequest) (protocol.GetLedgerEntriesResponse, error)
- func (m *MockRPCClient) GetTransaction(ctx context.Context, req protocol.GetTransactionRequest) (protocol.GetTransactionResponse, error)
- func (m *MockRPCClient) LoadAccount(ctx context.Context, address string) (txnbuild.Account, error)
- func (m *MockRPCClient) Reset()
- func (m *MockRPCClient) SendTransaction(ctx context.Context, req protocol.SendTransactionRequest) (protocol.SendTransactionResponse, error)
- func (m *MockRPCClient) SimulateTransaction(ctx context.Context, req protocol.SimulateTransactionRequest) (protocol.SimulateTransactionResponse, error)
- type SendTransactionResponseBuilder
- func (b *SendTransactionResponseBuilder) Build() protocol.SendTransactionResponse
- func (b *SendTransactionResponseBuilder) WithError(errXDR string) *SendTransactionResponseBuilder
- func (b *SendTransactionResponseBuilder) WithHash(hash string) *SendTransactionResponseBuilder
- func (b *SendTransactionResponseBuilder) WithStatus(status string) *SendTransactionResponseBuilder
- type SimulationResponseBuilder
- func (b *SimulationResponseBuilder) Build() protocol.SimulateTransactionResponse
- func (b *SimulationResponseBuilder) WithAddressResult(address string) *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithAuth() *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithBoolResult(value bool) *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithError(err string) *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithI128Result(value int64) *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithMinResourceFee(fee int64) *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithTransactionData() *SimulationResponseBuilder
- func (b *SimulationResponseBuilder) WithU64Result(value uint64) *SimulationResponseBuilder
- type TestKeys
Constants ¶
const TestNetworkPassphrase = "Test SDF Network ; September 2015"
TestNetworkPassphrase is the passphrase used for testing
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBuilder ¶
type AccountBuilder struct {
// contains filtered or unexported fields
}
AccountBuilder helps construct mock account responses
func NewAccount ¶
func NewAccount(address string) *AccountBuilder
NewAccount creates a new account builder
func (*AccountBuilder) Build ¶
func (b *AccountBuilder) Build() *txnbuild.SimpleAccount
Build returns the constructed account
func (*AccountBuilder) WithSequence ¶
func (b *AccountBuilder) WithSequence(seq int64) *AccountBuilder
WithSequence sets the account sequence
type GetTransactionResponseBuilder ¶
type GetTransactionResponseBuilder struct {
// contains filtered or unexported fields
}
GetTransactionResponseBuilder helps construct mock get transaction responses
func NewGetTransactionResponse ¶
func NewGetTransactionResponse() *GetTransactionResponseBuilder
NewGetTransactionResponse creates a new get transaction response builder
func (*GetTransactionResponseBuilder) Build ¶
func (b *GetTransactionResponseBuilder) Build() protocol.GetTransactionResponse
Build returns the constructed response
func (*GetTransactionResponseBuilder) WithLedger ¶
func (b *GetTransactionResponseBuilder) WithLedger(ledger uint32) *GetTransactionResponseBuilder
WithLedger sets the ledger number
func (*GetTransactionResponseBuilder) WithResultXDR ¶
func (b *GetTransactionResponseBuilder) WithResultXDR(resultXDR string) *GetTransactionResponseBuilder
WithResultXDR sets the result XDR
func (*GetTransactionResponseBuilder) WithStatus ¶
func (b *GetTransactionResponseBuilder) WithStatus(status string) *GetTransactionResponseBuilder
WithStatus sets the transaction status
type MockRPCClient ¶
type MockRPCClient struct {
// Function hooks - set these to customize behavior in tests
LoadAccountFunc func(ctx context.Context, address string) (txnbuild.Account, error)
SimulateTransactionFunc func(ctx context.Context, req protocol.SimulateTransactionRequest) (protocol.SimulateTransactionResponse, error)
SendTransactionFunc func(ctx context.Context, req protocol.SendTransactionRequest) (protocol.SendTransactionResponse, error)
GetTransactionFunc func(ctx context.Context, req protocol.GetTransactionRequest) (protocol.GetTransactionResponse, error)
GetLedgerEntriesFunc func(ctx context.Context, req protocol.GetLedgerEntriesRequest) (protocol.GetLedgerEntriesResponse, error)
// Call tracking
LoadAccountCalls []string
SimulateTransactionCalls []protocol.SimulateTransactionRequest
SendTransactionCalls []protocol.SendTransactionRequest
GetTransactionCalls []protocol.GetTransactionRequest
}
MockRPCClient is a mock implementation of the Stellar RPC client for testing
func NewMockRPCClient ¶
func NewMockRPCClient() *MockRPCClient
NewMockRPCClient creates a new mock RPC client with default implementations
func (*MockRPCClient) GetLedgerEntries ¶
func (m *MockRPCClient) GetLedgerEntries(ctx context.Context, req protocol.GetLedgerEntriesRequest) (protocol.GetLedgerEntriesResponse, error)
GetLedgerEntries mocks the GetLedgerEntries method
func (*MockRPCClient) GetTransaction ¶
func (m *MockRPCClient) GetTransaction(ctx context.Context, req protocol.GetTransactionRequest) (protocol.GetTransactionResponse, error)
GetTransaction mocks the GetTransaction method
func (*MockRPCClient) LoadAccount ¶
LoadAccount mocks the LoadAccount method
func (*MockRPCClient) SendTransaction ¶
func (m *MockRPCClient) SendTransaction(ctx context.Context, req protocol.SendTransactionRequest) (protocol.SendTransactionResponse, error)
SendTransaction mocks the SendTransaction method
func (*MockRPCClient) SimulateTransaction ¶
func (m *MockRPCClient) SimulateTransaction(ctx context.Context, req protocol.SimulateTransactionRequest) (protocol.SimulateTransactionResponse, error)
SimulateTransaction mocks the SimulateTransaction method
type SendTransactionResponseBuilder ¶
type SendTransactionResponseBuilder struct {
// contains filtered or unexported fields
}
SendTransactionResponseBuilder helps construct mock send transaction responses
func NewSendTransactionResponse ¶
func NewSendTransactionResponse() *SendTransactionResponseBuilder
NewSendTransactionResponse creates a new send transaction response builder
func (*SendTransactionResponseBuilder) Build ¶
func (b *SendTransactionResponseBuilder) Build() protocol.SendTransactionResponse
Build returns the constructed response
func (*SendTransactionResponseBuilder) WithError ¶
func (b *SendTransactionResponseBuilder) WithError(errXDR string) *SendTransactionResponseBuilder
WithError sets an error on the response
func (*SendTransactionResponseBuilder) WithHash ¶
func (b *SendTransactionResponseBuilder) WithHash(hash string) *SendTransactionResponseBuilder
WithHash sets the transaction hash
func (*SendTransactionResponseBuilder) WithStatus ¶
func (b *SendTransactionResponseBuilder) WithStatus(status string) *SendTransactionResponseBuilder
WithStatus sets the transaction status
type SimulationResponseBuilder ¶
type SimulationResponseBuilder struct {
// contains filtered or unexported fields
}
SimulationResponseBuilder helps construct mock simulation responses
func NewSimulationResponse ¶
func NewSimulationResponse() *SimulationResponseBuilder
NewSimulationResponse creates a new simulation response builder
func (*SimulationResponseBuilder) Build ¶
func (b *SimulationResponseBuilder) Build() protocol.SimulateTransactionResponse
Build returns the constructed simulation response
func (*SimulationResponseBuilder) WithAddressResult ¶
func (b *SimulationResponseBuilder) WithAddressResult(address string) *SimulationResponseBuilder
WithAddressResult adds an address result to the simulation
func (*SimulationResponseBuilder) WithAuth ¶
func (b *SimulationResponseBuilder) WithAuth() *SimulationResponseBuilder
WithAuth adds mock auth entries for transaction signing
func (*SimulationResponseBuilder) WithBoolResult ¶
func (b *SimulationResponseBuilder) WithBoolResult(value bool) *SimulationResponseBuilder
WithBoolResult adds a bool result to the simulation
func (*SimulationResponseBuilder) WithError ¶
func (b *SimulationResponseBuilder) WithError(err string) *SimulationResponseBuilder
WithError sets an error on the simulation response
func (*SimulationResponseBuilder) WithI128Result ¶
func (b *SimulationResponseBuilder) WithI128Result(value int64) *SimulationResponseBuilder
WithI128Result adds an i128 result to the simulation
func (*SimulationResponseBuilder) WithMinResourceFee ¶
func (b *SimulationResponseBuilder) WithMinResourceFee(fee int64) *SimulationResponseBuilder
WithMinResourceFee sets the minimum resource fee
func (*SimulationResponseBuilder) WithTransactionData ¶
func (b *SimulationResponseBuilder) WithTransactionData() *SimulationResponseBuilder
WithTransactionData adds mock transaction data for submission
func (*SimulationResponseBuilder) WithU64Result ¶
func (b *SimulationResponseBuilder) WithU64Result(value uint64) *SimulationResponseBuilder
WithU64Result adds a u64 result to the simulation
type TestKeys ¶
type TestKeys struct {
TreasurySecret string
TreasuryPublic string
AdminSecret string
AdminPublic string
UserSecret string
UserPublic string
ContractID string
}
TestKeys contains test keypairs for testing
func NewTestKeys ¶
func NewTestKeys() *TestKeys
NewTestKeys returns a set of valid test keys These are deterministic keys for testing only