Skip to content

Commit

Permalink
remove rpc live test for Solana transaction message, it was intended …
Browse files Browse the repository at this point in the history
…for integration experiments
  • Loading branch information
ws4charlie committed Dec 2, 2024
1 parent c08ebfc commit a43696d
Showing 1 changed file with 0 additions and 44 deletions.
44 changes: 0 additions & 44 deletions zetaclient/chains/solana/rpc/rpc_live_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ package rpc_test

import (
"context"
"fmt"
"testing"

"github.com/gagliardetto/solana-go"
solanarpc "github.com/gagliardetto/solana-go/rpc"
"github.com/stretchr/testify/require"
"github.com/zeta-chain/node/pkg/coin"
"github.com/zeta-chain/node/zetaclient/chains/solana/observer"
"github.com/zeta-chain/node/zetaclient/chains/solana/rpc"
"github.com/zeta-chain/node/zetaclient/common"
)
Expand All @@ -20,7 +17,6 @@ func Test_SolanaRPCLive(t *testing.T) {
return
}

LiveTest_GetTransactionMessage(t)
LiveTest_GetTransactionWithVersion(t)
LiveTest_GetFirstSignatureForAddress(t)
LiveTest_GetSignaturesForAddressUntil(t)
Expand All @@ -45,46 +41,6 @@ func LiveTest_GetTransactionWithVersion(t *testing.T) {
})
}

func LiveTest_GetTransactionMessage(t *testing.T) {
// create a Solana devnet RPC client
client := solanarpc.New(solanarpc.DevNet_RPC)

// program address
gateway := solana.MustPublicKeyFromBase58("ZETAjseVjuFsxdRxo6MmTCvqFwb3ZHUx56Co3vCmGis")

// get all signatures for the address until the first signature
sig := solana.MustSignatureFromBase58(
"hrjQH7CJgZU675eDbM3JKKf3tAd3AYtKjtpdSN7bHT4FYPDsFKeJq1BMWjjYLsTJVh1xqE4YNBXwAh2sCE4nxUL",
)

txResult, err := client.GetTransaction(context.Background(), sig, &solanarpc.GetTransactionOpts{
Commitment: solanarpc.CommitmentFinalized,
MaxSupportedTransactionVersion: &solanarpc.MaxSupportedTransactionVersion0,
})
require.NoError(t, err)
require.Nil(t, txResult.Meta.Err)

// parse gateway instruction from tx result
inst, err := observer.ParseGatewayInstruction(txResult, gateway, coin.CoinType_Gas)
require.NoError(t, err)

// get the message
fmt.Printf("inst: %+v\n", inst)

// example transaction of version "0"
// https://explorer.solana.com/tx/Wqgj7hAaUUSfLzieN912G7GxyGHijzBZgY135NtuFtPRjevK8DnYjWwQZy7LAKFQZu582wsjuab2QP27VMUJzAi?cluster=devnet
txSig := solana.MustSignatureFromBase58(
"Wqgj7hAaUUSfLzieN912G7GxyGHijzBZgY135NtuFtPRjevK8DnYjWwQZy7LAKFQZu582wsjuab2QP27VMUJzAi",
)

t.Run("should get the transaction if the version is supported", func(t *testing.T) {
ctx := context.Background()
txResult, err := rpc.GetTransaction(ctx, client, txSig)
require.NoError(t, err)
require.NotNil(t, txResult)
})
}

func LiveTest_GetFirstSignatureForAddress(t *testing.T) {
// create a Solana devnet RPC client
client := solanarpc.New(solanarpc.DevNet_RPC)
Expand Down

0 comments on commit a43696d

Please sign in to comment.