@frequency-chain/ethereum-utils 0.0.0-775e5c → 0.0.0-7c7edc

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.
@@ -42,7 +42,7 @@ exports.ADD_PROVIDER_DEFINITION = {
42
42
  type: 'uint64',
43
43
  },
44
44
  {
45
- name: 'schemaIds',
45
+ name: 'intentIds',
46
46
  type: 'uint16[]',
47
47
  },
48
48
  {
package/cjs/signature.js CHANGED
@@ -171,9 +171,9 @@ function createAddKeyData(msaId, newPublicKey, expirationBlock) {
171
171
  * @param authorizedPublicKey 32 bytes public key to authorize in hex or Uint8Array
172
172
  * @param expirationBlock Block number after which this payload is invalid
173
173
  */
174
- function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
174
+ function createAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock) {
175
175
  const parsedMsaId = typeof msaId === 'string' ? msaId : `${msaId}`;
176
- const parsedNewPublicKey = typeof newPublicKey === 'object' ? (0, util_1.u8aToHex)(newPublicKey) : newPublicKey;
176
+ const parsedNewPublicKey = typeof authorizedPublicKey === 'object' ? (0, util_1.u8aToHex)(authorizedPublicKey) : authorizedPublicKey;
177
177
  (0, utils_js_1.assert)((0, utils_js_1.isValidUint64String)(parsedMsaId), 'msaId should be a valid uint64');
178
178
  (0, utils_js_1.assert)((0, utils_js_1.isValidUint32)(expirationBlock), 'expiration should be a valid uint32');
179
179
  (0, utils_js_1.assert)((0, utils_js_1.isHexString)(parsedNewPublicKey), 'newPublicKey should be valid hex');
@@ -188,19 +188,19 @@ function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
188
188
  * Build an AddProvider payload for signature.
189
189
  *
190
190
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
191
- * @param schemaIds One or more schema IDs (uint16) the provider may use
191
+ * @param intentIds One or more schema IDs (uint16) the provider may use
192
192
  * @param expirationBlock Block number after which this payload is invalid
193
193
  */
194
- function createAddProvider(authorizedMsaId, schemaIds, expirationBlock) {
194
+ function createAddProvider(authorizedMsaId, intentIds, expirationBlock) {
195
195
  (0, utils_js_1.assert)((0, utils_js_1.isValidUint64String)(authorizedMsaId), 'authorizedMsaId should be a valid uint64');
196
196
  (0, utils_js_1.assert)((0, utils_js_1.isValidUint32)(expirationBlock), 'expiration should be a valid uint32');
197
- schemaIds.forEach((schemaId) => {
198
- (0, utils_js_1.assert)((0, utils_js_1.isValidUint16)(schemaId), 'schemaId should be a valid uint16');
197
+ intentIds.forEach((intentId) => {
198
+ (0, utils_js_1.assert)((0, utils_js_1.isValidUint16)(intentId), 'intentId should be a valid uint16');
199
199
  });
200
200
  return {
201
201
  type: 'AddProvider',
202
202
  authorizedMsaId: authorizedMsaId.toString(),
203
- schemaIds,
203
+ intentIds,
204
204
  expiration: expirationBlock,
205
205
  };
206
206
  }
@@ -396,12 +396,12 @@ function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, ex
396
396
  * Returns the EIP-712 browser request for a AddProvider for signing.
397
397
  *
398
398
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
399
- * @param schemaIds One or more schema IDs (uint16) the provider may use
399
+ * @param intentIds One or more schema IDs (uint16) the provider may use
400
400
  * @param expirationBlock Block number after which this payload is invalid
401
401
  * @param domain
402
402
  */
403
- function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain = signature_definitions_js_1.EIP712_DOMAIN_MAINNET) {
404
- const message = createAddProvider(authorizedMsaId, schemaIds, expirationBlock);
403
+ function getEip712BrowserRequestAddProvider(authorizedMsaId, intentIds, expirationBlock, domain = signature_definitions_js_1.EIP712_DOMAIN_MAINNET) {
404
+ const message = createAddProvider(authorizedMsaId, intentIds, expirationBlock);
405
405
  const normalized = normalizePayload(message);
406
406
  return createEip712Payload(signature_definitions_js_1.ADD_PROVIDER_DEFINITION, message.type, domain, normalized);
407
407
  }
@@ -39,7 +39,7 @@ export const ADD_PROVIDER_DEFINITION = {
39
39
  type: 'uint64',
40
40
  },
41
41
  {
42
- name: 'schemaIds',
42
+ name: 'intentIds',
43
43
  type: 'uint16[]',
44
44
  },
45
45
  {
package/esm/signature.js CHANGED
@@ -142,9 +142,9 @@ export function createAddKeyData(msaId, newPublicKey, expirationBlock) {
142
142
  * @param authorizedPublicKey 32 bytes public key to authorize in hex or Uint8Array
143
143
  * @param expirationBlock Block number after which this payload is invalid
144
144
  */
145
- export function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
145
+ export function createAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock) {
146
146
  const parsedMsaId = typeof msaId === 'string' ? msaId : `${msaId}`;
147
- const parsedNewPublicKey = typeof newPublicKey === 'object' ? u8aToHex(newPublicKey) : newPublicKey;
147
+ const parsedNewPublicKey = typeof authorizedPublicKey === 'object' ? u8aToHex(authorizedPublicKey) : authorizedPublicKey;
148
148
  assert(isValidUint64String(parsedMsaId), 'msaId should be a valid uint64');
149
149
  assert(isValidUint32(expirationBlock), 'expiration should be a valid uint32');
150
150
  assert(isHexString(parsedNewPublicKey), 'newPublicKey should be valid hex');
@@ -159,19 +159,19 @@ export function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
159
159
  * Build an AddProvider payload for signature.
160
160
  *
161
161
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
162
- * @param schemaIds One or more schema IDs (uint16) the provider may use
162
+ * @param intentIds One or more schema IDs (uint16) the provider may use
163
163
  * @param expirationBlock Block number after which this payload is invalid
164
164
  */
165
- export function createAddProvider(authorizedMsaId, schemaIds, expirationBlock) {
165
+ export function createAddProvider(authorizedMsaId, intentIds, expirationBlock) {
166
166
  assert(isValidUint64String(authorizedMsaId), 'authorizedMsaId should be a valid uint64');
167
167
  assert(isValidUint32(expirationBlock), 'expiration should be a valid uint32');
168
- schemaIds.forEach((schemaId) => {
169
- assert(isValidUint16(schemaId), 'schemaId should be a valid uint16');
168
+ intentIds.forEach((intentId) => {
169
+ assert(isValidUint16(intentId), 'intentId should be a valid uint16');
170
170
  });
171
171
  return {
172
172
  type: 'AddProvider',
173
173
  authorizedMsaId: authorizedMsaId.toString(),
174
- schemaIds,
174
+ intentIds,
175
175
  expiration: expirationBlock,
176
176
  };
177
177
  }
@@ -367,12 +367,12 @@ export function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublic
367
367
  * Returns the EIP-712 browser request for a AddProvider for signing.
368
368
  *
369
369
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
370
- * @param schemaIds One or more schema IDs (uint16) the provider may use
370
+ * @param intentIds One or more schema IDs (uint16) the provider may use
371
371
  * @param expirationBlock Block number after which this payload is invalid
372
372
  * @param domain
373
373
  */
374
- export function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
375
- const message = createAddProvider(authorizedMsaId, schemaIds, expirationBlock);
374
+ export function getEip712BrowserRequestAddProvider(authorizedMsaId, intentIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
375
+ const message = createAddProvider(authorizedMsaId, intentIds, expirationBlock);
376
376
  const normalized = normalizePayload(message);
377
377
  return createEip712Payload(ADD_PROVIDER_DEFINITION, message.type, domain, normalized);
378
378
  }
package/index.d.ts CHANGED
@@ -7,8 +7,8 @@ declare const _default: {
7
7
  sign(secretKey: payloads.HexString, payload: payloads.SupportedPayload, chain: payloads.ChainType): Promise<payloads.EcdsaSignature>;
8
8
  verifySignature(ethereumAddress: payloads.HexString, signature: payloads.HexString, payload: payloads.SupportedPayload, chain: payloads.ChainType): boolean;
9
9
  createAddKeyData(msaId: string | bigint, newPublicKey: payloads.HexString | Uint8Array, expirationBlock: number): payloads.AddKeyData;
10
- createAuthorizedKeyData(msaId: string | bigint, newPublicKey: payloads.HexString | Uint8Array, expirationBlock: number): payloads.AuthorizedKeyData;
11
- createAddProvider(authorizedMsaId: string | bigint, schemaIds: number[], expirationBlock: number): payloads.AddProvider;
10
+ createAuthorizedKeyData(msaId: string | bigint, authorizedPublicKey: payloads.HexString | Uint8Array, expirationBlock: number): payloads.AuthorizedKeyData;
11
+ createAddProvider(authorizedMsaId: string | bigint, intentIds: number[], expirationBlock: number): payloads.AddProvider;
12
12
  createRecoveryCommitmentPayload(recoveryCommitment: payloads.HexString, expirationBlock: number): payloads.RecoveryCommitmentPayload;
13
13
  createClaimHandlePayload(handle: string, expirationBlock: number): payloads.ClaimHandlePayload;
14
14
  createPasskeyPublicKey(publicKey: payloads.HexString | Uint8Array): payloads.PasskeyPublicKey;
@@ -21,7 +21,7 @@ declare const _default: {
21
21
  createSiwfLoginRequestPayload(message: string): payloads.SiwfLoginRequestPayload;
22
22
  getEip712BrowserRequestAddKeyData(msaId: string | bigint, newPublicKey: payloads.HexString | Uint8Array, expirationBlock: number, domain?: payloads.EipDomainPayload): unknown;
23
23
  getEip712BrowserRequestAuthorizedKeyData(msaId: string | bigint, authorizedPublicKey: payloads.HexString | Uint8Array, expirationBlock: number, domain?: payloads.EipDomainPayload): unknown;
24
- getEip712BrowserRequestAddProvider(authorizedMsaId: string | bigint, schemaIds: number[], expirationBlock: number, domain?: payloads.EipDomainPayload): unknown;
24
+ getEip712BrowserRequestAddProvider(authorizedMsaId: string | bigint, intentIds: number[], expirationBlock: number, domain?: payloads.EipDomainPayload): unknown;
25
25
  getEip712BrowserRequestRecoveryCommitmentPayload(recoveryCommitment: payloads.HexString, expirationBlock: number, domain?: payloads.EipDomainPayload): unknown;
26
26
  getEip712BrowserRequestPaginatedUpsertSignaturePayloadV2(schemaId: number, pageId: number, targetHash: number, expiration: number, payload: payloads.HexString | Uint8Array, domain?: payloads.EipDomainPayload): unknown;
27
27
  getEip712BrowserRequestPaginatedDeleteSignaturePayloadV2(schemaId: number, pageId: number, targetHash: number, expiration: number, domain?: payloads.EipDomainPayload): unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frequency-chain/ethereum-utils",
3
- "version": "0.0.0-775e5c",
3
+ "version": "0.0.0-7c7edc",
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.4.3",
19
- "@polkadot/util": "13.5.4",
18
+ "@polkadot/api": "16.4.8",
19
+ "@polkadot/util": "13.5.7",
20
20
  "ethers": "6.15.0"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@rollup/rollup-linux-x64-gnu": "4.46.1"
23
+ "@rollup/rollup-linux-x64-gnu": "4.52.4"
24
24
  },
25
25
  "module": "./esm/index.js",
26
26
  "types": "index.d.ts",
package/payloads.d.ts CHANGED
@@ -74,7 +74,7 @@ export interface AuthorizedKeyData {
74
74
  export interface AddProvider {
75
75
  type: 'AddProvider';
76
76
  authorizedMsaId: string;
77
- schemaIds: number[];
77
+ intentIds: number[];
78
78
  expiration: number;
79
79
  }
80
80
  export interface RecoveryCommitmentPayload {
package/signature.d.ts CHANGED
@@ -31,15 +31,15 @@ export declare function createAddKeyData(msaId: string | bigint, newPublicKey: H
31
31
  * @param authorizedPublicKey 32 bytes public key to authorize in hex or Uint8Array
32
32
  * @param expirationBlock Block number after which this payload is invalid
33
33
  */
34
- export declare function createAuthorizedKeyData(msaId: string | bigint, newPublicKey: HexString | Uint8Array, expirationBlock: number): AuthorizedKeyData;
34
+ export declare function createAuthorizedKeyData(msaId: string | bigint, authorizedPublicKey: HexString | Uint8Array, expirationBlock: number): AuthorizedKeyData;
35
35
  /**
36
36
  * Build an AddProvider payload for signature.
37
37
  *
38
38
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
39
- * @param schemaIds One or more schema IDs (uint16) the provider may use
39
+ * @param intentIds One or more schema IDs (uint16) the provider may use
40
40
  * @param expirationBlock Block number after which this payload is invalid
41
41
  */
42
- export declare function createAddProvider(authorizedMsaId: string | bigint, schemaIds: number[], expirationBlock: number): AddProvider;
42
+ export declare function createAddProvider(authorizedMsaId: string | bigint, intentIds: number[], expirationBlock: number): AddProvider;
43
43
  /**
44
44
  * Build a RecoveryCommitmentPayload for signature.
45
45
  *
@@ -136,11 +136,11 @@ export declare function getEip712BrowserRequestAuthorizedKeyData(msaId: string |
136
136
  * Returns the EIP-712 browser request for a AddProvider for signing.
137
137
  *
138
138
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
139
- * @param schemaIds One or more schema IDs (uint16) the provider may use
139
+ * @param intentIds One or more schema IDs (uint16) the provider may use
140
140
  * @param expirationBlock Block number after which this payload is invalid
141
141
  * @param domain
142
142
  */
143
- export declare function getEip712BrowserRequestAddProvider(authorizedMsaId: string | bigint, schemaIds: number[], expirationBlock: number, domain?: EipDomainPayload): unknown;
143
+ export declare function getEip712BrowserRequestAddProvider(authorizedMsaId: string | bigint, intentIds: number[], expirationBlock: number, domain?: EipDomainPayload): unknown;
144
144
  /**
145
145
  * Returns the EIP-712 browser request for a RecoveryCommitmentPayload for signing.
146
146
  *