bet-test-sdk 1.3.4 → 1.3.6

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.
@@ -3,7 +3,7 @@ import * as borsh from '@coral-xyz/borsh';
3
3
  import { struct as struct$1, u64 as u64$1, publicKey as publicKey$3, u8 as u8$1, bool } from '@coral-xyz/borsh';
4
4
  import { getAssociatedTokenAddressSync, getAssociatedTokenAddress, getAccount, createAssociatedTokenAccountInstruction } from '@solana/spl-token';
5
5
 
6
- const PROGRAM_ID = "E3zXK7VRyn39uuyshkQCriRXUAsR1KKQXaJ55KyDW4bp";
6
+ const PROGRAM_ID = "AfxRoZzBxdtSLdr7Q77wbMrDUP9qGg6AD8CnSBz5Z1oN";
7
7
  const BET_API = "https://uatapi.terminus.bet/api";
8
8
  const BET_STATE_SEED = "bet-state";
9
9
  const CURVE_STATE_SEED = "curve-state";
@@ -16085,7 +16085,7 @@ class CurveState {
16085
16085
  if (isCompleted) {
16086
16086
  throw new Error("Curve is completed");
16087
16087
  }
16088
- solAmount = solAmount * (DENOMINATOR + FEE_BASIS_POINTS) / DENOMINATOR;
16088
+ solAmount = solAmount * (DENOMINATOR - FEE_BASIS_POINTS) / DENOMINATOR;
16089
16089
  return this.getBuyTokenAmountOutWithoutFee(solAmount);
16090
16090
  }
16091
16091
  // In token, out sol
@@ -16103,7 +16103,7 @@ class CurveState {
16103
16103
  let n = this.virtualSolReserves * tokenAmount;
16104
16104
  let i = this.virtualTokenReserves - tokenAmount;
16105
16105
  let r = n / i + 1n;
16106
- return r * (DENOMINATOR - FEE_BASIS_POINTS) / DENOMINATOR;
16106
+ return r * (DENOMINATOR + FEE_BASIS_POINTS) / DENOMINATOR;
16107
16107
  }
16108
16108
  // In token, out sol
16109
16109
  getSellPriceByToken(tokenAmount, isCompleted) {
@@ -16229,7 +16229,7 @@ class BetState {
16229
16229
  }
16230
16230
  }
16231
16231
 
16232
- var address = "E3zXK7VRyn39uuyshkQCriRXUAsR1KKQXaJ55KyDW4bp";
16232
+ var address = "AfxRoZzBxdtSLdr7Q77wbMrDUP9qGg6AD8CnSBz5Z1oN";
16233
16233
  var metadata = {
16234
16234
  name: "bet",
16235
16235
  version: "0.1.0",
@@ -16237,6 +16237,291 @@ var metadata = {
16237
16237
  description: "Created with Anchor"
16238
16238
  };
16239
16239
  var instructions = [
16240
+ {
16241
+ name: "airdrop",
16242
+ discriminator: [
16243
+ 113,
16244
+ 173,
16245
+ 36,
16246
+ 238,
16247
+ 38,
16248
+ 152,
16249
+ 22,
16250
+ 117
16251
+ ],
16252
+ accounts: [
16253
+ {
16254
+ name: "airdrop_operator",
16255
+ writable: true,
16256
+ signer: true
16257
+ },
16258
+ {
16259
+ name: "user",
16260
+ writable: true,
16261
+ signer: true
16262
+ },
16263
+ {
16264
+ name: "user_airdrop_state",
16265
+ writable: true,
16266
+ pda: {
16267
+ seeds: [
16268
+ {
16269
+ kind: "const",
16270
+ value: [
16271
+ 117,
16272
+ 115,
16273
+ 101,
16274
+ 114,
16275
+ 45,
16276
+ 115,
16277
+ 116,
16278
+ 97,
16279
+ 116,
16280
+ 101
16281
+ ]
16282
+ },
16283
+ {
16284
+ kind: "account",
16285
+ path: "user"
16286
+ }
16287
+ ]
16288
+ }
16289
+ },
16290
+ {
16291
+ name: "platform_mint",
16292
+ address: "yjeGWMvSZmf29Pbk4arhFrmbJsU8LNAxwd8DFdLucky"
16293
+ },
16294
+ {
16295
+ name: "pool_of_airdrop",
16296
+ pda: {
16297
+ seeds: [
16298
+ {
16299
+ kind: "const",
16300
+ value: [
16301
+ 112,
16302
+ 111,
16303
+ 111,
16304
+ 108,
16305
+ 45,
16306
+ 111,
16307
+ 102,
16308
+ 45,
16309
+ 97,
16310
+ 105,
16311
+ 114,
16312
+ 100,
16313
+ 114,
16314
+ 111,
16315
+ 112
16316
+ ]
16317
+ }
16318
+ ]
16319
+ }
16320
+ },
16321
+ {
16322
+ name: "pool_of_airdrop_token",
16323
+ writable: true,
16324
+ pda: {
16325
+ seeds: [
16326
+ {
16327
+ kind: "account",
16328
+ path: "pool_of_airdrop"
16329
+ },
16330
+ {
16331
+ kind: "const",
16332
+ value: [
16333
+ 6,
16334
+ 221,
16335
+ 246,
16336
+ 225,
16337
+ 215,
16338
+ 101,
16339
+ 161,
16340
+ 147,
16341
+ 217,
16342
+ 203,
16343
+ 225,
16344
+ 70,
16345
+ 206,
16346
+ 235,
16347
+ 121,
16348
+ 172,
16349
+ 28,
16350
+ 180,
16351
+ 133,
16352
+ 237,
16353
+ 95,
16354
+ 91,
16355
+ 55,
16356
+ 145,
16357
+ 58,
16358
+ 140,
16359
+ 245,
16360
+ 133,
16361
+ 126,
16362
+ 255,
16363
+ 0,
16364
+ 169
16365
+ ]
16366
+ },
16367
+ {
16368
+ kind: "account",
16369
+ path: "platform_mint"
16370
+ }
16371
+ ],
16372
+ program: {
16373
+ kind: "const",
16374
+ value: [
16375
+ 140,
16376
+ 151,
16377
+ 37,
16378
+ 143,
16379
+ 78,
16380
+ 36,
16381
+ 137,
16382
+ 241,
16383
+ 187,
16384
+ 61,
16385
+ 16,
16386
+ 41,
16387
+ 20,
16388
+ 142,
16389
+ 13,
16390
+ 131,
16391
+ 11,
16392
+ 90,
16393
+ 19,
16394
+ 153,
16395
+ 218,
16396
+ 255,
16397
+ 16,
16398
+ 132,
16399
+ 4,
16400
+ 142,
16401
+ 123,
16402
+ 216,
16403
+ 219,
16404
+ 233,
16405
+ 248,
16406
+ 89
16407
+ ]
16408
+ }
16409
+ }
16410
+ },
16411
+ {
16412
+ name: "user_token_account",
16413
+ writable: true,
16414
+ pda: {
16415
+ seeds: [
16416
+ {
16417
+ kind: "account",
16418
+ path: "user"
16419
+ },
16420
+ {
16421
+ kind: "const",
16422
+ value: [
16423
+ 6,
16424
+ 221,
16425
+ 246,
16426
+ 225,
16427
+ 215,
16428
+ 101,
16429
+ 161,
16430
+ 147,
16431
+ 217,
16432
+ 203,
16433
+ 225,
16434
+ 70,
16435
+ 206,
16436
+ 235,
16437
+ 121,
16438
+ 172,
16439
+ 28,
16440
+ 180,
16441
+ 133,
16442
+ 237,
16443
+ 95,
16444
+ 91,
16445
+ 55,
16446
+ 145,
16447
+ 58,
16448
+ 140,
16449
+ 245,
16450
+ 133,
16451
+ 126,
16452
+ 255,
16453
+ 0,
16454
+ 169
16455
+ ]
16456
+ },
16457
+ {
16458
+ kind: "account",
16459
+ path: "platform_mint"
16460
+ }
16461
+ ],
16462
+ program: {
16463
+ kind: "const",
16464
+ value: [
16465
+ 140,
16466
+ 151,
16467
+ 37,
16468
+ 143,
16469
+ 78,
16470
+ 36,
16471
+ 137,
16472
+ 241,
16473
+ 187,
16474
+ 61,
16475
+ 16,
16476
+ 41,
16477
+ 20,
16478
+ 142,
16479
+ 13,
16480
+ 131,
16481
+ 11,
16482
+ 90,
16483
+ 19,
16484
+ 153,
16485
+ 218,
16486
+ 255,
16487
+ 16,
16488
+ 132,
16489
+ 4,
16490
+ 142,
16491
+ 123,
16492
+ 216,
16493
+ 219,
16494
+ 233,
16495
+ 248,
16496
+ 89
16497
+ ]
16498
+ }
16499
+ }
16500
+ },
16501
+ {
16502
+ name: "token_program",
16503
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
16504
+ },
16505
+ {
16506
+ name: "associated_token_program",
16507
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
16508
+ },
16509
+ {
16510
+ name: "system_program",
16511
+ address: "11111111111111111111111111111111"
16512
+ }
16513
+ ],
16514
+ args: [
16515
+ {
16516
+ name: "params",
16517
+ type: {
16518
+ defined: {
16519
+ name: "AirdropParams"
16520
+ }
16521
+ }
16522
+ }
16523
+ ]
16524
+ },
16240
16525
  {
16241
16526
  name: "app_initialize",
16242
16527
  discriminator: [
@@ -16283,7 +16568,6 @@ var instructions = [
16283
16568
  },
16284
16569
  {
16285
16570
  name: "fee_recived",
16286
- writable: true,
16287
16571
  pda: {
16288
16572
  seeds: [
16289
16573
  {
@@ -17143,52 +17427,244 @@ var instructions = [
17143
17427
  }
17144
17428
  },
17145
17429
  {
17146
- name: "pool_of_sol",
17430
+ name: "pool_of_sol",
17431
+ writable: true,
17432
+ pda: {
17433
+ seeds: [
17434
+ {
17435
+ kind: "account",
17436
+ path: "bet_state"
17437
+ },
17438
+ {
17439
+ kind: "const",
17440
+ value: [
17441
+ 112,
17442
+ 111,
17443
+ 111,
17444
+ 108
17445
+ ]
17446
+ }
17447
+ ]
17448
+ }
17449
+ },
17450
+ {
17451
+ name: "pool_of_token",
17452
+ writable: true,
17453
+ pda: {
17454
+ seeds: [
17455
+ {
17456
+ kind: "account",
17457
+ path: "pool_of_sol"
17458
+ },
17459
+ {
17460
+ kind: "account",
17461
+ path: "token_program"
17462
+ },
17463
+ {
17464
+ kind: "account",
17465
+ path: "token_mint"
17466
+ }
17467
+ ],
17468
+ program: {
17469
+ kind: "account",
17470
+ path: "associated_token_program"
17471
+ }
17472
+ }
17473
+ },
17474
+ {
17475
+ name: "fee_recived_account",
17476
+ writable: true,
17477
+ pda: {
17478
+ seeds: [
17479
+ {
17480
+ kind: "const",
17481
+ value: [
17482
+ 102,
17483
+ 101,
17484
+ 101,
17485
+ 45,
17486
+ 114,
17487
+ 101,
17488
+ 99,
17489
+ 105,
17490
+ 118,
17491
+ 101,
17492
+ 100,
17493
+ 45,
17494
+ 97,
17495
+ 99,
17496
+ 99,
17497
+ 111,
17498
+ 117,
17499
+ 110,
17500
+ 116
17501
+ ]
17502
+ }
17503
+ ]
17504
+ }
17505
+ },
17506
+ {
17507
+ name: "rent",
17508
+ address: "SysvarRent111111111111111111111111111111111"
17509
+ },
17510
+ {
17511
+ name: "metadata_program",
17512
+ address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
17513
+ },
17514
+ {
17515
+ name: "token_program",
17516
+ address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
17517
+ },
17518
+ {
17519
+ name: "associated_token_program",
17520
+ address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
17521
+ },
17522
+ {
17523
+ name: "system_program",
17524
+ address: "11111111111111111111111111111111"
17525
+ }
17526
+ ],
17527
+ args: [
17528
+ {
17529
+ name: "params",
17530
+ type: {
17531
+ defined: {
17532
+ name: "CreateParams"
17533
+ }
17534
+ }
17535
+ }
17536
+ ]
17537
+ },
17538
+ {
17539
+ name: "fee_withdraw",
17540
+ discriminator: [
17541
+ 235,
17542
+ 155,
17543
+ 45,
17544
+ 148,
17545
+ 187,
17546
+ 198,
17547
+ 29,
17548
+ 179
17549
+ ],
17550
+ accounts: [
17551
+ {
17552
+ name: "fee_withdrawer",
17553
+ writable: true,
17554
+ signer: true
17555
+ },
17556
+ {
17557
+ name: "addition_withdrawer",
17558
+ writable: true
17559
+ },
17560
+ {
17561
+ name: "config_state",
17562
+ pda: {
17563
+ seeds: [
17564
+ {
17565
+ kind: "const",
17566
+ value: [
17567
+ 97,
17568
+ 112,
17569
+ 112,
17570
+ 45,
17571
+ 99,
17572
+ 111,
17573
+ 110,
17574
+ 102,
17575
+ 105,
17576
+ 103
17577
+ ]
17578
+ }
17579
+ ]
17580
+ }
17581
+ },
17582
+ {
17583
+ name: "fee_recived",
17147
17584
  writable: true,
17148
17585
  pda: {
17149
17586
  seeds: [
17150
- {
17151
- kind: "account",
17152
- path: "bet_state"
17153
- },
17154
17587
  {
17155
17588
  kind: "const",
17156
17589
  value: [
17157
- 112,
17158
- 111,
17590
+ 102,
17591
+ 101,
17592
+ 101,
17593
+ 45,
17594
+ 114,
17595
+ 101,
17596
+ 99,
17597
+ 105,
17598
+ 118,
17599
+ 101,
17600
+ 100,
17601
+ 45,
17602
+ 97,
17603
+ 99,
17604
+ 99,
17159
17605
  111,
17160
- 108
17606
+ 117,
17607
+ 110,
17608
+ 116
17161
17609
  ]
17162
17610
  }
17163
17611
  ]
17164
17612
  }
17165
17613
  },
17166
17614
  {
17167
- name: "pool_of_token",
17615
+ name: "system_program",
17616
+ address: "11111111111111111111111111111111"
17617
+ }
17618
+ ],
17619
+ args: [
17620
+ {
17621
+ name: "amount",
17622
+ type: "u64"
17623
+ }
17624
+ ]
17625
+ },
17626
+ {
17627
+ name: "fee_withdraw_initialize",
17628
+ discriminator: [
17629
+ 180,
17630
+ 248,
17631
+ 183,
17632
+ 11,
17633
+ 79,
17634
+ 119,
17635
+ 206,
17636
+ 65
17637
+ ],
17638
+ accounts: [
17639
+ {
17640
+ name: "admin",
17168
17641
  writable: true,
17642
+ signer: true
17643
+ },
17644
+ {
17645
+ name: "config_state",
17169
17646
  pda: {
17170
17647
  seeds: [
17171
17648
  {
17172
- kind: "account",
17173
- path: "pool_of_sol"
17174
- },
17175
- {
17176
- kind: "account",
17177
- path: "token_program"
17178
- },
17179
- {
17180
- kind: "account",
17181
- path: "token_mint"
17649
+ kind: "const",
17650
+ value: [
17651
+ 97,
17652
+ 112,
17653
+ 112,
17654
+ 45,
17655
+ 99,
17656
+ 111,
17657
+ 110,
17658
+ 102,
17659
+ 105,
17660
+ 103
17661
+ ]
17182
17662
  }
17183
- ],
17184
- program: {
17185
- kind: "account",
17186
- path: "associated_token_program"
17187
- }
17663
+ ]
17188
17664
  }
17189
17665
  },
17190
17666
  {
17191
- name: "fee_recived_account",
17667
+ name: "fee_recived",
17192
17668
  writable: true,
17193
17669
  pda: {
17194
17670
  seeds: [
@@ -17219,22 +17695,6 @@ var instructions = [
17219
17695
  ]
17220
17696
  }
17221
17697
  },
17222
- {
17223
- name: "rent",
17224
- address: "SysvarRent111111111111111111111111111111111"
17225
- },
17226
- {
17227
- name: "metadata_program",
17228
- address: "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
17229
- },
17230
- {
17231
- name: "token_program",
17232
- address: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
17233
- },
17234
- {
17235
- name: "associated_token_program",
17236
- address: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
17237
- },
17238
17698
  {
17239
17699
  name: "system_program",
17240
17700
  address: "11111111111111111111111111111111"
@@ -17245,7 +17705,7 @@ var instructions = [
17245
17705
  name: "params",
17246
17706
  type: {
17247
17707
  defined: {
17248
- name: "CreateParams"
17708
+ name: "FeeWithdrawInitParams"
17249
17709
  }
17250
17710
  }
17251
17711
  }
@@ -17871,6 +18331,86 @@ var instructions = [
17871
18331
  }
17872
18332
  ]
17873
18333
  },
18334
+ {
18335
+ name: "stop_fee_withdraw_previous",
18336
+ discriminator: [
18337
+ 83,
18338
+ 42,
18339
+ 34,
18340
+ 153,
18341
+ 69,
18342
+ 117,
18343
+ 63,
18344
+ 70
18345
+ ],
18346
+ accounts: [
18347
+ {
18348
+ name: "admin",
18349
+ writable: true,
18350
+ signer: true
18351
+ },
18352
+ {
18353
+ name: "config_state",
18354
+ pda: {
18355
+ seeds: [
18356
+ {
18357
+ kind: "const",
18358
+ value: [
18359
+ 97,
18360
+ 112,
18361
+ 112,
18362
+ 45,
18363
+ 99,
18364
+ 111,
18365
+ 110,
18366
+ 102,
18367
+ 105,
18368
+ 103
18369
+ ]
18370
+ }
18371
+ ]
18372
+ }
18373
+ },
18374
+ {
18375
+ name: "fee_recived",
18376
+ writable: true,
18377
+ pda: {
18378
+ seeds: [
18379
+ {
18380
+ kind: "const",
18381
+ value: [
18382
+ 102,
18383
+ 101,
18384
+ 101,
18385
+ 45,
18386
+ 114,
18387
+ 101,
18388
+ 99,
18389
+ 105,
18390
+ 118,
18391
+ 101,
18392
+ 100,
18393
+ 45,
18394
+ 97,
18395
+ 99,
18396
+ 99,
18397
+ 111,
18398
+ 117,
18399
+ 110,
18400
+ 116
18401
+ ]
18402
+ }
18403
+ ]
18404
+ }
18405
+ },
18406
+ {
18407
+ name: "system_program",
18408
+ address: "11111111111111111111111111111111"
18409
+ }
18410
+ ],
18411
+ args: [
18412
+ ]
18413
+ },
17874
18414
  {
17875
18415
  name: "withdraw_from_pool",
17876
18416
  discriminator: [
@@ -18192,9 +18732,66 @@ var accounts = [
18192
18732
  137,
18193
18733
  53
18194
18734
  ]
18735
+ },
18736
+ {
18737
+ name: "UserAirdropState",
18738
+ discriminator: [
18739
+ 206,
18740
+ 91,
18741
+ 14,
18742
+ 80,
18743
+ 13,
18744
+ 187,
18745
+ 172,
18746
+ 231
18747
+ ]
18195
18748
  }
18196
18749
  ];
18197
18750
  var types = [
18751
+ {
18752
+ name: "AirdropEvent",
18753
+ type: {
18754
+ kind: "struct",
18755
+ fields: [
18756
+ {
18757
+ name: "user",
18758
+ type: "pubkey"
18759
+ },
18760
+ {
18761
+ name: "xid",
18762
+ type: "u64"
18763
+ },
18764
+ {
18765
+ name: "withdraw_at",
18766
+ type: "u64"
18767
+ },
18768
+ {
18769
+ name: "total_amount",
18770
+ type: "u64"
18771
+ },
18772
+ {
18773
+ name: "amount",
18774
+ type: "u64"
18775
+ }
18776
+ ]
18777
+ }
18778
+ },
18779
+ {
18780
+ name: "AirdropParams",
18781
+ type: {
18782
+ kind: "struct",
18783
+ fields: [
18784
+ {
18785
+ name: "xid",
18786
+ type: "u64"
18787
+ },
18788
+ {
18789
+ name: "total_amount",
18790
+ type: "u64"
18791
+ }
18792
+ ]
18793
+ }
18794
+ },
18198
18795
  {
18199
18796
  name: "BetState",
18200
18797
  type: {
@@ -18472,11 +19069,13 @@ var types = [
18472
19069
  type: {
18473
19070
  kind: "struct",
18474
19071
  fields: [
19072
+ {
19073
+ name: "stop_previous",
19074
+ type: "bool"
19075
+ },
18475
19076
  {
18476
19077
  name: "additional_account",
18477
- type: {
18478
- option: "pubkey"
18479
- }
19078
+ type: "pubkey"
18480
19079
  },
18481
19080
  {
18482
19081
  name: "additional_rate",
@@ -18485,12 +19084,31 @@ var types = [
18485
19084
  {
18486
19085
  name: "fee_recived_accounts",
18487
19086
  type: {
18488
- vec: "pubkey"
19087
+ array: [
19088
+ "pubkey",
19089
+ 20
19090
+ ]
18489
19091
  }
18490
19092
  }
18491
19093
  ]
18492
19094
  }
18493
19095
  },
19096
+ {
19097
+ name: "FeeWithdrawInitParams",
19098
+ type: {
19099
+ kind: "struct",
19100
+ fields: [
19101
+ {
19102
+ name: "additional_account",
19103
+ type: "pubkey"
19104
+ },
19105
+ {
19106
+ name: "additional_rate",
19107
+ type: "u64"
19108
+ }
19109
+ ]
19110
+ }
19111
+ },
18494
19112
  {
18495
19113
  name: "MigrateType",
18496
19114
  type: {
@@ -18548,6 +19166,30 @@ var types = [
18548
19166
  }
18549
19167
  ]
18550
19168
  }
19169
+ },
19170
+ {
19171
+ name: "UserAirdropState",
19172
+ type: {
19173
+ kind: "struct",
19174
+ fields: [
19175
+ {
19176
+ name: "user",
19177
+ type: "pubkey"
19178
+ },
19179
+ {
19180
+ name: "last_withdrawed_at",
19181
+ type: "u64"
19182
+ },
19183
+ {
19184
+ name: "total_amount",
19185
+ type: "u64"
19186
+ },
19187
+ {
19188
+ name: "withdraw_amount",
19189
+ type: "u64"
19190
+ }
19191
+ ]
19192
+ }
18551
19193
  }
18552
19194
  ];
18553
19195
  var IDL = {