-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove lp.typeProvider, generate EventIdl for test event
- Loading branch information
1 parent
19c6384
commit 8ef6ef8
Showing
5 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package logpoller | ||
|
||
import ( | ||
"math/rand" | ||
"testing" | ||
"time" | ||
|
||
"github.com/gagliardetto/solana-go" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/smartcontractkit/chainlink-solana/pkg/solana/logpoller/utils" | ||
) | ||
|
||
func newRandomPublicKey(t *testing.T) PublicKey { | ||
privateKey, err := solana.NewRandomPrivateKey() | ||
require.NoError(t, err) | ||
pubKey := privateKey.PublicKey() | ||
return PublicKey(pubKey) | ||
} | ||
|
||
func newRandomEventSignature(t *testing.T) EventSignature { | ||
pubKey := newRandomPublicKey(t) | ||
return EventSignature(pubKey[:8]) | ||
} | ||
|
||
func newRandomLog(t *testing.T, filterID int64, chainID string, eventName string) Log { | ||
privateKey, err := solana.NewRandomPrivateKey() | ||
require.NoError(t, err) | ||
pubKey := privateKey.PublicKey() | ||
data := []byte("solana is fun") | ||
signature, err := privateKey.Sign(data) | ||
require.NoError(t, err) | ||
return Log{ | ||
FilterID: filterID, | ||
ChainID: chainID, | ||
LogIndex: rand.Int63n(1000), | ||
BlockHash: Hash(pubKey), | ||
BlockNumber: rand.Int63n(1000000), | ||
BlockTimestamp: time.Unix(1731590113, 0), | ||
Address: PublicKey(pubKey), | ||
EventSig: utils.Discriminator("event", eventName), | ||
SubkeyValues: [][]byte{{3, 2, 1}, {1}, {1, 2}, pubKey.Bytes()}, | ||
TxHash: Signature(signature), | ||
Data: data, | ||
SequenceNum: rand.Int63n(500), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters