@kalamba/sdk 0.4.1 → 0.6.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/dist/errors-66b5612a.cjs +5 -0
- package/dist/errors-96eb18f7.js +52 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +99 -24
- package/dist/index.js +193 -109
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.ts +39 -9
- package/dist/plugins.js +590 -499
- package/dist/wrapper.d.ts +38 -9
- package/package.json +2 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
* Copyright (c) 2024, Kalamba Games Limited
|
|
4
|
+
*/
|
|
5
|
+
"use strict";var R=Object.defineProperty;var _=(N,E,r)=>E in N?R(N,E,{enumerable:!0,configurable:!0,writable:!0,value:r}):N[E]=r;var O=(N,E,r)=>(_(N,typeof E!="symbol"?E+"":E,r),r);const I={CONNECTION_ERROR:"CONNECTION_ERROR",ALREADY_LOGGED_IN:"ALREADY_LOGGED_IN",DENIED:"DENIED",NOT_FOUND:"NOT_FOUND",BONUS_RESTRICTION:"BONUS_RESTRICTION",ERROR:"ERROR",GAME_UNAVAILABLE:"GAME_UNAVAILABLE",RECONNECT_DATA_MISMATCH:"RECONNECT_DATA_MISMATCH",TOO_MANY_OPEN_GAMES:"TOO_MANY_OPEN_GAMES"},A={ERROR:"ERROR",GAMING_LIMITS_REACHED:"GAMING_LIMITS_REACHED",INVALID_CURRENCY:"INVALID_CURRENCY",INVALID_SESSION:"INVALID_SESSION",OUT_OF_MONEY:"OUT_OF_MONEY",UNFINISHED_ROUND_IN_PROGRESS:"UNFINISHED_ROUND_IN_PROGRESS",WALLET_ERROR:"WALLET_ERROR"};class o extends Error{constructor(r){super();O(this,"data");this.name="OpenGameError",this.data=r}}class e extends Error{constructor(r){super();O(this,"data");this.name="PlayError",this.data=r}}class t extends Error{constructor(){super(),this.name="TimeoutError"}}exports.OpenGameError=o;exports.OpenGameErrorCode=I;exports.PlayError=e;exports.PlayErrorCode=A;exports.TimeoutError=t;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BSD 3-Clause License
|
|
3
|
+
* Copyright (c) 2024, Kalamba Games Limited
|
|
4
|
+
*/
|
|
5
|
+
var r = Object.defineProperty;
|
|
6
|
+
var _ = (O, E, N) => E in O ? r(O, E, { enumerable: !0, configurable: !0, writable: !0, value: N }) : O[E] = N;
|
|
7
|
+
var R = (O, E, N) => (_(O, typeof E != "symbol" ? E + "" : E, N), N);
|
|
8
|
+
const A = {
|
|
9
|
+
CONNECTION_ERROR: "CONNECTION_ERROR",
|
|
10
|
+
ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN",
|
|
11
|
+
DENIED: "DENIED",
|
|
12
|
+
NOT_FOUND: "NOT_FOUND",
|
|
13
|
+
BONUS_RESTRICTION: "BONUS_RESTRICTION",
|
|
14
|
+
ERROR: "ERROR",
|
|
15
|
+
GAME_UNAVAILABLE: "GAME_UNAVAILABLE",
|
|
16
|
+
RECONNECT_DATA_MISMATCH: "RECONNECT_DATA_MISMATCH",
|
|
17
|
+
TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES"
|
|
18
|
+
}, s = {
|
|
19
|
+
ERROR: "ERROR",
|
|
20
|
+
GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED",
|
|
21
|
+
INVALID_CURRENCY: "INVALID_CURRENCY",
|
|
22
|
+
INVALID_SESSION: "INVALID_SESSION",
|
|
23
|
+
OUT_OF_MONEY: "OUT_OF_MONEY",
|
|
24
|
+
UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS",
|
|
25
|
+
WALLET_ERROR: "WALLET_ERROR"
|
|
26
|
+
};
|
|
27
|
+
class a extends Error {
|
|
28
|
+
constructor(N) {
|
|
29
|
+
super();
|
|
30
|
+
R(this, "data");
|
|
31
|
+
this.name = "OpenGameError", this.data = N;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
class T extends Error {
|
|
35
|
+
constructor(N) {
|
|
36
|
+
super();
|
|
37
|
+
R(this, "data");
|
|
38
|
+
this.name = "PlayError", this.data = N;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class o extends Error {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(), this.name = "TimeoutError";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
a as O,
|
|
48
|
+
T as P,
|
|
49
|
+
o as T,
|
|
50
|
+
A as a,
|
|
51
|
+
s as b
|
|
52
|
+
};
|
package/dist/index.cjs
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* BSD 3-Clause License
|
|
3
3
|
* Copyright (c) 2024, Kalamba Games Limited
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var
|
|
5
|
+
"use strict";var N=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var m=(r,i,t)=>(N(r,i,"read from private field"),t?t.call(r):i.get(r)),s=(r,i,t)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,t)},u=(r,i,t,n)=>(N(r,i,"write to private field"),n?n.call(r,t):i.set(r,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./errors-66b5612a.cjs");function O(r){const i=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&i==="[object Date]"?new r.constructor(+r):typeof r=="number"||i==="[object Number]"||typeof r=="string"||i==="[object String]"?new Date(r):new Date(NaN)}function U(r){const i=O(r);return i.setHours(23,59,59,999),i}function B(){return U(Date.now())}function k(r){const i=O(r);return i.setHours(0,0,0,0),i}function G(){return k(Date.now())}const L=3e4;var F,S;class ${constructor(i){s(this,F,void 0);s(this,S,L);u(this,F,i)}buildHeaders(){const i={};return m(this,F).token&&(i.Authorization=`Bearer ${m(this,F).token}`),i}async request(i,t){const n=new URL(i,m(this,F).apiUrl??window.location.origin);return n.search=new URLSearchParams({...t}).toString(),await(await fetch(n,{signal:AbortSignal.timeout(m(this,S)),headers:this.buildHeaders()})).json()}async getRounds(i){return this.request("/rounds",i)}async getRound(i,t){return this.request(`/rounds/${i}`,t)}}F=new WeakMap,S=new WeakMap;const R={limit:100,page:0};var e,f;class I{constructor({config:i}){s(this,e,void 0);s(this,f,void 0);u(this,e,i),u(this,f,new $({apiUrl:i.api.gameHistoryUrl}))}async getRound(i,{pagination:t=R}={}){return m(this,f).getRound(i,{gameCode:m(this,e).api.game,operatorCode:m(this,e).api.brand,username:m(this,e).api.user,...t})}async getLastRound(){return m(this,e).api.lastRoundId?this.getRound(m(this,e).api.lastRoundId):null}async getRounds({searchPeriod:i={fromDateTime:G(),toDateTime:B()},pagination:t=R}={}){const n=m(this,e).api.user.replace(/^user_/,"").replace(new RegExp(`_${m(this,e).api.integration}$`),"");return m(this,f).getRounds({gameCode:m(this,e).api.game,operatorCode:m(this,e).api.integration,username:n,fromDataTime:i.fromDateTime.toISOString(),toDateTime:i.toDateTime.toISOString(),...t})}}e=new WeakMap,f=new WeakMap;function _(r,i){return r*i/100}function A(r,i,t){if(!["string","number"].includes(typeof i))return"NaN";const{locales:n}=r;try{return new Intl.NumberFormat(n,{...t,numberingSystem:"latn",style:"decimal"}).format(+i)}catch{return`${i}`}}const w="XTS";var y=(r=>(r.Currency="Currency",r.Number="Number",r))(y||{}),l=(r=>(r.Coins="Coins",r.Money="Money",r))(l||{});const T={ARSB:{displayAs:"ARS",maximumFractionDigits:2,minimumFractionDigits:2},CHIPS:{maximumFractionDigits:0,minimumFractionDigits:0},BNB:{maximumFractionDigits:6,minimumFractionDigits:6},BUSD:{maximumFractionDigits:4,minimumFractionDigits:4},BTC:{maximumFractionDigits:8,minimumFractionDigits:2},mBTC:{maximumFractionDigits:5,minimumFractionDigits:2},uBTC:{maximumFractionDigits:2,minimumFractionDigits:2},BCH:{maximumFractionDigits:8,minimumFractionDigits:2},mBCH:{maximumFractionDigits:2,minimumFractionDigits:2},ETH:{maximumFractionDigits:8,minimumFractionDigits:2},mETH:{maximumFractionDigits:5,minimumFractionDigits:2},uETH:{maximumFractionDigits:2,minimumFractionDigits:2},SOC:{maximumFractionDigits:8,minimumFractionDigits:2},LTC:{maximumFractionDigits:8,minimumFractionDigits:2},mLTC:{maximumFractionDigits:5,minimumFractionDigits:2},uLTC:{maximumFractionDigits:2,minimumFractionDigits:2},DOG:{maximumFractionDigits:4,minimumFractionDigits:2},USDC:{maximumFractionDigits:4,minimumFractionDigits:4},USDT:{maximumFractionDigits:4,minimumFractionDigits:2},TRX:{maximumFractionDigits:2,minimumFractionDigits:2},TUSD:{maximumFractionDigits:2,minimumFractionDigits:2},DAI:{maximumFractionDigits:2,minimumFractionDigits:2},XMR:{maximumFractionDigits:4,minimumFractionDigits:4},CBET:{maximumFractionDigits:0,minimumFractionDigits:0},kCBET:{maximumFractionDigits:2,minimumFractionDigits:2},SHIB:{maximumFractionDigits:0,minimumFractionDigits:0},kSHIB:{maximumFractionDigits:4,minimumFractionDigits:2},NEO:{maximumFractionDigits:4,minimumFractionDigits:4},BSV:{maximumFractionDigits:4,minimumFractionDigits:4},EOS:{maximumFractionDigits:4,minimumFractionDigits:4},DASH:{maximumFractionDigits:4,minimumFractionDigits:4},XLM:{maximumFractionDigits:2,minimumFractionDigits:2},KRW:{maximumFractionDigits:2,minimumFractionDigits:2},kVND:{maximumFractionDigits:4,minimumFractionDigits:2},kIDR:{maximumFractionDigits:4,minimumFractionDigits:2},RSD:{maximumFractionDigits:2,minimumFractionDigits:2},STAKEGC:{displayAs:"GC",maximumFractionDigits:0,minimumFractionDigits:0},STAKESC:{displayAs:"SC",maximumFractionDigits:2,minimumFractionDigits:2},"FC.":{maximumFractionDigits:2,minimumFractionDigits:2},"GC.":{maximumFractionDigits:2,minimumFractionDigits:2},"SC.":{maximumFractionDigits:2,minimumFractionDigits:2},SVC:{maximumFractionDigits:2,minimumFractionDigits:2},DOT:{maximumFractionDigits:4,minimumFractionDigits:4},SOL:{maximumFractionDigits:4,minimumFractionDigits:4},XRP:{maximumFractionDigits:4,minimumFractionDigits:4},ADA:{maximumFractionDigits:4,minimumFractionDigits:4},TON:{maximumFractionDigits:4,minimumFractionDigits:4},FTN:{maximumFractionDigits:4,minimumFractionDigits:4}};function M(r){return r in T}function j(r){return M(r)?{...T[r],currency:w}:{currency:r}}function q(r,i,t){const n=i.format(+r);return M(t)?n.replace(w,T[t].displayAs??t):n}function V(r,i,t){const{maximumFractionDigits:n,minimumFractionDigits:o}=t.resolvedOptions();return A(r,i,{maximumFractionDigits:n,minimumFractionDigits:o})}function v(r,i,{as:t}={as:"Currency"}){const{canShowCurrency:n,currency:o}=r;return t==="Number"||!n?`${i}`:`${i} ${o}`}function K(r,i,{as:t,from:n}={as:"Currency",from:"Money"},o){if(!["string","number"].includes(typeof i))return"NaN";const{canShowCurrency:a=!0,coinValueInCents:D,currency:x,locales:E}=r;n==="Coins"&&(i=_(+i,D));try{const H=j(x),b=new Intl.NumberFormat(E,{...H,...o,currencyDisplay:"symbol",numberingSystem:"latn",style:"currency"});return t==="Number"||!a?V(r,i,b):q(i,b,x)}catch{return v(r,i,{as:t})}}var c;class P{constructor({config:i}){s(this,c,void 0);u(this,c,i)}formatNumber(i,t){const n={locales:[m(this,c).ui.language]};return A(n,i,t)}formatCurrency(i,t={as:y.Currency,from:l.Money},n){const o=m(this,c).ui.feature.showCurrency,a=m(this,c).api.coinValueInCents,D=m(this,c).api.currency||w,x=[m(this,c).ui.language];return K({canShowCurrency:o,coinValueInCents:a,currency:D,locales:x},i,t,n)}formatCoins(i,t){return this.formatCurrency(i,{as:y.Number,from:l.Coins},t)}formatCoinsWithCurrency(i,t){return this.formatCurrency(i,{as:y.Currency,from:l.Coins},t)}formatMoney(i,t){return this.formatCurrency(i,{as:y.Number,from:l.Money},t)}formatMoneyWithCurrency(i,t){return this.formatCurrency(i,{as:y.Currency,from:l.Money},t)}}c=new WeakMap;const X=()=>{};var h,d,p,C;class z{constructor({messagePort:i}){s(this,h,void 0);s(this,d,void 0);s(this,p,void 0);s(this,C,void 0);u(this,C,i),this.on("configured",t=>{u(this,h,t),u(this,p,new P({config:t})),u(this,d,new I({config:t}))}),this.on("playResponse",t=>{this.config.api.lastRoundId=t.contract.roundId})}get config(){if(!m(this,h))throw new Error("config is not initialized, you must open game first");return m(this,h)}get history(){if(!m(this,d))throw new Error("config is not initialized, you must open game first");return m(this,d)}get i18n(){if(!m(this,p))throw new Error("i18n is not initialized, you must open game first");return m(this,p)}request(i,...[t]){return new Promise(n=>{this.on(`${i}Response`,o=>n({type:"response",response:o}),{once:!0}),this.on(`${i}Error`,o=>n({type:"error",error:o}),{once:!0}),this.send(i,t)})}on(i,t,n){const o=function a(D){D.data.message===`kalamba:wrapper:${i}`&&(X("on",D.data.message.replace(/^kalamba:/,""),D.data.payload),t(D.data.payload),n!=null&&n.once&&window.removeEventListener("message",a))};window.addEventListener("message",o)}send(i,...[t]){m(this,C).postMessage({message:`kalamba:sdk:${i}`,payload:t},"*")}async openGame(i){const[,t]=await Promise.all([new Promise(n=>this.on("configured",n,{once:!0})),this.request("openGame",i)]);if(t.type==="response")return t.response;throw t.error.type==="timeout"?new g.TimeoutError:new g.OpenGameError(t.error.data)}async play(i,t,n="SPIN"){const o={contract:i,extra:t,actionType:n},a=await this.request("play",o);if(a.type==="response")return a.response;throw a.error.type==="timeout"?new g.TimeoutError:new g.PlayError(a.error.data)}}h=new WeakMap,d=new WeakMap,p=new WeakMap,C=new WeakMap;exports.OpenGameError=g.OpenGameError;exports.OpenGameErrorCode=g.OpenGameErrorCode;exports.PlayError=g.PlayError;exports.PlayErrorCode=g.PlayErrorCode;exports.TimeoutError=g.TimeoutError;exports.History=I;exports.I18n=P;exports.KalambaSdk=z;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CurrencyFormat } from '@kalamba/common/src/utils/format/currency';
|
|
2
|
+
import { CurrencyNumber } from '@kalamba/common/src/utils/format/currency';
|
|
1
3
|
import { FormatCurrencyOptions } from '@kalamba/common/src/utils/format/currency';
|
|
2
4
|
|
|
3
5
|
declare interface AddEventListenerOptions_2 {
|
|
@@ -39,7 +41,7 @@ export declare type CasinoOnlyMessagePayloadMap = {
|
|
|
39
41
|
help: {
|
|
40
42
|
show?: boolean;
|
|
41
43
|
};
|
|
42
|
-
history:
|
|
44
|
+
history: History_3;
|
|
43
45
|
paytable: {
|
|
44
46
|
show?: boolean;
|
|
45
47
|
};
|
|
@@ -53,8 +55,13 @@ export declare type CasinoOnlyMessagePayloadMap = {
|
|
|
53
55
|
export declare type ContractPlayPayload = {
|
|
54
56
|
[key: string]: any;
|
|
55
57
|
bet: Bet | null;
|
|
58
|
+
forceOutcome?: unknown;
|
|
56
59
|
};
|
|
57
60
|
|
|
61
|
+
export { CurrencyFormat }
|
|
62
|
+
|
|
63
|
+
export { CurrencyNumber }
|
|
64
|
+
|
|
58
65
|
export declare type DomainAllowedPayloadMap<P extends DomainPrefix> = DomainToMessagePayloadMap[P];
|
|
59
66
|
|
|
60
67
|
export declare type DomainMessage<P extends DomainPrefix> = keyof DomainAllowedPayloadMap<P>;
|
|
@@ -83,6 +90,8 @@ declare type Error_2 = {
|
|
|
83
90
|
};
|
|
84
91
|
export { Error_2 as Error }
|
|
85
92
|
|
|
93
|
+
export { FormatCurrencyOptions }
|
|
94
|
+
|
|
86
95
|
export declare type ForwardToPluginsMessage<P extends PluginDomain> = keyof ForwardToPluginsMessageMap<'sdk'>[P] | keyof ForwardToPluginsMessageMap<'rgs'>[P] | keyof ForwardToPluginsMessageMap<'casino'>[P] | keyof ForwardToPluginsMessageMap<'telemetry'>[P];
|
|
87
96
|
|
|
88
97
|
export declare interface ForwardToPluginsMessageMap<SourceDomain extends DomainPrefix> {
|
|
@@ -97,12 +106,31 @@ export declare type ForwardToSdkMessage = keyof ToSdkForwardedMessageMap;
|
|
|
97
106
|
|
|
98
107
|
export declare type ForwardToSdkMessagePayload<M extends ForwardToSdkMessage> = ToSdkForwardedMessageMap[M];
|
|
99
108
|
|
|
100
|
-
declare
|
|
109
|
+
export declare interface GetRoundOptions {
|
|
110
|
+
pagination?: Pagination;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export declare interface GetRoundsOptions {
|
|
114
|
+
searchPeriod?: SearchPeriod;
|
|
115
|
+
pagination?: Pagination;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class History_2 {
|
|
119
|
+
#private;
|
|
120
|
+
constructor({ config }: {
|
|
121
|
+
config: SdkConfig;
|
|
122
|
+
});
|
|
123
|
+
getRound(roundId: string, { pagination }?: GetRoundOptions): Promise<unknown>;
|
|
124
|
+
getLastRound(): Promise<unknown>;
|
|
125
|
+
getRounds({ searchPeriod, pagination, }?: GetRoundsOptions): Promise<unknown>;
|
|
126
|
+
}
|
|
127
|
+
export { History_2 as History }
|
|
128
|
+
|
|
129
|
+
declare type History_3 = {
|
|
101
130
|
source: 'realityCheck' | 'settings' | 'casino';
|
|
102
131
|
};
|
|
103
|
-
export { History_2 as History }
|
|
104
132
|
|
|
105
|
-
export declare class
|
|
133
|
+
export declare class I18n {
|
|
106
134
|
#private;
|
|
107
135
|
constructor({ config }: {
|
|
108
136
|
config: SdkConfig;
|
|
@@ -121,7 +149,8 @@ export declare class KalambaSdk {
|
|
|
121
149
|
messagePort: Window;
|
|
122
150
|
});
|
|
123
151
|
get config(): SdkConfig;
|
|
124
|
-
get
|
|
152
|
+
get history(): History_2;
|
|
153
|
+
get i18n(): I18n;
|
|
125
154
|
protected request<M extends DomainMessage<'sdk'>>(message: M, ...[payload]: DomainMessagePayload<'sdk', M> extends never ? [] : [payload: DomainMessagePayload<'sdk', M>]): Promise<RgsResponse<M>>;
|
|
126
155
|
on<M extends DomainMessage<'wrapper'> | ForwardToSdkMessage>(message: M, listener: (payload: M extends DomainMessage<'wrapper'> ? DomainMessagePayload<'wrapper', M> : M extends ForwardToSdkMessage ? ForwardToSdkMessagePayload<M> : never) => void, options?: AddEventListenerOptions_2): void;
|
|
127
156
|
send<M extends DomainMessage<'sdk'>>(message: M, ...[payload]: DomainMessagePayload<'sdk', M> extends never ? [] : [DomainMessagePayload<'sdk', M>]): void;
|
|
@@ -141,13 +170,33 @@ export declare type MessageMessageEvent<M extends Message> = MessageEvent<{
|
|
|
141
170
|
export declare type MessagePayload<M extends Message> = MessageMap[M];
|
|
142
171
|
|
|
143
172
|
export declare class OpenGameError extends Error {
|
|
144
|
-
|
|
145
|
-
|
|
173
|
+
data: {
|
|
174
|
+
code: keyof typeof OpenGameErrorCode;
|
|
175
|
+
};
|
|
176
|
+
constructor(data: {
|
|
177
|
+
code: keyof typeof OpenGameErrorCode;
|
|
178
|
+
});
|
|
146
179
|
}
|
|
147
180
|
|
|
148
181
|
declare type OpenGameError_2 = {
|
|
149
|
-
|
|
150
|
-
|
|
182
|
+
type: 'timeout';
|
|
183
|
+
} | {
|
|
184
|
+
type: 'error';
|
|
185
|
+
data: {
|
|
186
|
+
code: keyof typeof OpenGameErrorCode;
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export declare const OpenGameErrorCode: {
|
|
191
|
+
readonly CONNECTION_ERROR: "CONNECTION_ERROR";
|
|
192
|
+
readonly ALREADY_LOGGED_IN: "ALREADY_LOGGED_IN";
|
|
193
|
+
readonly DENIED: "DENIED";
|
|
194
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
195
|
+
readonly BONUS_RESTRICTION: "BONUS_RESTRICTION";
|
|
196
|
+
readonly ERROR: "ERROR";
|
|
197
|
+
readonly GAME_UNAVAILABLE: "GAME_UNAVAILABLE";
|
|
198
|
+
readonly RECONNECT_DATA_MISMATCH: "RECONNECT_DATA_MISMATCH";
|
|
199
|
+
readonly TOO_MANY_OPEN_GAMES: "TOO_MANY_OPEN_GAMES";
|
|
151
200
|
};
|
|
152
201
|
|
|
153
202
|
export declare type OpenGameRequest = {
|
|
@@ -160,10 +209,7 @@ export declare type OpenGameResponse = {
|
|
|
160
209
|
contract: {
|
|
161
210
|
bet: {
|
|
162
211
|
available: Record<number, number[]>;
|
|
163
|
-
default:
|
|
164
|
-
base: number;
|
|
165
|
-
multiplier: number;
|
|
166
|
-
};
|
|
212
|
+
default: Bet;
|
|
167
213
|
max: number;
|
|
168
214
|
last: Bet | null;
|
|
169
215
|
lastPaid: Bet | null;
|
|
@@ -185,6 +231,7 @@ export declare type OpenGameResponse = {
|
|
|
185
231
|
}[];
|
|
186
232
|
version: string;
|
|
187
233
|
};
|
|
234
|
+
roundId?: string;
|
|
188
235
|
serverTime: number;
|
|
189
236
|
sessionId: string;
|
|
190
237
|
stateType: {
|
|
@@ -200,14 +247,37 @@ export declare type OpenGameResponse = {
|
|
|
200
247
|
data: unknown;
|
|
201
248
|
};
|
|
202
249
|
|
|
250
|
+
export declare interface Pagination {
|
|
251
|
+
limit: number;
|
|
252
|
+
page: number;
|
|
253
|
+
}
|
|
254
|
+
|
|
203
255
|
export declare class PlayError extends Error {
|
|
204
|
-
|
|
205
|
-
|
|
256
|
+
data: {
|
|
257
|
+
code: keyof typeof PlayErrorCode;
|
|
258
|
+
};
|
|
259
|
+
constructor(data: {
|
|
260
|
+
code: keyof typeof PlayErrorCode;
|
|
261
|
+
});
|
|
206
262
|
}
|
|
207
263
|
|
|
208
264
|
declare type PlayError_2 = {
|
|
209
|
-
|
|
210
|
-
|
|
265
|
+
type: 'timeout';
|
|
266
|
+
} | {
|
|
267
|
+
type: 'error';
|
|
268
|
+
data: {
|
|
269
|
+
code: keyof typeof PlayErrorCode;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
export declare const PlayErrorCode: {
|
|
274
|
+
readonly ERROR: "ERROR";
|
|
275
|
+
readonly GAMING_LIMITS_REACHED: "GAMING_LIMITS_REACHED";
|
|
276
|
+
readonly INVALID_CURRENCY: "INVALID_CURRENCY";
|
|
277
|
+
readonly INVALID_SESSION: "INVALID_SESSION";
|
|
278
|
+
readonly OUT_OF_MONEY: "OUT_OF_MONEY";
|
|
279
|
+
readonly UNFINISHED_ROUND_IN_PROGRESS: "UNFINISHED_ROUND_IN_PROGRESS";
|
|
280
|
+
readonly WALLET_ERROR: "WALLET_ERROR";
|
|
211
281
|
};
|
|
212
282
|
|
|
213
283
|
export declare type PlayRequest = {
|
|
@@ -226,8 +296,8 @@ export declare type PlayResponse = {
|
|
|
226
296
|
coins: number;
|
|
227
297
|
version: number;
|
|
228
298
|
};
|
|
229
|
-
serverTime: number;
|
|
230
299
|
roundId: string;
|
|
300
|
+
serverTime: number;
|
|
231
301
|
stateType: {
|
|
232
302
|
thisRound: string;
|
|
233
303
|
nextRound: string;
|
|
@@ -286,13 +356,13 @@ export declare type RgsOnlyMessagePayloadMap = {
|
|
|
286
356
|
};
|
|
287
357
|
};
|
|
288
358
|
|
|
289
|
-
export declare type RgsResponse<M extends DomainMessage<'sdk'>> =
|
|
359
|
+
export declare type RgsResponse<M extends DomainMessage<'sdk'>> = {
|
|
290
360
|
type: 'response';
|
|
291
|
-
response: DomainMessagePayload<'rgs', `${M}Response
|
|
361
|
+
response: `${M}Response` extends DomainMessage<'rgs'> ? DomainMessagePayload<'rgs', `${M}Response`> : never;
|
|
292
362
|
} | {
|
|
293
363
|
type: 'error';
|
|
294
|
-
error: DomainMessagePayload<'rgs', `${M}Error
|
|
295
|
-
}
|
|
364
|
+
error: `${M}Error` extends DomainMessage<'rgs'> ? DomainMessagePayload<'rgs', `${M}Error`> : never;
|
|
365
|
+
};
|
|
296
366
|
|
|
297
367
|
export declare interface SdkConfig {
|
|
298
368
|
api: {
|
|
@@ -378,7 +448,7 @@ export declare type SdkOnlyMessagePayloadMap = {
|
|
|
378
448
|
fullscreen: {
|
|
379
449
|
lock?: OrientationLockType;
|
|
380
450
|
};
|
|
381
|
-
history:
|
|
451
|
+
history: History_3;
|
|
382
452
|
loadEnd: never;
|
|
383
453
|
loadProgress: {
|
|
384
454
|
progress: number;
|
|
@@ -402,6 +472,11 @@ export declare type SdkOnlyMessagePayloadMap = {
|
|
|
402
472
|
'telemetry.orientationChange': never;
|
|
403
473
|
};
|
|
404
474
|
|
|
475
|
+
export declare interface SearchPeriod {
|
|
476
|
+
fromDateTime: Date;
|
|
477
|
+
toDateTime: Date;
|
|
478
|
+
}
|
|
479
|
+
|
|
405
480
|
export declare type Settings = {
|
|
406
481
|
fastPlay?: boolean;
|
|
407
482
|
fastPlaySpeed?: number;
|
|
@@ -448,7 +523,7 @@ export declare type WrapperOnlyMessagePayloadMap = {
|
|
|
448
523
|
close: never;
|
|
449
524
|
configured: SdkConfig;
|
|
450
525
|
freeze: never;
|
|
451
|
-
history:
|
|
526
|
+
history: History_3;
|
|
452
527
|
resume: never;
|
|
453
528
|
state: WrapperState;
|
|
454
529
|
suspend: never;
|