Skip to content

Commit 9b66248

Browse files
authored
Add test for pre swap state PDA (#45)
1 parent cee4c11 commit 9b66248

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package swap_validator
2+
3+
import (
4+
"testing"
5+
6+
"github.com/mr-tron/base58"
7+
"github.com/stretchr/testify/assert"
8+
"github.com/stretchr/testify/require"
9+
)
10+
11+
// Tests based on account created here https://solscan.io/tx/4kXywqQRqJXRnm8mzAVRYkL1YVwyAEi8rVVNzRYG3AAu73xqjxNdHKX6LgoFhon66ZWHJ8HU3QkAmiot7AGzXPzd
12+
13+
func TestPreSwapStateAddress(t *testing.T) {
14+
address, _, err := GetPreSwapStateAddress(&GetPreSwapStateAddressArgs{
15+
Source: mustBase58Decode("5nNBW1KhzHVbR4NMPLYPRYj3UN5vgiw5GrtpdK6eGoce"),
16+
Destination: mustBase58Decode("9Rgx4kjnYZBbeXXgbbYLT2FfgzrNHFUShDtp8dpHHjd2"),
17+
Nonce: mustBase58Decode("3SVPEF5HDcKLhVfKeAnbH5Azpyeuk2yyVjEjZbz4VhrL"),
18+
})
19+
require.NoError(t, err)
20+
assert.Equal(t, "Hh338LHJhkzPbDisGt5Lge8qkgc3RExvH7BdmKgnRQw9", base58.Encode(address))
21+
}

0 commit comments

Comments
 (0)