rippled
rippled copied to clipboard
AuthAccounts with AMMBid should be unique and !=sfAccount [Version: rippled-2.2.2]
Issue Description
Steps to Reproduce
import { encode, encodeForSigning } from 'ripple-binary-codec'
import { sign } from 'ripple-keypairs'
import { type AMMBid, AccountSetAsfFlags, Client, Wallet, xrpToDrops } from 'xrpl'
const client = new Client('wss://s.altnet.rippletest.net:51233/')
const main = async () => {
await client.connect()
const account = (await client.fundWallet()).wallet
console.log(account.address)
await client.submitAndWait(
{
TransactionType: 'AccountSet',
Account: account.address,
SetFlag: AccountSetAsfFlags.asfDefaultRipple,
},
{ wallet: account },
)
await client.submitAndWait(
{
TransactionType: 'AMMCreate',
Account: account.address,
Amount: xrpToDrops('10'),
Amount2: {
issuer: account.address,
currency: 'TST',
value: '1000000000',
},
TradingFee: 0.001,
},
{ wallet: account },
)
const response = await client.request({
command: 'amm_info',
asset: {
currency: 'XRP',
},
asset2: {
issuer: account.address,
currency: 'TST',
},
})
const lpToken = response.result.amm.lp_token
const acountInfo = await client.request({ command: 'account_info', account: account.address })
const Sequence = acountInfo.result.account_data.Sequence
const ledgerIndex = await client.getLedgerIndex()
const tx = {
TransactionType: 'AMMBid',
Account: account.address,
Fee: '100',
Asset: {
currency: 'XRP',
},
Asset2: {
issuer: account.address,
currency: 'TST',
},
BidMax: {
...lpToken,
value: '10000',
},
AuthAccounts: [
{ AuthAccount: { Account: account.address } },
{ AuthAccount: { Account: account.address } },
{ AuthAccount: { Account: account.address } },
{ AuthAccount: { Account: account.address } },
],
Sequence: Sequence,
SigningPubKey: account.publicKey,
LastLedgerSequence: ledgerIndex + 4,
} as AMMBid
tx.TxnSignature = sign(encodeForSigning(tx), account.privateKey)
const tx_blob = encode(tx)
await client.submitAndWait(tx_blob)
await client.disconnect()
}
main()
Expected Result
Transaction should be failed.
Actual Result
https://testnet.xrpl.org/transactions/D458FC31A063FAD895E122343A9FB6003918043781041CA6508EE814B2DC05C8/simple
Environment
rippled-2.2.2 (testnet)