@levrbet/shared 0.4.19 → 0.4.21
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/dist/core/config/index.d.ts +1 -0
- package/dist/core/config/index.js +1 -0
- package/dist/core/config/index.js.map +1 -1
- package/dist/core/config/wallets.d.ts +22 -0
- package/dist/core/config/wallets.js +125 -0
- package/dist/core/config/wallets.js.map +1 -0
- package/dist/core/types/oracle/requests/user.request.type.d.ts +14 -1
- package/dist/server/utils/index.d.ts +1 -0
- package/dist/server/utils/index.js +1 -0
- package/dist/server/utils/index.js.map +1 -1
- package/dist/server/utils/referral.utils.d.ts +13 -0
- package/dist/server/utils/referral.utils.js +37 -0
- package/dist/server/utils/referral.utils.js.map +1 -0
- package/package.json +1 -1
- package/prisma/schema.prisma +5 -5
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./dotenv"), exports);
|
|
18
18
|
__exportStar(require("./urls"), exports);
|
|
19
19
|
__exportStar(require("./levr"), exports);
|
|
20
|
+
__exportStar(require("./wallets"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,yCAAsB;AACtB,yCAAsB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,yCAAsB;AACtB,yCAAsB;AACtB,4CAAyB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LevrEnv } from "../types";
|
|
2
|
+
export type WalletRole = "admin" | "game_admin" | "match_maker" | "feed_provider" | "liquidator";
|
|
3
|
+
export interface MonitoredWallet {
|
|
4
|
+
address: `0x${string}`;
|
|
5
|
+
label: string;
|
|
6
|
+
role: WalletRole;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEV_WALLETS: MonitoredWallet[];
|
|
9
|
+
export declare const STAGING_WALLETS: MonitoredWallet[];
|
|
10
|
+
export declare const PROD_WALLETS: MonitoredWallet[];
|
|
11
|
+
/**
|
|
12
|
+
* Get monitored wallets for the current environment
|
|
13
|
+
*/
|
|
14
|
+
export declare const getMonitoredWallets: (LEVR_ENV: LevrEnv) => MonitoredWallet[];
|
|
15
|
+
/**
|
|
16
|
+
* Get wallets grouped by role
|
|
17
|
+
*/
|
|
18
|
+
export declare const getWalletsByRole: (LEVR_ENV: LevrEnv) => Record<WalletRole, MonitoredWallet[]>;
|
|
19
|
+
/**
|
|
20
|
+
* Get wallet addresses only (for batch balance fetching)
|
|
21
|
+
*/
|
|
22
|
+
export declare const getWalletAddresses: (LEVR_ENV: LevrEnv) => `0x${string}`[];
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWalletAddresses = exports.getWalletsByRole = exports.getMonitoredWallets = exports.PROD_WALLETS = exports.STAGING_WALLETS = exports.DEV_WALLETS = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
exports.DEV_WALLETS = [
|
|
6
|
+
{ address: "0x100E7Ea71c033F623FD4a253478FaE69090f25a2", label: "Admin", role: "admin" },
|
|
7
|
+
{ address: "0xBB396e61C2aDE58eeaDEe95f988d5B17Cd865a7e", label: "Game Admin 1", role: "game_admin" },
|
|
8
|
+
{ address: "0x3904DD309513acb0Ae4F11723663d527559ff269", label: "Game Admin 2", role: "game_admin" },
|
|
9
|
+
{ address: "0x1568417EFb85423A73828e99450A297b75f70C13", label: "Game Admin 3", role: "game_admin" },
|
|
10
|
+
{ address: "0x0694A98208430b0458E91A586CBC54CB801Ff50E", label: "Match Maker 1", role: "match_maker" },
|
|
11
|
+
{ address: "0xe6C73ba342cB4aa39cb87d112c56695ecB4DadC4", label: "Match Maker 2", role: "match_maker" },
|
|
12
|
+
{ address: "0x6174d8CB71118B4a35EDFD457a9C5d437837b863", label: "Match Maker 3", role: "match_maker" },
|
|
13
|
+
{ address: "0xf9b2dBAbD17A81cba501adCd51FdF1106Ac4df22", label: "Feed Provider 1", role: "feed_provider" },
|
|
14
|
+
{ address: "0xd79103D03d13b3f076E3C1DE9F9f7AC3DdB9BFb9", label: "Feed Provider 2", role: "feed_provider" },
|
|
15
|
+
{ address: "0x09DBF4b7766D0E6C8b4eF0BA39B563740ecbDBf9", label: "Feed Provider 3", role: "feed_provider" },
|
|
16
|
+
{ address: "0x0450323F69dE7F0033E82A3C343F49521023c1E8", label: "Liquidator 1", role: "liquidator" },
|
|
17
|
+
{ address: "0xcde63042aBdF7F1376e480e0fB5b25E84b261678", label: "Liquidator 2", role: "liquidator" },
|
|
18
|
+
{ address: "0xADCe6256Ed85C319F6E74F5B4926732fAE3efFdE", label: "Liquidator 3", role: "liquidator" },
|
|
19
|
+
];
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// Staging Wallets (Mainnet - Chain ID 143)
|
|
22
|
+
// =============================================================================
|
|
23
|
+
exports.STAGING_WALLETS = [
|
|
24
|
+
{ address: "0xd5b3e347a4154a9c05665ef8c50926b57e2ab854", label: "Game Admin 1", role: "game_admin" },
|
|
25
|
+
{ address: "0x425f054e12dc828afb6b4922730e092471a36046", label: "Game Admin 2", role: "game_admin" },
|
|
26
|
+
{ address: "0x33e7e8050dcf5a72a02fe0688cf947d527d831ca", label: "Game Admin 3", role: "game_admin" },
|
|
27
|
+
{ address: "0x18bb853ff8fa54298c8129f40900935a6eaddf0f", label: "Game Admin 4", role: "game_admin" },
|
|
28
|
+
{ address: "0xa6b87e359ec0a95ee77e0e5514d05133aeca4642", label: "Game Admin 5", role: "game_admin" },
|
|
29
|
+
{ address: "0x4b2db156646c72fb2c580065258afa905ab8fbd8", label: "Feed Provider 1", role: "feed_provider" },
|
|
30
|
+
{ address: "0x2f28507d87e5232ffc1e8097033d834d2305ec9b", label: "Feed Provider 2", role: "feed_provider" },
|
|
31
|
+
{ address: "0x8236f95c125eec20e9e2412e5144f7f2d9f5edf1", label: "Feed Provider 3", role: "feed_provider" },
|
|
32
|
+
{ address: "0xfc9078973685779aabef25ce38bccacefa375a7c", label: "Feed Provider 4", role: "feed_provider" },
|
|
33
|
+
{ address: "0x961dca9edd01bc442a8d5e6352f43283a349a967", label: "Feed Provider 5", role: "feed_provider" },
|
|
34
|
+
{ address: "0xd95b5468e25e5a418f40f96d1882d254c6303a3a", label: "Liquidator 1", role: "liquidator" },
|
|
35
|
+
{ address: "0xf7ae72c2e6cbdc7af05d541eb078dac0c266ae38", label: "Liquidator 2", role: "liquidator" },
|
|
36
|
+
{ address: "0xa8651173a41bf0bb21f9236413354f68bd13c39c", label: "Liquidator 3", role: "liquidator" },
|
|
37
|
+
{ address: "0x76f374801ecd5b78828a2a7af4c034df2230d832", label: "Liquidator 4", role: "liquidator" },
|
|
38
|
+
{ address: "0x3d548548fc4e67203b5ccd356a4341c5509d367a", label: "Liquidator 5", role: "liquidator" },
|
|
39
|
+
{ address: "0x1e1d7770c95517844ae004c2b2feca5ca64004c9", label: "Match Maker 1", role: "match_maker" },
|
|
40
|
+
{ address: "0x94fe018e2099ba7fe16c9f4d1e4b0303e8f8bd34", label: "Match Maker 2", role: "match_maker" },
|
|
41
|
+
{ address: "0xfbc3be03ae205e02aa15deacee867653ff948679", label: "Match Maker 3", role: "match_maker" },
|
|
42
|
+
{ address: "0x187e617fd861044c1364ce169c4928d1b4162e65", label: "Match Maker 4", role: "match_maker" },
|
|
43
|
+
{ address: "0x024fe2b5ff7499ad9c906f9c33c5d30015bd8680", label: "Match Maker 5", role: "match_maker" },
|
|
44
|
+
];
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Prod Wallets (Mainnet - Chain ID 143)
|
|
47
|
+
// =============================================================================
|
|
48
|
+
exports.PROD_WALLETS = [
|
|
49
|
+
{ address: "0x90CC6f1688A76Ff8C5b774308f3952eFeA454551", label: "Game Admin 1", role: "game_admin" },
|
|
50
|
+
{ address: "0x5294b37fc345162Cb6F1D5358BEE2762Ab100FE1", label: "Game Admin 2", role: "game_admin" },
|
|
51
|
+
{ address: "0x7d281a316441E38396434FccFAE9Ea3567201852", label: "Game Admin 3", role: "game_admin" },
|
|
52
|
+
{ address: "0x6875560B905e97bDdBcD6F3e96C64f076eB1516E", label: "Game Admin 4", role: "game_admin" },
|
|
53
|
+
{ address: "0x86454041A8C31672EbfAec83b79674Bedc5EB695", label: "Game Admin 5", role: "game_admin" },
|
|
54
|
+
{ address: "0x577882E90027C115ba0BbDe283ee533be57f3247", label: "Game Admin 6", role: "game_admin" },
|
|
55
|
+
{ address: "0x0f38f43Cad8DCAf9Fff9dEcEb0e64A782Af6E601", label: "Game Admin 7", role: "game_admin" },
|
|
56
|
+
{ address: "0x59a1de1D31374cD3c7DfEd13c5DA81281aA1a62b", label: "Game Admin 8", role: "game_admin" },
|
|
57
|
+
{ address: "0xC157DdAFdFA005e663a3b406596de9438c7Ec371", label: "Game Admin 9", role: "game_admin" },
|
|
58
|
+
{ address: "0xfB4e5f8904A87efe120145f1e004682fABD69F5b", label: "Game Admin 10", role: "game_admin" },
|
|
59
|
+
{ address: "0xFD790e29DBAFF2a70E705bDcfb88172a9360613C", label: "Liquidator 1", role: "liquidator" },
|
|
60
|
+
{ address: "0x75cFc2d19649e149B7Dd923063d9038C463cB186", label: "Liquidator 2", role: "liquidator" },
|
|
61
|
+
{ address: "0x9e7c79F6E9309F4c1d93D338C86c0c1596154574", label: "Liquidator 3", role: "liquidator" },
|
|
62
|
+
{ address: "0xD2DEbAbecbB6014A3985C1d2db0AF5043fA0339b", label: "Liquidator 4", role: "liquidator" },
|
|
63
|
+
{ address: "0x409Af34E7eC5ee843034C98396beaAfe852c7710", label: "Liquidator 5", role: "liquidator" },
|
|
64
|
+
{ address: "0xe8909ABb1F0782f144cB7b2E8d9aB58462D45355", label: "Liquidator 6", role: "liquidator" },
|
|
65
|
+
{ address: "0x9F3F3ae7f2815c2C5e9212A75717092Ef0959F81", label: "Liquidator 7", role: "liquidator" },
|
|
66
|
+
{ address: "0xf598d835035903D310E78544D850dCc32203a108", label: "Liquidator 8", role: "liquidator" },
|
|
67
|
+
{ address: "0x680f6c765A7C9732a5aBD3A5F9e629C19EC56458", label: "Liquidator 9", role: "liquidator" },
|
|
68
|
+
{ address: "0x5671Bb9AdF3aF84f3bc7dfB677089e234CD176Db", label: "Liquidator 10", role: "liquidator" },
|
|
69
|
+
{ address: "0x1e3A50739f8Cb9DACBEDF6b86D7bdf2b94B11993", label: "Feed Provider 1", role: "feed_provider" },
|
|
70
|
+
{ address: "0xF5aD1259419E7eAa09e5Cd68e37Ca62744B6d5B3", label: "Feed Provider 2", role: "feed_provider" },
|
|
71
|
+
{ address: "0x41db7BFb6269b2f376C5e2Ad8B47b08Df412e7B4", label: "Feed Provider 3", role: "feed_provider" },
|
|
72
|
+
{ address: "0xFDEB58Ae6C8cFBB20603130de977c0AC11B49061", label: "Feed Provider 4", role: "feed_provider" },
|
|
73
|
+
{ address: "0x0491afcBCCEF045F5a53380ab03cBc0553AB0e7C", label: "Feed Provider 5", role: "feed_provider" },
|
|
74
|
+
{ address: "0xEa07175576F5E0CBf53b4Df31ddD2730939A919A", label: "Feed Provider 6", role: "feed_provider" },
|
|
75
|
+
{ address: "0x15e95C6b59b98B029DB5B3e84fbE8c90140eA8f1", label: "Feed Provider 7", role: "feed_provider" },
|
|
76
|
+
{ address: "0x3EC492De4360EA613Fe0c54436a02ac5C48f34c4", label: "Feed Provider 8", role: "feed_provider" },
|
|
77
|
+
{ address: "0x260bA7DCBcD941c30843B4A27c1FDbfD0872E323", label: "Feed Provider 9", role: "feed_provider" },
|
|
78
|
+
{ address: "0x55dAb95bA3ed5f0E9AAAC17229Edb1c7B3C3aeBC", label: "Feed Provider 10", role: "feed_provider" },
|
|
79
|
+
{ address: "0xe404F7A6de0d2c4c93758d1aEBE3b931572cb274", label: "Match Maker 1", role: "match_maker" },
|
|
80
|
+
{ address: "0xFF4ab20dEC94543d3bE44B949516096bce152d67", label: "Match Maker 2", role: "match_maker" },
|
|
81
|
+
{ address: "0x5a1D12f580360d383A4ed627Ba22074344c610B2", label: "Match Maker 3", role: "match_maker" },
|
|
82
|
+
{ address: "0x2177453E41b7826D9D867Ae437Ec68c3091d281F", label: "Match Maker 4", role: "match_maker" },
|
|
83
|
+
{ address: "0xEfdCF5dB53E07F163776085ab9dC964d2B3121fE", label: "Match Maker 5", role: "match_maker" },
|
|
84
|
+
{ address: "0xe234669Be2dCEB61A4D441FBbA68aC3F2c671583", label: "Match Maker 6", role: "match_maker" },
|
|
85
|
+
{ address: "0xB0f0E5FA9f282D8f5B3604C838f3c81481737C15", label: "Match Maker 7", role: "match_maker" },
|
|
86
|
+
{ address: "0xCCE701297E8c6c1332685c6D754385846ADA8CD5", label: "Match Maker 8", role: "match_maker" },
|
|
87
|
+
{ address: "0x5b1Cf5B414E7b491cC0faE1F59cF74843f55D40e", label: "Match Maker 9", role: "match_maker" },
|
|
88
|
+
{ address: "0x1255614d274F32c72e688061a79a85815D9ced7C", label: "Match Maker 10", role: "match_maker" },
|
|
89
|
+
];
|
|
90
|
+
/**
|
|
91
|
+
* Get monitored wallets for the current environment
|
|
92
|
+
*/
|
|
93
|
+
const getMonitoredWallets = (LEVR_ENV) => {
|
|
94
|
+
switch (LEVR_ENV) {
|
|
95
|
+
case types_1.LevrEnv.PROD:
|
|
96
|
+
return exports.PROD_WALLETS;
|
|
97
|
+
case types_1.LevrEnv.STAGING:
|
|
98
|
+
return exports.STAGING_WALLETS;
|
|
99
|
+
default:
|
|
100
|
+
return exports.DEV_WALLETS;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
exports.getMonitoredWallets = getMonitoredWallets;
|
|
104
|
+
/**
|
|
105
|
+
* Get wallets grouped by role
|
|
106
|
+
*/
|
|
107
|
+
const getWalletsByRole = (LEVR_ENV) => {
|
|
108
|
+
const wallets = (0, exports.getMonitoredWallets)(LEVR_ENV);
|
|
109
|
+
return wallets.reduce((acc, wallet) => {
|
|
110
|
+
if (!acc[wallet.role]) {
|
|
111
|
+
acc[wallet.role] = [];
|
|
112
|
+
}
|
|
113
|
+
acc[wallet.role].push(wallet);
|
|
114
|
+
return acc;
|
|
115
|
+
}, {});
|
|
116
|
+
};
|
|
117
|
+
exports.getWalletsByRole = getWalletsByRole;
|
|
118
|
+
/**
|
|
119
|
+
* Get wallet addresses only (for batch balance fetching)
|
|
120
|
+
*/
|
|
121
|
+
const getWalletAddresses = (LEVR_ENV) => {
|
|
122
|
+
return (0, exports.getMonitoredWallets)(LEVR_ENV).map((w) => w.address);
|
|
123
|
+
};
|
|
124
|
+
exports.getWalletAddresses = getWalletAddresses;
|
|
125
|
+
//# sourceMappingURL=wallets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallets.js","sourceRoot":"","sources":["../../../src/core/config/wallets.ts"],"names":[],"mappings":";;;AAAA,oCAAkC;AAUrB,QAAA,WAAW,GAAsB;IAC1C,EAAE,OAAO,EAAE,4CAA4C,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE;IACxF,EAAE,OAAO,EAAE,4CAA4C,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE;IACpG,EAAE,OAAO,EAAE,4CAA4C,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE;IACpG,EAAE,OAAO,EAAE,4CAA4C,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,YAAY,EAAE;IACpG,EAAE,OAAO,EAAE,4CAA4C,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE;IACtG,EAAE,OAAO,EAAE,4CAA4C,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,aAAa,EAAE;IACtG,EAAE,OAAO,EAAE,4C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BAAY,CAAA;QACvB,KAAK,eAAO,CAAC,OAAO;YAChB,OAAO,uBAAe,CAAA;QAC1B;YACI,OAAO,mBAAW,CAAA;IAC1B,CAAC;AACL,CAAC,CAAA;AATY,QAAA,mBAAmB,uBAS/B;AAED;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,QAAiB,EAAyC,EAAE;IACzF,MAAM,OAAO,GAAG,IAAA,2BAAmB,EAAC,QAAQ,CAAC,CAAA;IAC7C,OAAO,OAAO,CAAC,MAAM,CACjB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACZ,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;YACpB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QACzB,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC7B,OAAO,GAAG,CAAA;IACd,CAAC,EACD,EAA2C,CAC9C,CAAA;AACL,CAAC,CAAA;AAZY,QAAA,gBAAgB,oBAY5B;AAED;;GAEG;AACI,MAAM,kBAAkB,GAAG,CAAC,QAAiB,EAAmB,EAAE;IACrE,OAAO,IAAA,2BAAmB,EAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;AAC9D,CAAC,CAAA;AAFY,QAAA,kBAAkB,sBAE9B"}
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import { User } from "@prisma/client";
|
|
1
|
+
import type { User } from "@prisma/client";
|
|
2
|
+
/**
|
|
3
|
+
* Input for creating/saving a full user profile (settings page, profile modal).
|
|
4
|
+
* All fields except objectId/timestamps are settable.
|
|
5
|
+
*/
|
|
2
6
|
export interface SaveUserProfile extends Omit<User, "objectId" | "createdAt" | "updatedAt" | "email"> {
|
|
3
7
|
imageData?: string;
|
|
4
8
|
email?: string;
|
|
5
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Minimal input for ensuring a user profile exists (idempotent create-or-return).
|
|
12
|
+
* The backend fills in all defaults server-side.
|
|
13
|
+
*/
|
|
14
|
+
export interface EnsureUserProfileInput {
|
|
15
|
+
walletAddress: string;
|
|
16
|
+
referrerCode?: string | null;
|
|
17
|
+
timeZone?: string;
|
|
18
|
+
}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./express.utils"), exports);
|
|
18
18
|
__exportStar(require("./tracing"), exports);
|
|
19
19
|
__exportStar(require("./game_progress"), exports);
|
|
20
|
+
__exportStar(require("./referral.utils"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,4CAAyB;AACzB,kDAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,4CAAyB;AACzB,kDAA+B;AAC/B,mDAAgC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a deterministic referral code from a wallet address.
|
|
3
|
+
*
|
|
4
|
+
* The same wallet address + attempt number always produces the same code.
|
|
5
|
+
* Use `attempt` > 0 only to resolve collisions — each attempt derives a
|
|
6
|
+
* different 8-character base-36 code from a different segment of the
|
|
7
|
+
* SHA-256 hash.
|
|
8
|
+
*
|
|
9
|
+
* @param walletAddress - Ethereum wallet address (any casing)
|
|
10
|
+
* @param attempt - Collision-resolution attempt (0 = first try)
|
|
11
|
+
* @returns 8-character uppercase alphanumeric referral code
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateReferralCode(walletAddress: string, attempt?: number): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateReferralCode = generateReferralCode;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
const BASE36_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
9
|
+
const CODE_LENGTH = 8;
|
|
10
|
+
/**
|
|
11
|
+
* Generates a deterministic referral code from a wallet address.
|
|
12
|
+
*
|
|
13
|
+
* The same wallet address + attempt number always produces the same code.
|
|
14
|
+
* Use `attempt` > 0 only to resolve collisions — each attempt derives a
|
|
15
|
+
* different 8-character base-36 code from a different segment of the
|
|
16
|
+
* SHA-256 hash.
|
|
17
|
+
*
|
|
18
|
+
* @param walletAddress - Ethereum wallet address (any casing)
|
|
19
|
+
* @param attempt - Collision-resolution attempt (0 = first try)
|
|
20
|
+
* @returns 8-character uppercase alphanumeric referral code
|
|
21
|
+
*/
|
|
22
|
+
function generateReferralCode(walletAddress, attempt = 0) {
|
|
23
|
+
const hash = node_crypto_1.default
|
|
24
|
+
.createHash("sha256")
|
|
25
|
+
.update(walletAddress.toLowerCase())
|
|
26
|
+
.digest("hex");
|
|
27
|
+
const hashOffset = attempt * 8;
|
|
28
|
+
const hashSegment = hash.slice(hashOffset, hashOffset + 16) || hash.slice(0, 16);
|
|
29
|
+
let num = BigInt(`0x${hashSegment}`);
|
|
30
|
+
let code = "";
|
|
31
|
+
for (let i = 0; i < CODE_LENGTH; i++) {
|
|
32
|
+
code = BASE36_CHARS[Number(num % BigInt(36))] + code;
|
|
33
|
+
num = num / BigInt(36);
|
|
34
|
+
}
|
|
35
|
+
return code;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=referral.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referral.utils.js","sourceRoot":"","sources":["../../../src/server/utils/referral.utils.ts"],"names":[],"mappings":";;;;;AAiBA,oDAsBC;AAvCD,8DAAiC;AAEjC,MAAM,YAAY,GAAG,sCAAsC,CAAC;AAC5D,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB;;;;;;;;;;;GAWG;AACH,SAAgB,oBAAoB,CACnC,aAAqB,EACrB,OAAO,GAAG,CAAC;IAEX,MAAM,IAAI,GAAG,qBAAM;SACjB,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;SACnC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEhB,MAAM,UAAU,GAAG,OAAO,GAAG,CAAC,CAAC;IAC/B,MAAM,WAAW,GAChB,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAE9D,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,WAAW,EAAE,CAAC,CAAC;IACrC,IAAI,IAAI,GAAG,EAAE,CAAC;IAEd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACrD,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,IAAI,CAAC;AACb,CAAC"}
|
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -307,13 +307,13 @@ enum UserOddsPreference {
|
|
|
307
307
|
model User {
|
|
308
308
|
objectId String @id @default(auto()) @map("_id") @db.ObjectId
|
|
309
309
|
walletAddress String @unique
|
|
310
|
-
userName String
|
|
311
|
-
email String
|
|
312
|
-
referralCode String
|
|
310
|
+
userName String?
|
|
311
|
+
email String?
|
|
312
|
+
referralCode String? @unique
|
|
313
313
|
referrerCode String?
|
|
314
|
-
timeZone String
|
|
314
|
+
timeZone String @default("UTC")
|
|
315
315
|
preferredTimeZone String?
|
|
316
|
-
userOddsPreference UserOddsPreference
|
|
316
|
+
userOddsPreference UserOddsPreference @default(American)
|
|
317
317
|
profileImageUrl String?
|
|
318
318
|
profileImageKey String?
|
|
319
319
|
language String @default("en")
|