shufflecom-calculations 3.3.16 → 3.3.18
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/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/sports/sports-content-fixture.types.d.ts +0 -4
- package/lib/sports/sports-content-fixture.types.js +1 -4
- package/lib/sports/sports-content-fixture.types.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/buy-crypto-currency-code-map.d.ts +2 -2
- package/lib/utils/buy-crypto-currency-code-map.js.map +1 -1
- package/lib/utils/currency.d.ts +23 -5
- package/lib/utils/currency.js +61 -34
- package/lib/utils/currency.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +0 -1
- package/src/sports/sports-content-fixture.types.ts +0 -8
- package/src/utils/buy-crypto-currency-code-map.ts +2 -2
- package/src/utils/currency.ts +94 -43
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CryptoDenominatedCurrency } from './currency';
|
|
2
2
|
interface BuyCryptoCurrencyConfig {
|
|
3
3
|
moonpay?: string;
|
|
4
4
|
swapped?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const BUY_CRYPTO_CURRENCY_CONFIGS: Record<
|
|
6
|
+
export declare const BUY_CRYPTO_CURRENCY_CONFIGS: Record<CryptoDenominatedCurrency, BuyCryptoCurrencyConfig>;
|
|
7
7
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buy-crypto-currency-code-map.js","sourceRoot":"","sources":["../../src/utils/buy-crypto-currency-code-map.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"buy-crypto-currency-code-map.js","sourceRoot":"","sources":["../../src/utils/buy-crypto-currency-code-map.ts"],"names":[],"mappings":";;;AAAA,yCAAiE;AAOpD,QAAA,2BAA2B,GAA+D;IACrG,CAAC,mBAAQ,CAAC,GAAG,CAAC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AG,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE;IAClD,CAAC,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;IACnB,CAAC,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;IACpC,CAAC,mBAAQ,CAAC,GAAG,CAAC,EAAE,EAAE;IAClB,CAAC,mBAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;IACnB,CAAC,mBAAQ,CAAC,KAAK,CAAC,EAAE,EAAE;IACpB,CAAC,mBAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE;IAC3D,CAAC,mBAAQ,CAAC,EAAE,CAAC,EAAE,EAAE;IACjB,CAAC,mBAAQ,CAAC,EAAE,CAAC,EAAE,EAAE;CAClB,CAAC"}
|
package/lib/utils/currency.d.ts
CHANGED
|
@@ -24,20 +24,38 @@ export declare enum Currency {
|
|
|
24
24
|
SC = "SC",
|
|
25
25
|
CAD = "CAD"
|
|
26
26
|
}
|
|
27
|
-
export declare
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export declare enum CurrencyPlatform {
|
|
28
|
+
SHUFFLE = "SHUFFLE",
|
|
29
|
+
SWEEP_STAKES = "SWEEP_STAKES"
|
|
30
|
+
}
|
|
31
|
+
export declare enum CurrencyType {
|
|
32
|
+
CRYPTO = "crypto",
|
|
33
|
+
FIAT = "fiat",
|
|
34
|
+
SWEEPSTAKES = "sweepstakes"
|
|
35
|
+
}
|
|
36
|
+
export declare class CurrencyRegistry {
|
|
37
|
+
private static readonly REGISTRY;
|
|
38
|
+
private static readonly DISABLED_BY_PLATFORM;
|
|
39
|
+
static getType(c: Currency): CurrencyType;
|
|
30
40
|
static readonly CRYPTO_CURRENCIES: readonly CryptoCurrency[];
|
|
31
41
|
static readonly FIAT_CURRENCIES: readonly PlatformFiatCurrency[];
|
|
42
|
+
static readonly SWEEPSTAKES_CURRENCIES: readonly SweepstakesCurrency[];
|
|
32
43
|
static isCrypto(c: Currency): c is CryptoCurrency;
|
|
33
44
|
static isFiat(c: Currency): c is PlatformFiatCurrency;
|
|
45
|
+
static isSweepstakes(c: Currency): c is SweepstakesCurrency;
|
|
46
|
+
static isAvailableOn(c: Currency, platform: string): boolean;
|
|
47
|
+
static isDisabledOn(c: Currency, platform: string): boolean;
|
|
34
48
|
}
|
|
35
49
|
export type CryptoCurrency = {
|
|
36
|
-
[K in Currency]: (typeof
|
|
50
|
+
[K in Currency]: (typeof CurrencyRegistry)['REGISTRY'][K]['type'] extends CurrencyType.CRYPTO ? K : never;
|
|
37
51
|
}[Currency];
|
|
38
52
|
export type PlatformFiatCurrency = {
|
|
39
|
-
[K in Currency]: (typeof
|
|
53
|
+
[K in Currency]: (typeof CurrencyRegistry)['REGISTRY'][K]['type'] extends CurrencyType.FIAT ? K : never;
|
|
54
|
+
}[Currency];
|
|
55
|
+
export type SweepstakesCurrency = {
|
|
56
|
+
[K in Currency]: (typeof CurrencyRegistry)['REGISTRY'][K]['type'] extends CurrencyType.SWEEPSTAKES ? K : never;
|
|
40
57
|
}[Currency];
|
|
58
|
+
export type CryptoDenominatedCurrency = CryptoCurrency | SweepstakesCurrency;
|
|
41
59
|
declare const CHECKED: unique symbol;
|
|
42
60
|
export type CheckedCurrency = Currency & {
|
|
43
61
|
readonly [CHECKED]: true;
|
package/lib/utils/currency.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unsafeMintCheckedCurrency = exports.CurrencyType = exports.Currency = void 0;
|
|
3
|
+
exports.unsafeMintCheckedCurrency = exports.CurrencyRegistry = exports.CurrencyType = exports.CurrencyPlatform = exports.Currency = void 0;
|
|
4
4
|
var Currency;
|
|
5
5
|
(function (Currency) {
|
|
6
6
|
Currency["BTC"] = "BTC";
|
|
@@ -28,46 +28,73 @@ var Currency;
|
|
|
28
28
|
Currency["SC"] = "SC";
|
|
29
29
|
Currency["CAD"] = "CAD";
|
|
30
30
|
})(Currency || (exports.Currency = Currency = {}));
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
var CurrencyPlatform;
|
|
32
|
+
(function (CurrencyPlatform) {
|
|
33
|
+
CurrencyPlatform["SHUFFLE"] = "SHUFFLE";
|
|
34
|
+
CurrencyPlatform["SWEEP_STAKES"] = "SWEEP_STAKES";
|
|
35
|
+
})(CurrencyPlatform || (exports.CurrencyPlatform = CurrencyPlatform = {}));
|
|
36
|
+
var CurrencyType;
|
|
37
|
+
(function (CurrencyType) {
|
|
38
|
+
CurrencyType["CRYPTO"] = "crypto";
|
|
39
|
+
CurrencyType["FIAT"] = "fiat";
|
|
40
|
+
CurrencyType["SWEEPSTAKES"] = "sweepstakes";
|
|
41
|
+
})(CurrencyType || (exports.CurrencyType = CurrencyType = {}));
|
|
42
|
+
class CurrencyRegistry {
|
|
43
|
+
static getType(c) {
|
|
44
|
+
return CurrencyRegistry.REGISTRY[c].type;
|
|
34
45
|
}
|
|
35
46
|
static isCrypto(c) {
|
|
36
|
-
return
|
|
47
|
+
return CurrencyRegistry.getType(c) === CurrencyType.CRYPTO;
|
|
37
48
|
}
|
|
38
49
|
static isFiat(c) {
|
|
39
|
-
return
|
|
50
|
+
return CurrencyRegistry.getType(c) === CurrencyType.FIAT;
|
|
51
|
+
}
|
|
52
|
+
static isSweepstakes(c) {
|
|
53
|
+
return CurrencyRegistry.getType(c) === CurrencyType.SWEEPSTAKES;
|
|
54
|
+
}
|
|
55
|
+
static isAvailableOn(c, platform) {
|
|
56
|
+
const meta = CurrencyRegistry.REGISTRY[c];
|
|
57
|
+
return !!meta && meta.platform === platform && !CurrencyRegistry.isDisabledOn(c, platform);
|
|
58
|
+
}
|
|
59
|
+
static isDisabledOn(c, platform) {
|
|
60
|
+
var _a;
|
|
61
|
+
return ((_a = CurrencyRegistry.DISABLED_BY_PLATFORM[platform]) === null || _a === void 0 ? void 0 : _a.includes(c)) === true;
|
|
40
62
|
}
|
|
41
63
|
}
|
|
42
|
-
exports.
|
|
43
|
-
|
|
44
|
-
[Currency.BTC]:
|
|
45
|
-
[Currency.ETH]:
|
|
46
|
-
[Currency.LTC]:
|
|
47
|
-
[Currency.USDT]:
|
|
48
|
-
[Currency.USDC]:
|
|
49
|
-
[Currency.DAI]:
|
|
50
|
-
[Currency.TRX]:
|
|
51
|
-
[Currency.MATIC]:
|
|
52
|
-
[Currency.XRP]:
|
|
53
|
-
[Currency.SOL]:
|
|
54
|
-
[Currency.DOGE]:
|
|
55
|
-
[Currency.BUSD]:
|
|
56
|
-
[Currency.BNB]:
|
|
57
|
-
[Currency.SHIB]:
|
|
58
|
-
[Currency.SHFL]:
|
|
59
|
-
[Currency.BONK]:
|
|
60
|
-
[Currency.WIF]:
|
|
61
|
-
[Currency.TON]:
|
|
62
|
-
[Currency.AVAX]:
|
|
63
|
-
[Currency.TRUMP]:
|
|
64
|
-
[Currency.PUMP]:
|
|
65
|
-
[Currency.
|
|
66
|
-
[Currency.
|
|
67
|
-
[Currency.
|
|
64
|
+
exports.CurrencyRegistry = CurrencyRegistry;
|
|
65
|
+
CurrencyRegistry.REGISTRY = {
|
|
66
|
+
[Currency.BTC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
67
|
+
[Currency.ETH]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
68
|
+
[Currency.LTC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
69
|
+
[Currency.USDT]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
70
|
+
[Currency.USDC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
71
|
+
[Currency.DAI]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
72
|
+
[Currency.TRX]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
73
|
+
[Currency.MATIC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
74
|
+
[Currency.XRP]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
75
|
+
[Currency.SOL]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
76
|
+
[Currency.DOGE]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
77
|
+
[Currency.BUSD]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
78
|
+
[Currency.BNB]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
79
|
+
[Currency.SHIB]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
80
|
+
[Currency.SHFL]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
81
|
+
[Currency.BONK]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
82
|
+
[Currency.WIF]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
83
|
+
[Currency.TON]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
84
|
+
[Currency.AVAX]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
85
|
+
[Currency.TRUMP]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
86
|
+
[Currency.PUMP]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
87
|
+
[Currency.CAD]: { type: CurrencyType.FIAT, platform: CurrencyPlatform.SHUFFLE },
|
|
88
|
+
[Currency.GC]: { type: CurrencyType.SWEEPSTAKES, platform: CurrencyPlatform.SWEEP_STAKES },
|
|
89
|
+
[Currency.SC]: { type: CurrencyType.SWEEPSTAKES, platform: CurrencyPlatform.SWEEP_STAKES },
|
|
90
|
+
};
|
|
91
|
+
CurrencyRegistry.DISABLED_BY_PLATFORM = {
|
|
92
|
+
[CurrencyPlatform.SHUFFLE]: [Currency.BUSD],
|
|
93
|
+
[CurrencyPlatform.SWEEP_STAKES]: [Currency.BUSD, Currency.SHFL],
|
|
68
94
|
};
|
|
69
|
-
|
|
70
|
-
|
|
95
|
+
CurrencyRegistry.CRYPTO_CURRENCIES = Object.keys(CurrencyRegistry.REGISTRY).filter((c) => CurrencyRegistry.getType(c) === CurrencyType.CRYPTO);
|
|
96
|
+
CurrencyRegistry.FIAT_CURRENCIES = Object.keys(CurrencyRegistry.REGISTRY).filter((c) => CurrencyRegistry.getType(c) === CurrencyType.FIAT);
|
|
97
|
+
CurrencyRegistry.SWEEPSTAKES_CURRENCIES = Object.keys(CurrencyRegistry.REGISTRY).filter((c) => CurrencyRegistry.getType(c) === CurrencyType.SWEEPSTAKES);
|
|
71
98
|
function unsafeMintCheckedCurrency(currency) {
|
|
72
99
|
return currency;
|
|
73
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../src/utils/currency.ts"],"names":[],"mappings":";;;AACA,IAAY,QAkCX;AAlCD,WAAY,QAAQ;IAElB,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,uBAAW,CAAA;IAGX,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,uBAAW,CAAA;IAGX,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,uBAAW,CAAA;IACX,uBAAW,CAAA;IACX,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,yBAAa,CAAA;IAGb,qBAAS,CAAA;IACT,qBAAS,CAAA;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AAW,EAAE,QAAQ,EAAE,gBAAgB,CAAC,YAAY,EAAE;CACzC,CAAC;AAE5B,qCAAoB,GAA2D;IACrG,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3C,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;CAChE,CAAC;AAMc,kCAAiB,GAA+B,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAgB,CAAC,MAAM,CAC1H,CAAC,CAAC,EAAuB,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,MAAM,CAChF,CAAC;AAEc,gCAAe,GAAqC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAgB,CAAC,MAAM,CAC9H,CAAC,CAAC,EAA6B,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,IAAI,CACpF,CAAC;AAEc,uCAAsB,GAAoC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAgB,CAAC,MAAM,CACpI,CAAC,CAAC,EAA4B,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,YAAY,CAAC,WAAW,CAC1F,CAAC;AAsEJ,SAAgB,yBAAyB,CAAC,QAAkB;IAC1D,OAAO,QAA2B,CAAC;AACrC,CAAC;AAFD,8DAEC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shufflecom-calculations",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
},
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "790409f0ad898b64030c8ebb943d0191f91e6626"
|
|
18
18
|
}
|
package/src/index.ts
CHANGED
|
@@ -44,7 +44,6 @@ export { Chicken, ChickenDifficulty } from './games/chicken';
|
|
|
44
44
|
export { Tower, TowerDifficulty, TOWER_DIFFICULTY_TO_CONFIG, TOWER_TOTAL_ROWS } from './games/tower';
|
|
45
45
|
export { Wheel, WheelRiskLevel, WheelSegments, WHEEL_MULTIPLIERS, WHEEL_SEGMENTS_TO_NUMBER } from './games/wheel';
|
|
46
46
|
export { formatSelectionName } from './sports/sports-name';
|
|
47
|
-
export { SportsContentWithFixturesInfo } from './sports/sports-content-fixture.types';
|
|
48
47
|
export { SportsProviderMaxBet, BetradarOverrideLimitType, BETRADAR_OVERRIDE_LIMIT_TO_MAX_BET } from './sports/override-limit-max-bet';
|
|
49
48
|
export { Blitz, BlitzResult, BLITZ_MIN_PICKS, BLITZ_MAX_PICKS } from './games/blitz';
|
|
50
49
|
export { CoinSide, MAX_FLIPS } from './games/coinflip/constants';
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { SportsFixtureInfoWithCompetition } from './sports-competition-fixture.types';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated
|
|
5
|
-
* */
|
|
6
|
-
export class SportsContentWithFixturesInfo {
|
|
7
|
-
name: string;
|
|
8
|
-
fixtures: SportsFixtureInfoWithCompetition[];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
3
|
class SportsContentBase {
|
|
12
4
|
name: string;
|
|
13
5
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CryptoDenominatedCurrency, Currency } from './currency';
|
|
2
2
|
|
|
3
3
|
interface BuyCryptoCurrencyConfig {
|
|
4
4
|
moonpay?: string; //https://dev.moonpay.com/docs/list-of-supported-cryptocurrencies
|
|
5
5
|
swapped?: string; //https://docs.swapped.com/swapped-ramp/readme/supported-cryptocurrencies
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export const BUY_CRYPTO_CURRENCY_CONFIGS: Record<
|
|
8
|
+
export const BUY_CRYPTO_CURRENCY_CONFIGS: Record<CryptoDenominatedCurrency, BuyCryptoCurrencyConfig> = {
|
|
9
9
|
[Currency.BTC]: { moonpay: 'BTC', swapped: 'BTC' },
|
|
10
10
|
[Currency.ETH]: { moonpay: 'ETH', swapped: 'ETH' },
|
|
11
11
|
[Currency.USDT]: { moonpay: 'USDT_TRX', swapped: 'USDT_TRON' },
|
package/src/utils/currency.ts
CHANGED
|
@@ -35,68 +35,119 @@ export enum Currency {
|
|
|
35
35
|
CAD = 'CAD',
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[Currency.
|
|
59
|
-
[Currency.
|
|
60
|
-
[Currency.
|
|
61
|
-
|
|
62
|
-
[Currency.
|
|
63
|
-
[Currency.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
[Currency.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
38
|
+
// Mirrors the Platform enum from the common lib, which this package can't import.
|
|
39
|
+
// A compile-time assertion there guards against the two drifting apart.
|
|
40
|
+
export enum CurrencyPlatform {
|
|
41
|
+
SHUFFLE = 'SHUFFLE',
|
|
42
|
+
SWEEP_STAKES = 'SWEEP_STAKES',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum CurrencyType {
|
|
46
|
+
CRYPTO = 'crypto',
|
|
47
|
+
FIAT = 'fiat',
|
|
48
|
+
SWEEPSTAKES = 'sweepstakes',
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type CurrencyMeta = {
|
|
52
|
+
type: CurrencyType;
|
|
53
|
+
platform: CurrencyPlatform; // the platform this currency is native to
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class CurrencyRegistry {
|
|
57
|
+
private static readonly REGISTRY = {
|
|
58
|
+
[Currency.BTC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
59
|
+
[Currency.ETH]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
60
|
+
[Currency.LTC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
61
|
+
[Currency.USDT]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
62
|
+
[Currency.USDC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
63
|
+
[Currency.DAI]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
64
|
+
[Currency.TRX]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
65
|
+
[Currency.MATIC]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
66
|
+
[Currency.XRP]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
67
|
+
[Currency.SOL]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
68
|
+
[Currency.DOGE]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
69
|
+
[Currency.BUSD]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
70
|
+
[Currency.BNB]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
71
|
+
[Currency.SHIB]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
72
|
+
[Currency.SHFL]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
73
|
+
[Currency.BONK]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
74
|
+
[Currency.WIF]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
75
|
+
[Currency.TON]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
76
|
+
[Currency.AVAX]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
77
|
+
[Currency.TRUMP]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
78
|
+
[Currency.PUMP]: { type: CurrencyType.CRYPTO, platform: CurrencyPlatform.SHUFFLE },
|
|
79
|
+
|
|
80
|
+
[Currency.CAD]: { type: CurrencyType.FIAT, platform: CurrencyPlatform.SHUFFLE },
|
|
81
|
+
|
|
82
|
+
[Currency.GC]: { type: CurrencyType.SWEEPSTAKES, platform: CurrencyPlatform.SWEEP_STAKES },
|
|
83
|
+
[Currency.SC]: { type: CurrencyType.SWEEPSTAKES, platform: CurrencyPlatform.SWEEP_STAKES },
|
|
84
|
+
} as const satisfies Record<Currency, CurrencyMeta>;
|
|
85
|
+
|
|
86
|
+
private static readonly DISABLED_BY_PLATFORM: Partial<Record<CurrencyPlatform, readonly Currency[]>> = {
|
|
87
|
+
[CurrencyPlatform.SHUFFLE]: [Currency.BUSD],
|
|
88
|
+
[CurrencyPlatform.SWEEP_STAKES]: [Currency.BUSD, Currency.SHFL],
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
static getType(c: Currency): CurrencyType {
|
|
92
|
+
return CurrencyRegistry.REGISTRY[c].type;
|
|
73
93
|
}
|
|
74
94
|
|
|
75
|
-
static readonly CRYPTO_CURRENCIES: readonly CryptoCurrency[] = (Object.keys(
|
|
76
|
-
(c): c is CryptoCurrency =>
|
|
95
|
+
static readonly CRYPTO_CURRENCIES: readonly CryptoCurrency[] = (Object.keys(CurrencyRegistry.REGISTRY) as Currency[]).filter(
|
|
96
|
+
(c): c is CryptoCurrency => CurrencyRegistry.getType(c) === CurrencyType.CRYPTO,
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
static readonly FIAT_CURRENCIES: readonly PlatformFiatCurrency[] = (Object.keys(CurrencyRegistry.REGISTRY) as Currency[]).filter(
|
|
100
|
+
(c): c is PlatformFiatCurrency => CurrencyRegistry.getType(c) === CurrencyType.FIAT,
|
|
77
101
|
);
|
|
78
102
|
|
|
79
|
-
static readonly
|
|
80
|
-
(c): c is
|
|
103
|
+
static readonly SWEEPSTAKES_CURRENCIES: readonly SweepstakesCurrency[] = (Object.keys(CurrencyRegistry.REGISTRY) as Currency[]).filter(
|
|
104
|
+
(c): c is SweepstakesCurrency => CurrencyRegistry.getType(c) === CurrencyType.SWEEPSTAKES,
|
|
81
105
|
);
|
|
82
106
|
|
|
83
107
|
static isCrypto(c: Currency): c is CryptoCurrency {
|
|
84
|
-
return
|
|
108
|
+
return CurrencyRegistry.getType(c) === CurrencyType.CRYPTO;
|
|
85
109
|
}
|
|
86
110
|
|
|
87
111
|
static isFiat(c: Currency): c is PlatformFiatCurrency {
|
|
88
|
-
return
|
|
112
|
+
return CurrencyRegistry.getType(c) === CurrencyType.FIAT;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
static isSweepstakes(c: Currency): c is SweepstakesCurrency {
|
|
116
|
+
return CurrencyRegistry.getType(c) === CurrencyType.SWEEPSTAKES;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @returns true if the currency belongs to the given platform and isn't disabled
|
|
121
|
+
* there; false for unknown, disabled, or wrong-platform currencies.
|
|
122
|
+
*/
|
|
123
|
+
static isAvailableOn(c: Currency, platform: string): boolean {
|
|
124
|
+
const meta = CurrencyRegistry.REGISTRY[c];
|
|
125
|
+
return !!meta && meta.platform === platform && !CurrencyRegistry.isDisabledOn(c, platform);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @returns true if the currency is disabled on the given platform
|
|
130
|
+
*/
|
|
131
|
+
static isDisabledOn(c: Currency, platform: string): boolean {
|
|
132
|
+
return CurrencyRegistry.DISABLED_BY_PLATFORM[platform as CurrencyPlatform]?.includes(c) === true;
|
|
89
133
|
}
|
|
90
134
|
}
|
|
91
135
|
|
|
92
136
|
export type CryptoCurrency = {
|
|
93
|
-
[K in Currency]: (typeof
|
|
137
|
+
[K in Currency]: (typeof CurrencyRegistry)['REGISTRY'][K]['type'] extends CurrencyType.CRYPTO ? K : never;
|
|
94
138
|
}[Currency];
|
|
95
139
|
|
|
96
140
|
export type PlatformFiatCurrency = {
|
|
97
|
-
[K in Currency]: (typeof
|
|
141
|
+
[K in Currency]: (typeof CurrencyRegistry)['REGISTRY'][K]['type'] extends CurrencyType.FIAT ? K : never;
|
|
142
|
+
}[Currency];
|
|
143
|
+
|
|
144
|
+
export type SweepstakesCurrency = {
|
|
145
|
+
[K in Currency]: (typeof CurrencyRegistry)['REGISTRY'][K]['type'] extends CurrencyType.SWEEPSTAKES ? K : never;
|
|
98
146
|
}[Currency];
|
|
99
147
|
|
|
148
|
+
// Currencies that behave like crypto mechanically
|
|
149
|
+
export type CryptoDenominatedCurrency = CryptoCurrency | SweepstakesCurrency;
|
|
150
|
+
|
|
100
151
|
/**
|
|
101
152
|
* A Currency that has passed CurrencyEligibilityService.check() for a specific user.
|
|
102
153
|
* Only mintable by calling that service's check() method.
|