shufflecom-calculations 6.7.2 → 6.8.0
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 +2 -1
- package/lib/index.js +6 -3
- package/lib/index.js.map +1 -1
- package/lib/sweep-stakes/derive-purchase-bonus-multiplier.js.map +1 -0
- package/lib/sweep-stakes/sweep-stakes-package.d.ts +19 -0
- package/lib/sweep-stakes/sweep-stakes-package.js +48 -0
- package/lib/sweep-stakes/sweep-stakes-package.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/wallet-product.type.d.ts +5 -0
- package/lib/types/wallet-product.type.js +10 -0
- package/lib/types/wallet-product.type.js.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +2 -1
- package/src/sweep-stakes/sweep-stakes-package.ts +49 -0
- package/src/types/wallet-product.type.ts +5 -0
- package/lib/utils/derive-purchase-bonus-multiplier.js.map +0 -1
- /package/lib/{utils → sweep-stakes}/derive-purchase-bonus-multiplier.d.ts +0 -0
- /package/lib/{utils → sweep-stakes}/derive-purchase-bonus-multiplier.js +0 -0
- /package/src/{utils → sweep-stakes}/derive-purchase-bonus-multiplier.spec.ts +0 -0
- /package/src/{utils → sweep-stakes}/derive-purchase-bonus-multiplier.ts +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WalletProduct = void 0;
|
|
4
|
+
var WalletProduct;
|
|
5
|
+
(function (WalletProduct) {
|
|
6
|
+
WalletProduct["CRYPTO_DEPOSIT"] = "CRYPTO_DEPOSIT";
|
|
7
|
+
WalletProduct["BUNDLE_PACKAGE"] = "BUNDLE_PACKAGE";
|
|
8
|
+
WalletProduct["GOLD_COIN_PACKAGE"] = "GOLD_COIN_PACKAGE";
|
|
9
|
+
})(WalletProduct || (exports.WalletProduct = WalletProduct = {}));
|
|
10
|
+
//# sourceMappingURL=wallet-product.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wallet-product.type.js","sourceRoot":"","sources":["../../src/types/wallet-product.type.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,kDAAiC,CAAA;IACjC,kDAAiC,CAAA;IACjC,wDAAuC,CAAA;AACzC,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shufflecom-calculations",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
},
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "ISC",
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "aa6d35e33a97dff5bb25838a0999b5afd4f97fa2"
|
|
23
23
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,8 @@ export { ChatMessageType, ChatMessage } from './utils/chat-message.type';
|
|
|
8
8
|
export { DatesCalculator } from './utils/dates-calculator';
|
|
9
9
|
export { VipBonusIssuanceStatus } from './utils/vip-bonus.type';
|
|
10
10
|
export { deriveBonusIssuances } from './utils/derive-vip-bonus';
|
|
11
|
-
export { derivePurchaseBonusMultiplier } from './
|
|
11
|
+
export { derivePurchaseBonusMultiplier } from './sweep-stakes/derive-purchase-bonus-multiplier';
|
|
12
|
+
export { SweepStakePurchasePackageCalculator, SWEEP_STAKE_PURCHASE_PACKAGES } from './sweep-stakes/sweep-stakes-package';
|
|
12
13
|
export { convertBs58ToUuid, convertUuidToBs58 } from './utils/uuid-converter';
|
|
13
14
|
export { Dice, DiceDirection } from './games/dice';
|
|
14
15
|
export { Roulette } from './games/roulette';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
import { WalletProduct } from '../types/wallet-product.type';
|
|
3
|
+
|
|
4
|
+
export const SC_GC_BUNDLE_RATE = 10_000;
|
|
5
|
+
|
|
6
|
+
type SweepStakePurchasePackages = {
|
|
7
|
+
usdAmount: number;
|
|
8
|
+
product: WalletProduct.BUNDLE_PACKAGE | WalletProduct.GOLD_COIN_PACKAGE;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const SWEEP_STAKE_PURCHASE_PACKAGES: SweepStakePurchasePackages[] = [
|
|
12
|
+
{ usdAmount: 5, product: WalletProduct.BUNDLE_PACKAGE },
|
|
13
|
+
{ usdAmount: 10, product: WalletProduct.BUNDLE_PACKAGE },
|
|
14
|
+
{ usdAmount: 20, product: WalletProduct.BUNDLE_PACKAGE },
|
|
15
|
+
{ usdAmount: 50, product: WalletProduct.BUNDLE_PACKAGE },
|
|
16
|
+
{ usdAmount: 100, product: WalletProduct.BUNDLE_PACKAGE },
|
|
17
|
+
{ usdAmount: 250, product: WalletProduct.BUNDLE_PACKAGE },
|
|
18
|
+
{ usdAmount: 500, product: WalletProduct.BUNDLE_PACKAGE },
|
|
19
|
+
{ usdAmount: 1000, product: WalletProduct.BUNDLE_PACKAGE },
|
|
20
|
+
{ usdAmount: 30, product: WalletProduct.GOLD_COIN_PACKAGE },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export class SweepStakePurchasePackageCalculator {
|
|
24
|
+
static usdToGc(usdAmount: BigNumber.Value): BigNumber {
|
|
25
|
+
return new BigNumber(usdAmount).times(SC_GC_BUNDLE_RATE);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static getPackageValue({ usdAmount, product }: { usdAmount: BigNumber.Value; product: WalletProduct }): { gc: BigNumber; sc: BigNumber } {
|
|
29
|
+
switch (product) {
|
|
30
|
+
case WalletProduct.BUNDLE_PACKAGE:
|
|
31
|
+
return {
|
|
32
|
+
gc: SweepStakePurchasePackageCalculator.usdToGc(usdAmount),
|
|
33
|
+
sc: new BigNumber(usdAmount),
|
|
34
|
+
};
|
|
35
|
+
case WalletProduct.GOLD_COIN_PACKAGE:
|
|
36
|
+
return {
|
|
37
|
+
gc: SweepStakePurchasePackageCalculator.usdToGc(usdAmount),
|
|
38
|
+
sc: new BigNumber(0),
|
|
39
|
+
};
|
|
40
|
+
case WalletProduct.CRYPTO_DEPOSIT:
|
|
41
|
+
return {
|
|
42
|
+
gc: new BigNumber(0),
|
|
43
|
+
sc: new BigNumber(0),
|
|
44
|
+
};
|
|
45
|
+
default:
|
|
46
|
+
return product satisfies never;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derive-purchase-bonus-multiplier.js","sourceRoot":"","sources":["../../src/utils/derive-purchase-bonus-multiplier.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAIrC,MAAM,eAAe,GAA6C;IAChE,GAAG,EAAE,KAAM;IACX,GAAG,EAAE,GAAG;CACT,CAAC;AAgBF,SAAgB,6BAA6B,CAC3C,WAAqC,EACrC,EAAE,WAAW,EAAE,YAAY,EAA8F;IAEzH,MAAM,OAAO,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IAEhG,MAAM,OAAO,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,CAAC,OAAwB,EAAE,EAAE,CAAC,IAAI,sBAAS,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEvF,MAAM,MAAM,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,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