Skip to content

Commit abc0bc2

Browse files
authored
HAL fixes (#172)
* JS client fixes, HAL-02, HAL-03, HAL-04 - Mising events ChangeSecurity / ChangeEventsMode - Missing ChangeEventsModeParams - Unused burnerList / mintAndBurnList * Unused const ENTRY_POINT_UPGRADE * Unused cases in get_immediate_caller HAl-05 * // typo * // Typo * // typo
1 parent 874a7c3 commit abc0bc2

File tree

12 files changed

+699
-396
lines changed

12 files changed

+699
-396
lines changed

client-js/README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ const burnResult = await cep18.burn({
298298

299299
```ts
300300
const minterList = [ali.publicKey];
301-
const burnerList = [ali.publicKey, bob.publicKey];
302301

303302
const params: TransactionParams = {
304303
sender: owner.publicKey,
@@ -307,8 +306,7 @@ const params: TransactionParams = {
307306
};
308307

309308
const changeSecurityArgs: ChangeSecurityArgs = {
310-
minterList: newMinterList,
311-
burnerList: newBurnerList
309+
minterList: newMinterList
312310
};
313311

314312
const changeSecurityResult = await client.changeSecurity({
@@ -318,6 +316,28 @@ const changeSecurityResult = await client.changeSecurity({
318316
});
319317
```
320318

319+
**Changing Events Mode**
320+
321+
```ts
322+
const eventsMode = EVENTS_MODE.Native;
323+
324+
const params: TransactionParams = {
325+
sender: owner.publicKey,
326+
paymentAmount: String(3_000_000_000),
327+
signingKeys: [owner]
328+
};
329+
330+
const changeEventsModeArgs: ChangeEventsModeParams = {
331+
params,
332+
args: { eventsMode },
333+
waitForTransactionProcessed: true
334+
};
335+
336+
const changeEventsModeResult = await client.changeEventsMode(
337+
changeEventsModeArgs
338+
);
339+
```
340+
321341
# Environment Variables for Casper CEP-18 Integration
322342

323343
This `.env` file contains essential environment variables for configuring the examples and e2e tests, including RPC and SSE endpoints, private key handling, and cryptographic settings.

client-js/examples/events.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
type BurnArgs,
66
CEP18_EVENTS,
77
CEP18EventResult,
8-
InfoGetTransactionResult
8+
InfoGetTransactionResult,
9+
EVENTS_MODE
910
} from 'dist';
1011
import {
1112
PRIVATE_KEY_FAUCET,
@@ -122,6 +123,28 @@ const usage = async () => {
122123
);
123124

124125
cep18.stopEventStream();
126+
127+
// Change Events mode to Native events, wait for transaction instead of listener
128+
params = {
129+
sender: owner.publicKey,
130+
paymentAmount: String(3_000_000_000),
131+
signingKeys: [owner]
132+
};
133+
134+
const changeEventsModeArgs = {
135+
eventsMode: EVENTS_MODE.Native
136+
};
137+
138+
await cep18.changeEventsMode({
139+
params,
140+
args: changeEventsModeArgs,
141+
waitForTransactionProcessed: true
142+
});
143+
144+
const newEventsMode = await cep18.eventsMode();
145+
console.info(
146+
`Events Mode changed successfully, new events mode : ${newEventsMode.toString()}`
147+
);
125148
};
126149

127150
const eventListener = async (
@@ -137,7 +160,7 @@ const eventListener = async (
137160
}));
138161

139162
console.info(
140-
`Contract ${eventType} transaction hash: ${transactionInfo.transactionHash}`
163+
`Contract ${eventType} transaction hash: ${transactionInfo.transactionHash.toHex()}`
141164
);
142165

143166
if (executionResult) {

0 commit comments

Comments
 (0)