@momo-cloud/gami-sdk 0.0.67 → 0.0.68
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/README.md +8 -14
- package/dist/index.public.d.ts +2 -2
- package/dist/index.public.js +1206 -1205
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,14 +52,8 @@ await GamiSDK.startGame();
|
|
|
52
52
|
|
|
53
53
|
// Your game logic here...
|
|
54
54
|
|
|
55
|
-
//
|
|
56
|
-
const result = await GamiSDK.
|
|
57
|
-
steps: [
|
|
58
|
-
{ action: 'move', timestamp: Date.now() },
|
|
59
|
-
{ action: 'jump', timestamp: Date.now() }
|
|
60
|
-
],
|
|
61
|
-
score: 1000
|
|
62
|
-
});
|
|
55
|
+
// make spin to get reward
|
|
56
|
+
const result = await GamiSDK.spin();
|
|
63
57
|
|
|
64
58
|
// End game session
|
|
65
59
|
await GamiSDK.endGame();
|
|
@@ -135,12 +129,12 @@ console.log('Game config:', config);
|
|
|
135
129
|
|
|
136
130
|
---
|
|
137
131
|
|
|
138
|
-
#### `
|
|
132
|
+
#### `getCoinExchangeInfo()`
|
|
139
133
|
|
|
140
134
|
Load exchange metadata for the current game (coin → turn). The backend uses the fixed action `exchange_coin_to_turn`; the active `gameId` comes from `init`.
|
|
141
135
|
|
|
142
136
|
```typescript
|
|
143
|
-
const res = await GamiSDK.
|
|
137
|
+
const res = await GamiSDK.getCoinExchangeInfo();
|
|
144
138
|
const { balance, exchangeRate, counter, counterLimit, fromCurrency, toCurrency } = res.result;
|
|
145
139
|
```
|
|
146
140
|
|
|
@@ -148,12 +142,12 @@ const { balance, exchangeRate, counter, counterLimit, fromCurrency, toCurrency }
|
|
|
148
142
|
|
|
149
143
|
---
|
|
150
144
|
|
|
151
|
-
#### `
|
|
145
|
+
#### `coinExchange(options)`
|
|
152
146
|
|
|
153
147
|
Submit a coin-to-turn exchange for the current game.
|
|
154
148
|
|
|
155
149
|
```typescript
|
|
156
|
-
const res = await GamiSDK.
|
|
150
|
+
const res = await GamiSDK.coinExchange({ amount: 100 });
|
|
157
151
|
const { from, to, counter } = res.result;
|
|
158
152
|
```
|
|
159
153
|
|
|
@@ -840,8 +834,8 @@ const balance: TBalance = await GamiSDK.getBalance({
|
|
|
840
834
|
balanceIds: ['coin']
|
|
841
835
|
});
|
|
842
836
|
|
|
843
|
-
const exchangeInfo: TGetExchangeResponse = await GamiSDK.
|
|
844
|
-
const posted: TPostExchangeResponse = await GamiSDK.
|
|
837
|
+
const exchangeInfo: TGetExchangeResponse = await GamiSDK.getCoinExchangeInfo();
|
|
838
|
+
const posted: TPostExchangeResponse = await GamiSDK.coinExchange({ amount: 100 });
|
|
845
839
|
```
|
|
846
840
|
|
|
847
841
|
### Vite Integration
|
package/dist/index.public.d.ts
CHANGED
|
@@ -57,10 +57,10 @@ declare const GamiSDK: {
|
|
|
57
57
|
}) => Promise<any>;
|
|
58
58
|
getBalanceConfig: () => Promise<any>;
|
|
59
59
|
getConfig: () => Promise<any>;
|
|
60
|
-
|
|
60
|
+
getCoinExchangeInfo: (params?: {
|
|
61
61
|
actionId?: string;
|
|
62
62
|
}) => Promise<TGetExchangeResponse>;
|
|
63
|
-
|
|
63
|
+
coinExchange: (params: {
|
|
64
64
|
amount: number;
|
|
65
65
|
actionId?: string;
|
|
66
66
|
}) => Promise<TPostExchangeResponse>;
|