bet-test-sdk 1.1.0 → 1.1.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.
@@ -15962,13 +15962,13 @@ const getTxDetails = async (connection, sig, commitment = DEFAULT_COMMITMENT, fi
15962
15962
 
15963
15963
  var MigrateType;
15964
15964
  (function (MigrateType) {
15965
- MigrateType[MigrateType["Raydium"] = 0] = "Raydium";
15966
- MigrateType[MigrateType["Meteora"] = 1] = "Meteora";
15965
+ MigrateType[MigrateType["RAYDIUM"] = 0] = "RAYDIUM";
15966
+ MigrateType[MigrateType["METEORA"] = 1] = "METEORA";
15967
15967
  })(MigrateType || (MigrateType = {}));
15968
15968
  var MigrateDex;
15969
15969
  (function (MigrateDex) {
15970
- MigrateDex["Raydium"] = "Raydium";
15971
- MigrateDex["Meteora"] = "Meteora";
15970
+ MigrateDex["RAYDIUM"] = "raydium";
15971
+ MigrateDex["METEORA"] = "meteora";
15972
15972
  })(MigrateDex || (MigrateDex = {}));
15973
15973
 
15974
15974
  function toCreateEvent(event) {
@@ -16097,6 +16097,8 @@ class CurveState {
16097
16097
  }
16098
16098
  }
16099
16099
 
16100
+ const u128 = (property) => struct$1([u64$1("low"), u64$1("high")], property);
16101
+ const toBigInt = ({ low, high }) => (BigInt(high.toString()) << 64n) + BigInt(low.toString());
16100
16102
  // "discriminator": [143,61,238,62,232,157,101,185]
16101
16103
  class BetState {
16102
16104
  discriminator;
@@ -16135,34 +16137,16 @@ class BetState {
16135
16137
  publicKey$3("mint"),
16136
16138
  publicKey$3("poolOfSol"),
16137
16139
  publicKey$3("poolOfToken"),
16138
- // u128("totalSolIn"),
16139
- // u128("totalTokenOut"),
16140
- // u128("totalSolOut"),
16141
- // u128("totalTokenIn"),
16142
- publicKey$3('totalSolInAndTotalTokenOut'),
16143
- publicKey$3('totalSolOutAndtotalTokenIn'),
16140
+ u128("totalSolIn"),
16141
+ u128("totalTokenOut"),
16142
+ u128("totalSolOut"),
16143
+ u128("totalTokenIn"),
16144
16144
  u8$1("migrateType"),
16145
16145
  bool("isWithdrawed"),
16146
16146
  bool("isCompted"),
16147
16147
  ]);
16148
16148
  let value = structure.decode(buffer);
16149
- // console.log("[value]", value);
16150
- return value;
16151
- // return new BetState(
16152
- // BigInt(value.discriminator),
16153
- // new PublicKey(value.creator),
16154
- // new PublicKey(value.curveState),
16155
- // new PublicKey(value.mint),
16156
- // new PublicKey(value.poolOfSol),
16157
- // new PublicKey(value.poolOfToken),
16158
- // BigInt(value.totalSolIn),
16159
- // BigInt(value.totalTokenOut),
16160
- // BigInt(value.totalSolOut),
16161
- // BigInt(value.totalTokenIn),
16162
- // value.migrateType,
16163
- // value.isWithdrawed,
16164
- // value.isCompted
16165
- // );
16149
+ return new BetState(BigInt(value.discriminator), new PublicKey(value.creator), new PublicKey(value.curveState), new PublicKey(value.mint), new PublicKey(value.poolOfSol), new PublicKey(value.poolOfToken), toBigInt(value.totalSolIn), toBigInt(value.totalTokenOut), toBigInt(value.totalSolOut), toBigInt(value.totalTokenIn), value.migrateType, value.isWithdrawed, value.isCompted);
16166
16150
  }
16167
16151
  }
16168
16152
 
@@ -21813,7 +21797,7 @@ class BetSDK {
21813
21797
  async getCreateAndBuyInstructions(creator, createTokenMetadata, buyAmountSol, slippageBasisPoints = 500n, commitment = DEFAULT_COMMITMENT) {
21814
21798
  let mintKeyPair = await this.createMint();
21815
21799
  let tokenMetadata = await this.createTokenMetadata(createTokenMetadata);
21816
- const migrateType = createTokenMetadata.migrateDex == MigrateDex.Meteora ? MigrateType.Meteora : MigrateType.Raydium;
21800
+ const migrateType = createTokenMetadata.migrateDex == MigrateDex.METEORA ? MigrateType.METEORA : MigrateType.RAYDIUM;
21817
21801
  let createTx = await this.getCreateInstructions(creator, createTokenMetadata.name, createTokenMetadata.symbol, tokenMetadata.data, migrateType, mintKeyPair);
21818
21802
  let newTx = new Transaction().add(createTx);
21819
21803
  const curveStateAccount = await this.getCurveStateAccount(mintKeyPair.publicKey, commitment);
@@ -21836,7 +21820,7 @@ class BetSDK {
21836
21820
  async getCreateInstructions(creator, name, symbol, uri, migrateType, mintKeyPair) {
21837
21821
  return this.program.methods
21838
21822
  .createToken({
21839
- migrateType: migrateType == MigrateType.Raydium ? { raydium: {} } : { meteora: {} },
21823
+ migrateType: migrateType == MigrateType.RAYDIUM ? { raydium: {} } : { meteora: {} },
21840
21824
  name: name,
21841
21825
  symbol: symbol,
21842
21826
  uri: uri