@concordium/browser-wallet-api-helpers 2.2.0 → 2.3.0

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 CHANGED
@@ -165,6 +165,22 @@ const provider = await detectConcordiumProvider();
165
165
  await provider.addCIS2Tokens('2za2yAXbFiaB151oYqTteZfqiBzibHXizwjNbpdU8hodq9SfEk', ['AA', 'BB'], '1399', '0');
166
166
  ```
167
167
 
168
+ ### Prove ID statement
169
+
170
+ It is possible to request a proof for a given ID statement on a specific account. The function takes 3 arguments. The statement to be proved, a challenge to ensure that the proof was not generated for a different context, and the account that should prove that statement.
171
+ This method returns a `Promise` resolving with an object containing the proof and the credential id (field name: credential) of the credential used to prove the statement.
172
+
173
+ If the wallet is locked, or you have not connected with the wallet (or previously been whitelisted) or if the user rejects proving the statement, the `Promise` will reject.
174
+
175
+ The following exemplifies requesting a proof for a statement name myIdStatement (To see how to create a statement check out [our documentation](https://developer.concordium.software/en/mainnet/net/guides/create-proofs.html)) with a challenge of "12346789ABCD" id, for the account `2za2yAXbFiaB151oYqTteZfqiBzibHXizwjNbpdU8hodq9SfEk`.
176
+
177
+ ```typescript
178
+ const statement = myIdStatement;
179
+ const challenge = '12346789ABCD';
180
+ const provider = await detectConcordiumProvider();
181
+ await provider.requestIdProof('2za2yAXbFiaB151oYqTteZfqiBzibHXizwjNbpdU8hodq9SfEk', ['AA', 'BB'], '1399', '0');
182
+ ```
183
+
168
184
  ## Events
169
185
 
170
186
  ### Account changed
@@ -1,5 +1,8 @@
1
1
  import type { AccountTransactionPayload, AccountTransactionSignature, AccountTransactionType, InitContractPayload, JsonRpcClient, SchemaVersion, UpdateContractPayload, IdStatement, IdProofOutput } from '@concordium/web-sdk';
2
- declare type SendTransactionPayload = Exclude<AccountTransactionPayload, UpdateContractPayload | InitContractPayload> | Omit<UpdateContractPayload, 'message'> | Omit<InitContractPayload, 'param'>;
2
+ export declare type SendTransactionPayload = Exclude<AccountTransactionPayload, UpdateContractPayload | InitContractPayload> | Omit<UpdateContractPayload, 'message'> | Omit<InitContractPayload, 'param'>;
3
+ export declare type SmartContractParameters = {
4
+ [key: string]: SmartContractParameters;
5
+ } | SmartContractParameters[] | number | string | boolean;
3
6
  /**
4
7
  * An enumeration of the events that can be emitted by the WalletApi.
5
8
  */
@@ -35,7 +38,7 @@ interface MainWalletApi {
35
38
  * @param schema schema used for the initContract and updateContract transactions to serialize the parameters. Should be base64 encoded.
36
39
  * @param schemaVersion version of the schema provided. Must be supplied for schemas that use version 0 or 1, as they don't have the version embedded.
37
40
  */
38
- sendTransaction(accountAddress: string, type: AccountTransactionType.Update | AccountTransactionType.InitContract, payload: SendTransactionPayload, parameters: Record<string, unknown>, schema: string | SchemaWithContext, schemaVersion?: SchemaVersion): Promise<string>;
41
+ sendTransaction(accountAddress: string, type: AccountTransactionType.Update | AccountTransactionType.InitContract, payload: SendTransactionPayload, parameters: SmartContractParameters, schema: string | SchemaWithContext, schemaVersion?: SchemaVersion): Promise<string>;
39
42
  /**
40
43
  * Sends a transaction to the Concordium Wallet and awaits the users action. Note that a header is not sent, and will be constructed by the wallet itself.
41
44
  * Note that if the user rejects signing the transaction, this will throw an error.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concordium/browser-wallet-api-helpers",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "license": "Apache-2.0",
5
5
  "packageManager": "yarn@3.2.0",
6
6
  "main": "lib/index.js",