Send place bid accept BNs
This commit is contained in:
parent
babe5bfa6d
commit
705d311bd9
|
@ -29,7 +29,7 @@ export async function sendPlaceBid(
|
||||||
auctionView: AuctionView,
|
auctionView: AuctionView,
|
||||||
accountsByMint: Map<string, TokenAccount>,
|
accountsByMint: Map<string, TokenAccount>,
|
||||||
// value entered by the user adjust to decimals of the mint
|
// value entered by the user adjust to decimals of the mint
|
||||||
amount: number,
|
amount: number | BN,
|
||||||
) {
|
) {
|
||||||
let signers: Keypair[][] = [];
|
let signers: Keypair[][] = [];
|
||||||
let instructions: TransactionInstruction[][] = [];
|
let instructions: TransactionInstruction[][] = [];
|
||||||
|
@ -64,7 +64,8 @@ export async function setupPlaceBid(
|
||||||
auctionView: AuctionView,
|
auctionView: AuctionView,
|
||||||
accountsByMint: Map<string, TokenAccount>,
|
accountsByMint: Map<string, TokenAccount>,
|
||||||
// value entered by the user adjust to decimals of the mint
|
// value entered by the user adjust to decimals of the mint
|
||||||
amount: number,
|
// If BN, then assume instant sale and decimals already adjusted.
|
||||||
|
amount: number | BN,
|
||||||
overallInstructions: TransactionInstruction[][],
|
overallInstructions: TransactionInstruction[][],
|
||||||
overallSigners: Keypair[][],
|
overallSigners: Keypair[][],
|
||||||
): Promise<BN> {
|
): Promise<BN> {
|
||||||
|
@ -84,7 +85,12 @@ export async function setupPlaceBid(
|
||||||
const mint = cache.get(
|
const mint = cache.get(
|
||||||
tokenAccount ? tokenAccount.info.mint : QUOTE_MINT,
|
tokenAccount ? tokenAccount.info.mint : QUOTE_MINT,
|
||||||
) as ParsedAccount<MintInfo>;
|
) as ParsedAccount<MintInfo>;
|
||||||
let lamports = toLamports(amount, mint.info) + accountRentExempt;
|
|
||||||
|
let lamports =
|
||||||
|
accountRentExempt +
|
||||||
|
(typeof amount === 'number'
|
||||||
|
? toLamports(amount, mint.info)
|
||||||
|
: amount.toNumber());
|
||||||
|
|
||||||
let bidderPotTokenAccount: string;
|
let bidderPotTokenAccount: string;
|
||||||
if (!auctionView.myBidderPot) {
|
if (!auctionView.myBidderPot) {
|
||||||
|
|
Loading…
Reference in New Issue