@frequency-chain/ethereum-utils 1.17.8 → 2.0.0-rc1

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.
@@ -19616,7 +19616,7 @@ const ADD_PROVIDER_DEFINITION = {
19616
19616
  type: 'uint64',
19617
19617
  },
19618
19618
  {
19619
- name: 'schemaIds',
19619
+ name: 'intentIds',
19620
19620
  type: 'uint16[]',
19621
19621
  },
19622
19622
  {
@@ -19912,9 +19912,9 @@ function createAddKeyData(msaId, newPublicKey, expirationBlock) {
19912
19912
  * @param authorizedPublicKey 32 bytes public key to authorize in hex or Uint8Array
19913
19913
  * @param expirationBlock Block number after which this payload is invalid
19914
19914
  */
19915
- function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
19915
+ function createAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock) {
19916
19916
  const parsedMsaId = typeof msaId === 'string' ? msaId : `${msaId}`;
19917
- const parsedNewPublicKey = typeof newPublicKey === 'object' ? u8aToHex(newPublicKey) : newPublicKey;
19917
+ const parsedNewPublicKey = typeof authorizedPublicKey === 'object' ? u8aToHex(authorizedPublicKey) : authorizedPublicKey;
19918
19918
  assert(isValidUint64String(parsedMsaId), 'msaId should be a valid uint64');
19919
19919
  assert(isValidUint32(expirationBlock), 'expiration should be a valid uint32');
19920
19920
  assert(isHexString(parsedNewPublicKey), 'newPublicKey should be valid hex');
@@ -19929,19 +19929,19 @@ function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
19929
19929
  * Build an AddProvider payload for signature.
19930
19930
  *
19931
19931
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
19932
- * @param schemaIds One or more schema IDs (uint16) the provider may use
19932
+ * @param intentIds One or more schema IDs (uint16) the provider may use
19933
19933
  * @param expirationBlock Block number after which this payload is invalid
19934
19934
  */
19935
- function createAddProvider(authorizedMsaId, schemaIds, expirationBlock) {
19935
+ function createAddProvider(authorizedMsaId, intentIds, expirationBlock) {
19936
19936
  assert(isValidUint64String(authorizedMsaId), 'authorizedMsaId should be a valid uint64');
19937
19937
  assert(isValidUint32(expirationBlock), 'expiration should be a valid uint32');
19938
- schemaIds.forEach((schemaId) => {
19939
- assert(isValidUint16(schemaId), 'schemaId should be a valid uint16');
19938
+ intentIds.forEach((intentId) => {
19939
+ assert(isValidUint16(intentId), 'intentId should be a valid uint16');
19940
19940
  });
19941
19941
  return {
19942
19942
  type: 'AddProvider',
19943
19943
  authorizedMsaId: authorizedMsaId.toString(),
19944
- schemaIds,
19944
+ intentIds,
19945
19945
  expiration: expirationBlock,
19946
19946
  };
19947
19947
  }
@@ -20137,12 +20137,12 @@ function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, ex
20137
20137
  * Returns the EIP-712 browser request for a AddProvider for signing.
20138
20138
  *
20139
20139
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
20140
- * @param schemaIds One or more schema IDs (uint16) the provider may use
20140
+ * @param intentIds One or more schema IDs (uint16) the provider may use
20141
20141
  * @param expirationBlock Block number after which this payload is invalid
20142
20142
  * @param domain
20143
20143
  */
20144
- function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
20145
- const message = createAddProvider(authorizedMsaId, schemaIds, expirationBlock);
20144
+ function getEip712BrowserRequestAddProvider(authorizedMsaId, intentIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
20145
+ const message = createAddProvider(authorizedMsaId, intentIds, expirationBlock);
20146
20146
  const normalized = normalizePayload(message);
20147
20147
  return createEip712Payload(ADD_PROVIDER_DEFINITION, message.type, domain, normalized);
20148
20148
  }
@@ -10862,7 +10862,7 @@ const ADD_PROVIDER_DEFINITION = {
10862
10862
  type: 'uint64',
10863
10863
  },
10864
10864
  {
10865
- name: 'schemaIds',
10865
+ name: 'intentIds',
10866
10866
  type: 'uint16[]',
10867
10867
  },
10868
10868
  {
@@ -11158,9 +11158,9 @@ function createAddKeyData(msaId, newPublicKey, expirationBlock) {
11158
11158
  * @param authorizedPublicKey 32 bytes public key to authorize in hex or Uint8Array
11159
11159
  * @param expirationBlock Block number after which this payload is invalid
11160
11160
  */
11161
- function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
11161
+ function createAuthorizedKeyData(msaId, authorizedPublicKey, expirationBlock) {
11162
11162
  const parsedMsaId = typeof msaId === 'string' ? msaId : `${msaId}`;
11163
- const parsedNewPublicKey = typeof newPublicKey === 'object' ? u8aToHex(newPublicKey) : newPublicKey;
11163
+ const parsedNewPublicKey = typeof authorizedPublicKey === 'object' ? u8aToHex(authorizedPublicKey) : authorizedPublicKey;
11164
11164
  assert(isValidUint64String(parsedMsaId), 'msaId should be a valid uint64');
11165
11165
  assert(isValidUint32(expirationBlock), 'expiration should be a valid uint32');
11166
11166
  assert(isHexString(parsedNewPublicKey), 'newPublicKey should be valid hex');
@@ -11175,19 +11175,19 @@ function createAuthorizedKeyData(msaId, newPublicKey, expirationBlock) {
11175
11175
  * Build an AddProvider payload for signature.
11176
11176
  *
11177
11177
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
11178
- * @param schemaIds One or more schema IDs (uint16) the provider may use
11178
+ * @param intentIds One or more schema IDs (uint16) the provider may use
11179
11179
  * @param expirationBlock Block number after which this payload is invalid
11180
11180
  */
11181
- function createAddProvider(authorizedMsaId, schemaIds, expirationBlock) {
11181
+ function createAddProvider(authorizedMsaId, intentIds, expirationBlock) {
11182
11182
  assert(isValidUint64String(authorizedMsaId), 'authorizedMsaId should be a valid uint64');
11183
11183
  assert(isValidUint32(expirationBlock), 'expiration should be a valid uint32');
11184
- schemaIds.forEach((schemaId) => {
11185
- assert(isValidUint16(schemaId), 'schemaId should be a valid uint16');
11184
+ intentIds.forEach((intentId) => {
11185
+ assert(isValidUint16(intentId), 'intentId should be a valid uint16');
11186
11186
  });
11187
11187
  return {
11188
11188
  type: 'AddProvider',
11189
11189
  authorizedMsaId: authorizedMsaId.toString(),
11190
- schemaIds,
11190
+ intentIds,
11191
11191
  expiration: expirationBlock,
11192
11192
  };
11193
11193
  }
@@ -11383,12 +11383,12 @@ function getEip712BrowserRequestAuthorizedKeyData(msaId, authorizedPublicKey, ex
11383
11383
  * Returns the EIP-712 browser request for a AddProvider for signing.
11384
11384
  *
11385
11385
  * @param authorizedMsaId MSA ID (uint64) that will be granted provider rights
11386
- * @param schemaIds One or more schema IDs (uint16) the provider may use
11386
+ * @param intentIds One or more schema IDs (uint16) the provider may use
11387
11387
  * @param expirationBlock Block number after which this payload is invalid
11388
11388
  * @param domain
11389
11389
  */
11390
- function getEip712BrowserRequestAddProvider(authorizedMsaId, schemaIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
11391
- const message = createAddProvider(authorizedMsaId, schemaIds, expirationBlock);
11390
+ function getEip712BrowserRequestAddProvider(authorizedMsaId, intentIds, expirationBlock, domain = EIP712_DOMAIN_MAINNET) {
11391
+ const message = createAddProvider(authorizedMsaId, intentIds, expirationBlock);
11392
11392
  const normalized = normalizePayload(message);
11393
11393
  return createEip712Payload(ADD_PROVIDER_DEFINITION, message.type, domain, normalized);
11394
11394
  }
@@ -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": "1.17.8",
3
+ "version": "2.0.0-rc1",
4
4
  "bugs": {
5
5
  "url": "https://github.com/frequency-chain/frequency/issues"
6
6
  },
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
  *