be-components 7.6.1 → 7.6.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.
Files changed (54) hide show
  1. package/lib/commonjs/ApiOverrides/index.js +2 -2
  2. package/lib/commonjs/ApiOverrides/index.js.map +1 -1
  3. package/lib/commonjs/BetRouter/layouts/DesktopAdminLayout.js +27 -2
  4. package/lib/commonjs/BetRouter/layouts/DesktopAdminLayout.js.map +1 -1
  5. package/lib/commonjs/BetRouter/layouts/MobileAdminLayout.js +24 -0
  6. package/lib/commonjs/BetRouter/layouts/MobileAdminLayout.js.map +1 -1
  7. package/lib/commonjs/BetRouter/types/credentials.js +20 -4
  8. package/lib/commonjs/BetRouter/types/credentials.js.map +1 -1
  9. package/lib/commonjs/BetRouter/types/liquidity.js +4 -0
  10. package/lib/commonjs/Wallet/components/WalletActionSelector.js +3 -1
  11. package/lib/commonjs/Wallet/components/WalletActionSelector.js.map +1 -1
  12. package/lib/commonjs/Wallet/components/WithdrawCard.js +13 -3
  13. package/lib/commonjs/Wallet/components/WithdrawCard.js.map +1 -1
  14. package/lib/module/ApiOverrides/index.js +2 -2
  15. package/lib/module/ApiOverrides/index.js.map +1 -1
  16. package/lib/module/BetRouter/layouts/DesktopAdminLayout.js +29 -4
  17. package/lib/module/BetRouter/layouts/DesktopAdminLayout.js.map +1 -1
  18. package/lib/module/BetRouter/layouts/MobileAdminLayout.js +26 -2
  19. package/lib/module/BetRouter/layouts/MobileAdminLayout.js.map +1 -1
  20. package/lib/module/BetRouter/types/credentials.js +17 -2
  21. package/lib/module/BetRouter/types/credentials.js.map +1 -1
  22. package/lib/module/BetRouter/types/liquidity.js +1 -1
  23. package/lib/module/Wallet/components/WalletActionSelector.js +3 -1
  24. package/lib/module/Wallet/components/WalletActionSelector.js.map +1 -1
  25. package/lib/module/Wallet/components/WithdrawCard.js +13 -3
  26. package/lib/module/Wallet/components/WithdrawCard.js.map +1 -1
  27. package/lib/typescript/lib/commonjs/BetRouter/layouts/DesktopAdminLayout.d.ts.map +1 -1
  28. package/lib/typescript/lib/commonjs/BetRouter/layouts/MobileAdminLayout.d.ts.map +1 -1
  29. package/lib/typescript/lib/commonjs/BetRouter/types/credentials.d.ts +33 -0
  30. package/lib/typescript/lib/commonjs/BetRouter/types/credentials.d.ts.map +1 -1
  31. package/lib/typescript/lib/commonjs/BetRouter/types/liquidity.d.ts +1 -1
  32. package/lib/typescript/lib/commonjs/Wallet/components/WalletActionSelector.d.ts.map +1 -1
  33. package/lib/typescript/lib/commonjs/Wallet/components/WithdrawCard.d.ts.map +1 -1
  34. package/lib/typescript/lib/module/BetRouter/layouts/DesktopAdminLayout.d.ts.map +1 -1
  35. package/lib/typescript/lib/module/BetRouter/layouts/MobileAdminLayout.d.ts.map +1 -1
  36. package/lib/typescript/lib/module/BetRouter/types/credentials.d.ts +33 -0
  37. package/lib/typescript/lib/module/BetRouter/types/credentials.d.ts.map +1 -1
  38. package/lib/typescript/lib/module/Wallet/components/WalletActionSelector.d.ts.map +1 -1
  39. package/lib/typescript/lib/module/Wallet/components/WithdrawCard.d.ts.map +1 -1
  40. package/lib/typescript/src/BetRouter/layouts/DesktopAdminLayout.d.ts.map +1 -1
  41. package/lib/typescript/src/BetRouter/layouts/MobileAdminLayout.d.ts.map +1 -1
  42. package/lib/typescript/src/BetRouter/types/credentials.d.ts +3 -1
  43. package/lib/typescript/src/BetRouter/types/credentials.d.ts.map +1 -1
  44. package/lib/typescript/src/BetRouter/types/liquidity.d.ts +11 -0
  45. package/lib/typescript/src/BetRouter/types/liquidity.d.ts.map +1 -1
  46. package/lib/typescript/src/Wallet/components/WithdrawCard.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/src/ApiOverrides/index.ts +2 -2
  49. package/src/BetRouter/layouts/DesktopAdminLayout.tsx +27 -2
  50. package/src/BetRouter/layouts/MobileAdminLayout.tsx +27 -2
  51. package/src/BetRouter/types/credentials.ts +20 -3
  52. package/src/BetRouter/types/liquidity.ts +18 -0
  53. package/src/Wallet/components/WalletActionSelector.tsx +1 -1
  54. package/src/Wallet/components/WithdrawCard.tsx +12 -4
@@ -1,11 +1,12 @@
1
1
  // Partner Credential Types
2
2
  // These define what inputs are needed for each partner
3
3
 
4
- //import { BetOpenlyCredentialProps as BetOpenlyCredentialPropsImport } from "../partners/betopenly/cred.types"
5
-
6
4
  // Re-export BetOpenly credentials
7
5
  export type BetOpenlyCredentialProps = any
8
6
 
7
+ // Re-export Polymarket credentials
8
+ export type PolymarketCredentialProps = any
9
+
9
10
  export interface KalshiCredentialProps {
10
11
  api_key: string
11
12
  private_key_pem: string
@@ -20,7 +21,7 @@ export interface BettorEdgeCredentialProps {
20
21
  }
21
22
 
22
23
  // Union type of all possible credentials
23
- export type PartnerCredentialProps = KalshiCredentialProps | BettorEdgeCredentialProps | BetOpenlyCredentialProps
24
+ export type PartnerCredentialProps = KalshiCredentialProps | BettorEdgeCredentialProps | BetOpenlyCredentialProps | PolymarketCredentialProps
24
25
 
25
26
  // Type guard helpers for client to determine which credential type is needed
26
27
  export const isKalshiCredentials = (creds: any): creds is KalshiCredentialProps => {
@@ -35,6 +36,10 @@ export const isBetOpenlyCredentials = (creds: any): creds is BetOpenlyCredential
35
36
  return 'username' in creds && 'password' in creds && !('device_id' in creds)
36
37
  }
37
38
 
39
+ export const isPolymarketCredentials = (creds: any): creds is PolymarketCredentialProps => {
40
+ return 'private_key' in creds
41
+ }
42
+
38
43
  // Helper to get required fields for a partner by name
39
44
  export const getRequiredCredentialFields = (partnerName: string): string[] => {
40
45
  switch (partnerName) {
@@ -44,6 +49,8 @@ export const getRequiredCredentialFields = (partnerName: string): string[] => {
44
49
  return ['username', 'password']
45
50
  case 'BetOpenly':
46
51
  return ['user_id','username', 'password']
52
+ case 'Polymarket':
53
+ return ['private_key', 'funder']
47
54
  default:
48
55
  return []
49
56
  }
@@ -68,6 +75,11 @@ export const getCredentialFieldLabels = (partnerName: string): Record<string, st
68
75
  password: 'Password',
69
76
  user_id: 'User Id'
70
77
  }
78
+ case 'Polymarket':
79
+ return {
80
+ private_key: 'Private Key (Ethereum Wallet)',
81
+ funder: 'Funder Address (shown under profile pic on Polymarket)'
82
+ }
71
83
  default:
72
84
  return {}
73
85
  }
@@ -92,6 +104,11 @@ export const getCredentialFieldTypes = (partnerName: string): Record<string, 'te
92
104
  username: 'text',
93
105
  password: 'password'
94
106
  }
107
+ case 'Polymarket':
108
+ return {
109
+ private_key: 'password',
110
+ funder: 'text'
111
+ }
95
112
  default:
96
113
  return {}
97
114
  }
@@ -1,5 +1,13 @@
1
1
  // Liquidity Types
2
2
 
3
+ import type {
4
+ RouterMarketSideProps,
5
+ RouterMarketVariableProps,
6
+ RouterMarketProps
7
+ } from './markets';
8
+ import type { RouterParticipantProps } from './participants';
9
+ import type { PartnerParticipantProps } from './participants';
10
+
3
11
  export interface RouterLiquidityProps {
4
12
  router_liquidity_id: string // PK
5
13
  liquidity_hash: string // Hash identifier: partner_id:router_contest_id:router_market_id:market_side_id:market_variable_id:participant_id:timeframe_id
@@ -13,3 +21,13 @@ export interface RouterLiquidityProps {
13
21
  buy_id?: string
14
22
  last_update_datetime: any // MOMENT
15
23
  }
24
+
25
+ // Reference data shared across all getBatchLiquidity calls
26
+ export interface LiquidityReferenceData {
27
+ allRouterMarketSides: RouterMarketSideProps[];
28
+ allRouterMarketVariables: RouterMarketVariableProps[];
29
+ allRouterMarkets: RouterMarketProps[];
30
+ allTimeframes: any[];
31
+ allRouterParticipants: RouterParticipantProps[];
32
+ allPartnerParticipants: PartnerParticipantProps[];
33
+ }
@@ -70,7 +70,7 @@ const WalletActionSelector = ({ player, walkthrough_steps, player_balance, accou
70
70
  if(instant_withdraw_account){ return onActionSelect(action, instant_withdraw_account) }
71
71
  //Ok lets get the ibt_placeholder one!
72
72
  let ibt_placeholder = accounts.find(a => a.ibt_placeholder);
73
- if(ibt_placeholder){ return onActionSelect(action, ibt_placeholder) }
73
+ if(ibt_placeholder){ return onActionSelect({ action:'add_ibt' }, ibt_placeholder) }
74
74
  return //Dont do anything if we dont have an ibt acccount possible
75
75
  default: onActionSelect(action)
76
76
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { ActivityIndicator, FlatList, Keyboard, Pressable } from "react-native";
3
- import type { AccountProps, FocusPositionProps, ItemOrderProps, MyPlayerProps, PlayerBalanceProps, PlayerDepositLimitProps, PlayerWithdrawLimitProps, WalletSettingsProps } from '../../types';
3
+ import type { AccountProps, FocusPositionProps, ItemOrderProps, ItemProps, MyPlayerProps, PlayerBalanceProps, PlayerDepositLimitProps, PlayerWithdrawLimitProps, WalletSettingsProps } from '../../types';
4
4
  import { ItemOrderApi, ItemOrderHelpers } from '../api';
5
5
  import { Button, Text, TextInput, View } from '../../Components/Themed';
6
6
  import { useColors } from '../../constants/useColors';
@@ -26,23 +26,28 @@ const WithdrawCard = ({ player, wallet_settings, onTransact, instant, player_bal
26
26
  const Colors = useColors();
27
27
  const [ draft_order, setDraftOrder ] = useState<ItemOrderProps>();
28
28
  const [ confirm_ach, setConfirmAch ] = useState(false);
29
- //const [ withdraw_item, setWithdrawItem ] = useState<ItemProps | undefined>(undefined);
29
+ const [ withdraw_item, setWithdrawItem ] = useState<ItemProps | undefined>(undefined);
30
30
  useEffect(() => {
31
31
  getItemFromServer()
32
32
  },[])
33
33
 
34
34
  const getItemFromServer = async() => {
35
35
  const item = await ItemOrderApi.getItemByIdentifier(instant?'instant_withdraw':'withdraw');
36
- //setWithdrawItem(item);
36
+ setWithdrawItem(item);
37
37
  setDraftOrder(ItemOrderHelpers.genWithdrawOrder(item, account))
38
38
  }
39
39
 
40
40
 
41
41
  const { errors, available_for_withdraw } = ItemOrderHelpers.isWithdrawOrderValid(account, withdraw_limit, deposit_limit, player_balance, wallet_settings, draft_order)
42
42
 
43
+ const removeFee = (amount:number, feePct:number) => {
44
+ return amount / (1 + feePct);
45
+ }
46
+
43
47
  const handleTransact = () => {
44
48
  if(!draft_order){ return }
45
49
  if(errors.length > 0){ return }
50
+ if(!withdraw_item){ return }
46
51
 
47
52
  //OK LETS CHECK THE ACCOUNT TYPE AND IF WE NEED ACCOUNT NUMBER INFORMATION
48
53
  if(!instant){
@@ -53,7 +58,10 @@ const WithdrawCard = ({ player, wallet_settings, onTransact, instant, player_bal
53
58
  //Lets get the item
54
59
  let draft_item = draft_order.items[0]
55
60
  if(!draft_item){ return }
56
- onTransact({ ...draft_order, total_amount: draft_order.amount as number, items: [{ ...draft_item, amount: draft_order.amount as number }] })
61
+ let fee = withdraw_item.processing_fee ?? 0
62
+ const final_amount = removeFee(Number(draft_order.amount), fee);
63
+ console.log(final_amount)
64
+ onTransact({ ...draft_order, amount:final_amount, total_amount: draft_order.amount as number, items: [{ ...draft_item, amount: final_amount }] })
57
65
  }
58
66
 
59
67