Please see the code below
from app.tsx
const params = {
credential_info: {
valid_from: “2023-08-24T12:00:00+05:00”,
valid_until: {“None”: []},
holder_revocable: true,
holder_id: “c9762a4d5ba0ac17e4190428e140d897f4012ed4c4d0780064ebb780a7a46abb”,
metadata_url:{
url: “”,
hash: {“None”: []}
},
“auxiliary_data”: [44]
}
};
// let params1 = “{ a:1 }”
// const params2 = Buffer.from(params);
const updateParams = serializeUpdateContractParameters(
contractName,
‘registerCredential’,
params,
rawModuleSchema
);
With contract entry points being following
/// Parameters for registering a credential
#[derive(Serialize, SchemaType, Clone, Debug)]
pub struct RegisterCredentialParam {
/// Public credential data.
credential_info: CredentialInfo,
/// Any additional data required by the issuer in the registration process.
/// This data is not used in this contract. However, it is part of the CIS-4
/// standard that this contract implements; auxiliary_data
can be
/// used, for example, to implement signature-based authentication.
#[concordium(size_length = 2)]
auxiliary_data: Vec,
}
#[derive(Serialize, SchemaType, PartialEq, Eq, Clone, Debug)]
pub struct CredentialInfo {
/// The holder’s identifier is a public key.
holder_id: CredentialHolderId,
/// If this flag is set to true
the holder can send a signed message to
/// revoke their credential.
holder_revocable: bool,
/// The date from which the credential is considered valid.
valid_from: Timestamp,
/// After this date, the credential becomes expired. None
corresponds to a
/// credential that cannot expire.
valid_until: Option,
/// Link to the metadata of this credential.
metadata_url: MetadataUrl,
}
The error being received is following
test-contract-v2@1.0.0 start
tsc && node dist/app.js
Express is listening at http://localhost:3000
string
/home/yasir/concordium_dev/dapps/test-contract-v2/node_modules/@concordium/rust-bindings/pkg/node/concordium_rust_bindings.js:1409
const ret = new Error(getStringFromWasm0(arg0, arg1));
^
Error: Unable to serialize parameters, due to: “credential_info” → Too many fields provided
at module.exports.__wbindgen_error_new (/home/yasir/concordium_dev/dapps/test-contract-v2/node_modules/@concordium/rust-bindings/pkg/node/concordium_rust_bindings.js:1409:17)
at wasm://wasm/00748e9a:wasm-function[1054]:0x15c788
at module.exports.serializeReceiveContractParameters (/home/yasir/concordium_dev/dapps/test-contract-v2/node_modules/@concordium/rust-bindings/pkg/node/concordium_rust_bindings.js:511:14)
at serializeUpdateContractParameters (/home/yasir/concordium_dev/dapps/test-contract-v2/node_modules/@concordium/common-sdk/lib/serialization.js:323:39)
at testContract (file:///home/yasir/concordium_dev/dapps/test-contract-v2/dist/app.js:50:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The goal is to invoke the contract with custom parameters, I can invoke the contract with parameters provided above using cli, however with Node (typescript) I am receiving following error.