bet-test-sdk 1.2.1 → 1.2.3
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 +92 -0
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/types/bet.d.ts +5 -5
- package/dist/browser/types/bet.d.ts.map +1 -1
- package/dist/cjs/bet.d.ts +5 -5
- package/dist/cjs/bet.d.ts.map +1 -1
- package/dist/cjs/bet.js.map +1 -1
- package/dist/esm/bet.d.ts +5 -5
- package/dist/esm/bet.d.ts.map +1 -1
- package/dist/esm/bet.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -37,6 +37,98 @@ resolve: {
|
|
37
37
|
},
|
38
38
|
```
|
39
39
|
|
40
|
+
### BetSDK transaction
|
41
|
+
Get BetSDK transaction-related command methods.
|
42
|
+
|
43
|
+
#### getCreateAndBuyInstructions
|
44
|
+
|
45
|
+
```typescript
|
46
|
+
type CreateTokenMetadata = {
|
47
|
+
name: string;
|
48
|
+
symbol: string;
|
49
|
+
description: string;
|
50
|
+
migrateDex: MigrateDex;
|
51
|
+
file: Blob;
|
52
|
+
createdOn?: string;
|
53
|
+
twitter?: string;
|
54
|
+
telegram?: string;
|
55
|
+
discord?: string;
|
56
|
+
website?: string;
|
57
|
+
}
|
58
|
+
|
59
|
+
async getCreateAndBuyInstructions(
|
60
|
+
creator: PublicKey,
|
61
|
+
createTokenMetadata: CreateTokenMetadata,
|
62
|
+
buyAmountSol: bigint,
|
63
|
+
slippageBasisPoints: bigint = 500n,
|
64
|
+
commitment: Commitment = DEFAULT_COMMITMENT
|
65
|
+
): Promise<{
|
66
|
+
newTx: Transaction;
|
67
|
+
mintKeyPair: Keypair; // `mintKeyPair`: A Keypair to create a mint. This keypair needs to be used as a signer to sign the transaction.
|
68
|
+
}>
|
69
|
+
```
|
70
|
+
|
71
|
+
- **CreateTokenMetadata**:
|
72
|
+
- `name`: Token name.
|
73
|
+
- `symbol`: Token symbol.
|
74
|
+
- `description`: Token description.
|
75
|
+
- `migrateDex`: After completing the bet curve, the dex you want to migrate to currently only provides Raydium and Meteora. MigrateType can be imported from the SDK.
|
76
|
+
- `file`: Token logo file
|
77
|
+
- `createdOn`: On which platform was it created?
|
78
|
+
- `twitter`: X link
|
79
|
+
- `telegram`: Telegram link
|
80
|
+
- `discord`: Discord link
|
81
|
+
- `website`: website
|
82
|
+
|
83
|
+
- Creates a new token and buys it.
|
84
|
+
- **Parameters**:
|
85
|
+
- `creator`: The public key of the token creator.
|
86
|
+
- `createTokenMetadata`: Metadata for the token.(`migrateType` of createTokenMetadata: After completing the bet curve, the dex you want to migrate to currently only provides Raydium and Meteora. MigrateType can be imported from the SDK.)
|
87
|
+
- `buyAmountSol`: Amount of SOL to buy.
|
88
|
+
- `slippageBasisPoints`: Slippage in basis points (default: 500).
|
89
|
+
- `commitment`: Commitment level (default: DEFAULT_COMMITMENT).
|
90
|
+
- **Returns**: A promise that resolves to `{ newTx: Transaction; mintKeyPair: Keypair; }`.
|
91
|
+
|
92
|
+
#### getBuyInstructionsBySolAmount
|
93
|
+
|
94
|
+
```typescript
|
95
|
+
async getBuyInstructionsBySolAmount(
|
96
|
+
buyer: PublicKey,
|
97
|
+
mint: PublicKey,
|
98
|
+
buyAmountSol: bigint,
|
99
|
+
slippageBasisPoints: bigint = 500n,
|
100
|
+
commitment: Commitment = DEFAULT_COMMITMENT
|
101
|
+
): Promise<Transaction>
|
102
|
+
```
|
103
|
+
|
104
|
+
- Buys a specified amount of tokens by sol input.
|
105
|
+
- **Parameters**:
|
106
|
+
- `buyer`: The public key of the buyer.
|
107
|
+
- `mint`: The public key of the mint account.
|
108
|
+
- `buyAmountSol`: Amount of SOL to buy.
|
109
|
+
- `slippageBasisPoints`: Slippage in basis points (default: 500).
|
110
|
+
- `commitment`: Commitment level (default: DEFAULT_COMMITMENT).
|
111
|
+
- **Returns**: A promise that resolves to a `Transaction`.
|
112
|
+
|
113
|
+
#### getSellInstructionsByTokenAmount
|
114
|
+
|
115
|
+
```typescript
|
116
|
+
async getSellInstructionsByTokenAmount(
|
117
|
+
seller: PublicKey,
|
118
|
+
mint: PublicKey,
|
119
|
+
sellTokenAmount: bigint,
|
120
|
+
slippageBasisPoints: bigint = 500n,
|
121
|
+
): Promise<Transaction>
|
122
|
+
```
|
123
|
+
|
124
|
+
- Sells a specified amount of tokens.
|
125
|
+
- **Parameters**:
|
126
|
+
- `seller`: The public key of the seller.
|
127
|
+
- `mint`: The public key of the mint account.
|
128
|
+
- `sellTokenAmount`: Amount of tokens to sell.
|
129
|
+
- `slippageBasisPoints`: Slippage in basis points (default: 500)
|
130
|
+
- **Returns**: A promise that resolves to a `Transaction`.
|
131
|
+
|
40
132
|
## Usage Example
|
41
133
|
|
42
134
|
First you need to create a `.env` file and set your RPC URL like in the `.env.example`
|