swap amount input
This commit is contained in:
@@ -15,6 +15,14 @@ func transferInstructionData(amount uint64) solana.Base58 {
|
||||
return solana.Base58(data)
|
||||
}
|
||||
|
||||
func raydiumV4SwapInstructionData(discriminator byte, amountSpecified, otherAmountThreshold uint64) solana.Base58 {
|
||||
data := make([]byte, 17)
|
||||
data[0] = discriminator
|
||||
binary.LittleEndian.PutUint64(data[1:9], amountSpecified)
|
||||
binary.LittleEndian.PutUint64(data[9:17], otherAmountThreshold)
|
||||
return solana.Base58(data)
|
||||
}
|
||||
|
||||
func TestRaydiumV4SwapV2ParserAllowsTrailingReadonlyAccounts(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -33,7 +41,7 @@ func TestRaydiumV4SwapV2ParserAllowsTrailingReadonlyAccounts(t *testing.T) {
|
||||
swapInstruction := Instruction{
|
||||
Accounts: []int{0, 1, 2, 3, 4, 5, 6, 7, 8},
|
||||
ProgramIDIndex: 8,
|
||||
Data: solana.Base58([]byte{raydiumV4SwapBaseInV2Discriminator}),
|
||||
Data: raydiumV4SwapInstructionData(raydiumV4SwapBaseInV2Discriminator, 55, 42),
|
||||
}
|
||||
innerInstructions := InnerInstructions{
|
||||
Index: 0,
|
||||
|
||||
Reference in New Issue
Block a user