@frequency-chain/ethereum-utils 1.17.2 → 1.17.3
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/browser/frequency-ethereum-utils.esm.min.js +812 -627
- package/browser/frequency-ethereum-utils.umd.min.js +811 -626
- package/cjs/signature.js +14 -0
- package/esm/signature.js +14 -0
- package/package.json +4 -4
- package/signature.d.ts +10 -0
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": "1.17.
|
|
3
|
+
"version": "1.17.3",
|
|
4
4
|
"bugs": {
|
|
5
5
|
"url": "https://github.com/frequency-chain/frequency/issues"
|
|
6
6
|
},
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"author": "frequency-chain",
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@polkadot/api": "^16.3
|
|
19
|
-
"@polkadot/util": "13.5.
|
|
18
|
+
"@polkadot/api": "^16.4.3",
|
|
19
|
+
"@polkadot/util": "13.5.4",
|
|
20
20
|
"ethers": "^6.15.0"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@rollup/rollup-linux-x64-gnu": "^4.
|
|
23
|
+
"@rollup/rollup-linux-x64-gnu": "^4.46.1"
|
|
24
24
|
},
|
|
25
25
|
"module": "./esm/index.js",
|
|
26
26
|
"types": "index.d.ts",
|
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.
|