@frequency-chain/ethereum-utils 0.0.0-82b111 → 0.0.0-95dcbc

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.
@@ -19823,13 +19823,27 @@ function createPasskeyPublicKey(publicKey) {
19823
19823
  publicKey: parsedNewPublicKey,
19824
19824
  };
19825
19825
  }
19826
+ /**
19827
+ * Build AddAction payload for Itemized storage.
19828
+ *
19829
+ * @param data The data to be persisted on the Frequency chain
19830
+ */
19826
19831
  function createItemizedAddAction(data) {
19827
19832
  const parsedData = typeof data === 'object' ? u8aToHex(data) : data;
19828
19833
  assert(isHexString(parsedData), 'itemized data should be valid hex');
19834
+ // since Metamask does not support union types, we have to include all fields and have to set the `index` value to zero
19835
+ // even though it is not used for Add action
19829
19836
  return { actionType: 'Add', data, index: 0 };
19830
19837
  }
19838
+ /**
19839
+ * Build DeleteAction payload for Itemized storage.
19840
+ *
19841
+ * @param index The index of the item that we want to remove from the Frequency chain
19842
+ */
19831
19843
  function createItemizedDeleteAction(index) {
19832
19844
  assert(isValidUint16(index), 'itemized index should be a valid uint16');
19845
+ // since Metamask does not support union types, we have to include all fields and have to set the `data` value to 0x
19846
+ // even though it is not used for Delete action
19833
19847
  return { actionType: 'Delete', data: '0x', index };
19834
19848
  }
19835
19849
  /**
@@ -11069,13 +11069,27 @@ function createPasskeyPublicKey(publicKey) {
11069
11069
  publicKey: parsedNewPublicKey,
11070
11070
  };
11071
11071
  }
11072
+ /**
11073
+ * Build AddAction payload for Itemized storage.
11074
+ *
11075
+ * @param data The data to be persisted on the Frequency chain
11076
+ */
11072
11077
  function createItemizedAddAction(data) {
11073
11078
  const parsedData = typeof data === 'object' ? u8aToHex(data) : data;
11074
11079
  assert(isHexString(parsedData), 'itemized data should be valid hex');
11080
+ // since Metamask does not support union types, we have to include all fields and have to set the `index` value to zero
11081
+ // even though it is not used for Add action
11075
11082
  return { actionType: 'Add', data, index: 0 };
11076
11083
  }
11084
+ /**
11085
+ * Build DeleteAction payload for Itemized storage.
11086
+ *
11087
+ * @param index The index of the item that we want to remove from the Frequency chain
11088
+ */
11077
11089
  function createItemizedDeleteAction(index) {
11078
11090
  assert(isValidUint16(index), 'itemized index should be a valid uint16');
11091
+ // since Metamask does not support union types, we have to include all fields and have to set the `data` value to 0x
11092
+ // even though it is not used for Delete action
11079
11093
  return { actionType: 'Delete', data: '0x', index };
11080
11094
  }
11081
11095
  /**
package/cjs/signature.js CHANGED
@@ -247,13 +247,27 @@ function createPasskeyPublicKey(publicKey) {
247
247
  publicKey: parsedNewPublicKey,
248
248
  };
249
249
  }
250
+ /**
251
+ * Build AddAction payload for Itemized storage.
252
+ *
253
+ * @param data The data to be persisted on the Frequency chain
254
+ */
250
255
  function createItemizedAddAction(data) {
251
256
  const parsedData = typeof data === 'object' ? (0, util_1.u8aToHex)(data) : data;
252
257
  (0, utils_js_1.assert)((0, utils_js_1.isHexString)(parsedData), 'itemized data should be valid hex');
258
+ // since Metamask does not support union types, we have to include all fields and have to set the `index` value to zero
259
+ // even though it is not used for Add action
253
260
  return { actionType: 'Add', data, index: 0 };
254
261
  }
262
+ /**
263
+ * Build DeleteAction payload for Itemized storage.
264
+ *
265
+ * @param index The index of the item that we want to remove from the Frequency chain
266
+ */
255
267
  function createItemizedDeleteAction(index) {
256
268
  (0, utils_js_1.assert)((0, utils_js_1.isValidUint16)(index), 'itemized index should be a valid uint16');
269
+ // since Metamask does not support union types, we have to include all fields and have to set the `data` value to 0x
270
+ // even though it is not used for Delete action
257
271
  return { actionType: 'Delete', data: '0x', index };
258
272
  }
259
273
  /**
package/esm/signature.js CHANGED
@@ -218,13 +218,27 @@ export function createPasskeyPublicKey(publicKey) {
218
218
  publicKey: parsedNewPublicKey,
219
219
  };
220
220
  }
221
+ /**
222
+ * Build AddAction payload for Itemized storage.
223
+ *
224
+ * @param data The data to be persisted on the Frequency chain
225
+ */
221
226
  export function createItemizedAddAction(data) {
222
227
  const parsedData = typeof data === 'object' ? u8aToHex(data) : data;
223
228
  assert(isHexString(parsedData), 'itemized data should be valid hex');
229
+ // since Metamask does not support union types, we have to include all fields and have to set the `index` value to zero
230
+ // even though it is not used for Add action
224
231
  return { actionType: 'Add', data, index: 0 };
225
232
  }
233
+ /**
234
+ * Build DeleteAction payload for Itemized storage.
235
+ *
236
+ * @param index The index of the item that we want to remove from the Frequency chain
237
+ */
226
238
  export function createItemizedDeleteAction(index) {
227
239
  assert(isValidUint16(index), 'itemized index should be a valid uint16');
240
+ // since Metamask does not support union types, we have to include all fields and have to set the `data` value to 0x
241
+ // even though it is not used for Delete action
228
242
  return { actionType: 'Delete', data: '0x', index };
229
243
  }
230
244
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frequency-chain/ethereum-utils",
3
- "version": "0.0.0-82b111",
3
+ "version": "0.0.0-95dcbc",
4
4
  "bugs": {
5
5
  "url": "https://github.com/frequency-chain/frequency/issues"
6
6
  },
package/signature.d.ts CHANGED
@@ -60,7 +60,17 @@ export declare function createClaimHandlePayload(handle: string, expirationBlock
60
60
  * @param publicKey The passkey’s public key (hex string or raw bytes)
61
61
  */
62
62
  export declare function createPasskeyPublicKey(publicKey: HexString | Uint8Array): PasskeyPublicKey;
63
+ /**
64
+ * Build AddAction payload for Itemized storage.
65
+ *
66
+ * @param data The data to be persisted on the Frequency chain
67
+ */
63
68
  export declare function createItemizedAddAction(data: HexString | Uint8Array): AddItemizedAction;
69
+ /**
70
+ * Build DeleteAction payload for Itemized storage.
71
+ *
72
+ * @param index The index of the item that we want to remove from the Frequency chain
73
+ */
64
74
  export declare function createItemizedDeleteAction(index: number): DeleteItemizedAction;
65
75
  /**
66
76
  * Build an ItemizedSignaturePayloadV2 for signing.