bet-test-sdk 1.2.9 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -248,7 +248,7 @@ const createAndBuyToken = async (sdk, testAccount) => {
248
248
  name: "TST-B",
249
249
  symbol: "TST-B",
250
250
  description: "TST-B: A test token",
251
- file: await fs.openAsBlob("example/basic/test.jpg"),
251
+ file: new File([await fs.openAsBlob("example/basic/test.jpg")], "test.jpg", { type: "image/jpeg" }),
252
252
  migrateDex: MigrateDex.Meteora,
253
253
  twitter: "https://example.x.com",
254
254
  createdOn: "https://test.bet.com",
@@ -458,10 +458,10 @@ async createAndBuy(
458
458
  - `finality`: Finality level (default: DEFAULT_FINALITY).
459
459
  - **Returns**: A promise that resolves to a `TransactionResult`.
460
460
 
461
- #### buy
461
+ #### buyWithSolAmount
462
462
 
463
463
  ```typescript
464
- async buy(
464
+ async buyWithSolAmount(
465
465
  buyer: Keypair,
466
466
  mint: PublicKey,
467
467
  buyAmountSol: bigint,
@@ -483,10 +483,35 @@ async buy(
483
483
  - `finality`: Finality level (default: DEFAULT_FINALITY).
484
484
  - **Returns**: A promise that resolves to a `TransactionResult`.
485
485
 
486
- #### sell
486
+ #### buyWithTokenAmount
487
487
 
488
488
  ```typescript
489
- async sell(
489
+ async buyWithTokenAmount(
490
+ buyer: Keypair,
491
+ mint: PublicKey,
492
+ buyAmountToken: bigint,
493
+ slippageBasisPoints: bigint = 500n,
494
+ priorityFees?: PriorityFee,
495
+ commitment: Commitment = DEFAULT_COMMITMENT,
496
+ finality: Finality = DEFAULT_FINALITY
497
+ ): Promise<TransactionResult>
498
+ ```
499
+
500
+ - Buys a specified amount of sols.
501
+ - **Parameters**:
502
+ - `buyer`: The keypair of the buyer.
503
+ - `mint`: The public key of the mint account.
504
+ - `buyAmountToken`: Amount of token to buy.
505
+ - `slippageBasisPoints`: Slippage in basis points (default: 500).
506
+ - `priorityFees`: Priority fees (optional).
507
+ - `commitment`: Commitment level (default: DEFAULT_COMMITMENT).
508
+ - `finality`: Finality level (default: DEFAULT_FINALITY).
509
+ - **Returns**: A promise that resolves to a `TransactionResult`.
510
+
511
+ #### sellWithTokenAmount
512
+
513
+ ```typescript
514
+ async sellWithTokenAmount(
490
515
  seller: Keypair,
491
516
  mint: PublicKey,
492
517
  sellTokenAmount: bigint,
@@ -508,6 +533,31 @@ async sell(
508
533
  - `finality`: Finality level (default: DEFAULT_FINALITY).
509
534
  - **Returns**: A promise that resolves to a `TransactionResult`.
510
535
 
536
+ #### sellWithSolAmount
537
+
538
+ ```typescript
539
+ async sellWithSolAmount(
540
+ seller: Keypair,
541
+ mint: PublicKey,
542
+ sellSolAmount: bigint,
543
+ slippageBasisPoints: bigint = 500n,
544
+ priorityFees?: PriorityFee,
545
+ commitment: Commitment = DEFAULT_COMMITMENT,
546
+ finality: Finality = DEFAULT_FINALITY
547
+ ): Promise<TransactionResult>
548
+ ```
549
+
550
+ - Sells a specified amount of tokens.
551
+ - **Parameters**:
552
+ - `seller`: The keypair of the seller.
553
+ - `mint`: The public key of the mint account.
554
+ - `sellSolAmount`: Amount of sols to sell.
555
+ - `slippageBasisPoints`: Slippage in basis points (default: 500).
556
+ - `priorityFees`: Priority fees (optional).
557
+ - `commitment`: Commitment level (default: DEFAULT_COMMITMENT).
558
+ - `finality`: Finality level (default: DEFAULT_FINALITY).
559
+ - **Returns**: A promise that resolves to a `TransactionResult`.
560
+
511
561
  #### addEventListener
512
562
 
513
563
  ```typescript
@@ -18604,7 +18604,7 @@ class BetSDK {
18604
18604
  const buyTokenAmount = this.getInitialBuyPrice(buyAmountSol); // token amount
18605
18605
  const buyTokenAmountWithSlippage = calculateMinOutWithSlippage(// token amount with slippage
18606
18606
  buyTokenAmount, slippageBasisPoints);
18607
- const buyTx = await this.getBuyInstructionsBySolAmount(creator, mintKeyPair.publicKey, buyAmountSol, buyTokenAmountWithSlippage);
18607
+ const buyTx = await this.getBuyInstructionsBySol(creator, mintKeyPair.publicKey, buyAmountSol, buyTokenAmountWithSlippage);
18608
18608
  newTx.add(buyTx);
18609
18609
  }
18610
18610
  return {