Hi ,
I have come across an issue, regarding the block hash viewability. Recently concordium changed the result which was being displayed on the rpc.waitForTransactionFinalization(). Now we are getting a block hash for the result rather than the actual status. Please tell me How do I resolve this because I need the actual error for error handling.
code:
export const call_contract = async (
param: string | number | boolean | { [key: string]: SmartContractParameters } | SmartContractParameters ,
method: string,
amount: string | number | bigint | boolean
) => {
const { provider, account } = await initialize();
const rpc = provider.getGrpcClient();
if (!account) {
alert(“Please connect”);
}
try {
const schemaBuffer = Buffer.from(CIS2_MINT_Module_Schema, "base64");
const serializedParams = serializeUpdateContractParameters(
MINT_CIS2_CONTRACT_NAME,
method,
param,
schemaBuffer,
SchemaVersion.V1
);
if (account) {
// const walletExport = PRIVATE_KEY;
// const sender = new AccountAddress(walletExport.value.address);
// console.log(sender);
const txnHash = await provider.sendTransaction(
account,
AccountTransactionType.Update,
{
address: {
index: MINT_INDEX,
subindex: SUB_INDEX,
},
// message: serializedParams,
amount: new CcdAmount(BigInt(amount ?? 0)),
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
receiveName: `${MINT_CIS2_CONTRACT_NAME}.${method}`,
maxContractExecutionEnergy: MAX_CONTRACT_EXECUTION_ENERGY_MINT,
},
param,
schemaBuffer.toString("base64")
);
// console.log(txnHash);
const tx_finalization = await rpc.waitForTransactionFinalization(txnHash);
return tx_finalization;
}
} catch (err) {
console.log("Current issue:");
console.log(err);
}
};
Doris
May 24, 2024, 12:53pm
2
Can you clarify which versions you are using:
There was a breaking change in:
waitForTransactionFinalization now returns a BlockItemSummaryInBlock
# Changelog
## 7.4.0
### Added
- `toString`, `toJSON`, and `fromJSON` to most concordium domain types.
- Deprecated types and functions related to typed JSON serialization and deserialization.
- Various types related to CIS-2, CIS-3, and CIS-4 events and errors in the `CIS2`, `CIS3`, and `CIS4` namespaces.
- `deserializeCIS2Event`, `deserializeCIS3Event`, and `deserializeCIS4Event` for deserializing a CIS event from a `ContractEvent`.
- `deserializeCIS2Events` and `deserializeCIS2EventsFromSummary` for deserializing all CIS-2 events from `InvokeContractSuccessResult`s and `BlockItemSummary`s, respectively, as well as similar functions for CIS-3 and CIS-4 events.
- `parseCIS2RejectionError` for parsing a CIS-2 rejection error from a `InvokeContractFailureResult`.
- `CIS3Contract` class for interacting with contracts adhering to the CIS-3 standard.
- `Parameter.parseWithSchemaTypeBase64` and `Parameter.parseWithSchemaType` to
help parsing smart contract parameters into typed structures.
- Documentation on when`TransactionExpiry.toJSON` throws an error.
- `Timestamp.futureMinutes` for creating a `Timestamp` a number of minutes in the future.
- `verifyPresentation` function to `@concordium/web-sdk/wasm`, which can be used to verify the credential proofs in the presentation object.
- `getPublicData` function to `@concordium/web-sdk/web3-id`, which is a helper function for accessing the public data of a `VerifiablePresentation` from chain.
- `verifyCredentialMetadata` function to `@concordium/web-sdk/web3-id`, which is a helper function for fetching and verifying metadata associated with a credential proof.
This file has been truncated. show original
Here is an example how the function is used in code:
.finally(() => setShowMessage(true));
}
}
// Wait until the submitted transaction is finalized.
// Once the transaction is finalized, extract the
// newly created ItemIndex from the event emitted within the transaction.
useEffect(() => {
if (connection && grpcClient && addItemTxHash !== undefined) {
grpcClient
.waitForTransactionFinalization(addItemTxHash)
.then((report) => {
if (
report.summary.type === TransactionSummaryType.AccountTransaction &&
report.summary.transactionType === TransactionKindString.Update
) {
const eventList = report.summary.events[0] as UpdatedEvent;
const parsedEvent = AuctionContract.parseEvent(eventList.events[0]);
setItemIndex(parsedEvent.content.item_index);