bet-test-sdk 1.1.7 → 1.1.9
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 +31 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -14,6 +14,29 @@ The `BetSDK` is designed to interact with the bet.com decentralized application.
|
|
14
14
|
npm i bet-test-sdk
|
15
15
|
`
|
16
16
|
|
17
|
+
## Notice (for developers)
|
18
|
+
If you get an error about `crypto` when building dist with frameworks such as react, vue, nextjs, etc. on the frontend,
|
19
|
+
consider installing plugins such as node-polyfills OR add the crypto-browserify alias to the configuration file.
|
20
|
+
|
21
|
+
For example:
|
22
|
+
```
|
23
|
+
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
24
|
+
|
25
|
+
plugins: [
|
26
|
+
nodePolyfills({
|
27
|
+
include: ['crypto'],
|
28
|
+
}),
|
29
|
+
],
|
30
|
+
|
31
|
+
OR
|
32
|
+
|
33
|
+
resolve: {
|
34
|
+
alias: {
|
35
|
+
crypto: 'crypto-browserify',
|
36
|
+
}
|
37
|
+
},
|
38
|
+
```
|
39
|
+
|
17
40
|
## Usage Example
|
18
41
|
|
19
42
|
First you need to create a `.env` file and set your RPC URL like in the `.env.example`
|
@@ -326,10 +349,15 @@ const setupEventListeners = async (sdk) => {
|
|
326
349
|
});
|
327
350
|
console.log("Subscribed to createEvent with ID:", createEventId);
|
328
351
|
|
329
|
-
const
|
330
|
-
console.log("
|
352
|
+
const buyEventId = sdk.addEventListener("buyEvent", (event, slot, signature) => {
|
353
|
+
console.log("buyEvent", event, slot, signature);
|
354
|
+
});
|
355
|
+
console.log("Subscribed to buyEvent with ID:", buyEventId);
|
356
|
+
|
357
|
+
const sellEventId = sdk.addEventListener("sellEvent", (event, slot, signature) => {
|
358
|
+
console.log("sellEvent", event, slot, signature);
|
331
359
|
});
|
332
|
-
console.log("Subscribed to
|
360
|
+
console.log("Subscribed to sellEvent with ID:", sellEventId);
|
333
361
|
|
334
362
|
const completeEventId = sdk.addEventListener("completeEvent", (event, slot, signature) => {
|
335
363
|
console.log("completeEvent", event, slot, signature);
|