@nucypher/taco 0.7.0-alpha.3 → 0.7.0-alpha.4

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.
Files changed (75) hide show
  1. package/dist/cjs/conditions/condition.d.ts +1 -0
  2. package/dist/cjs/conditions/condition.js +4 -3
  3. package/dist/cjs/conditions/condition.js.map +1 -1
  4. package/dist/cjs/conditions/predefined/address-allowlist.d.ts +11 -0
  5. package/dist/cjs/conditions/predefined/address-allowlist.js +31 -0
  6. package/dist/cjs/conditions/predefined/address-allowlist.js.map +1 -0
  7. package/dist/cjs/conditions/predefined/index.d.ts +1 -0
  8. package/dist/cjs/conditions/predefined/index.js +2 -1
  9. package/dist/cjs/conditions/predefined/index.js.map +1 -1
  10. package/dist/cjs/conditions/schemas/address-allowlist.d.ts +3 -0
  11. package/dist/cjs/conditions/schemas/address-allowlist.js +11 -0
  12. package/dist/cjs/conditions/schemas/address-allowlist.js.map +1 -0
  13. package/dist/cjs/conditions/schemas/context-variable.d.ts +46 -0
  14. package/dist/cjs/conditions/schemas/contract.d.ts +54 -0
  15. package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +2 -0
  16. package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +3 -0
  17. package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
  18. package/dist/cjs/conditions/schemas/json-api.d.ts +54 -0
  19. package/dist/cjs/conditions/schemas/json-rpc.d.ts +54 -0
  20. package/dist/cjs/conditions/schemas/json.d.ts +46 -0
  21. package/dist/cjs/conditions/schemas/return-value-test.d.ts +76 -0
  22. package/dist/cjs/conditions/schemas/return-value-test.js +2 -0
  23. package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
  24. package/dist/cjs/conditions/schemas/rpc.d.ts +46 -0
  25. package/dist/cjs/conditions/schemas/sequential.js +6 -2
  26. package/dist/cjs/conditions/schemas/sequential.js.map +1 -1
  27. package/dist/cjs/conditions/schemas/time.d.ts +46 -0
  28. package/dist/cjs/conditions/schemas/utils.js +0 -2
  29. package/dist/cjs/conditions/schemas/utils.js.map +1 -1
  30. package/dist/cjs/conditions/schemas/variable-operation.d.ts +48 -0
  31. package/dist/cjs/conditions/schemas/variable-operation.js +81 -0
  32. package/dist/cjs/conditions/schemas/variable-operation.js.map +1 -0
  33. package/dist/cjs/sign.d.ts +2 -2
  34. package/dist/cjs/sign.js +73 -38
  35. package/dist/cjs/sign.js.map +1 -1
  36. package/dist/cjs/types.d.ts +1 -1
  37. package/dist/es/conditions/condition.d.ts +1 -0
  38. package/dist/es/conditions/condition.js +1 -1
  39. package/dist/es/conditions/condition.js.map +1 -1
  40. package/dist/es/conditions/predefined/address-allowlist.d.ts +11 -0
  41. package/dist/es/conditions/predefined/address-allowlist.js +27 -0
  42. package/dist/es/conditions/predefined/address-allowlist.js.map +1 -0
  43. package/dist/es/conditions/predefined/index.d.ts +1 -0
  44. package/dist/es/conditions/predefined/index.js +1 -0
  45. package/dist/es/conditions/predefined/index.js.map +1 -1
  46. package/dist/es/conditions/schemas/address-allowlist.d.ts +3 -0
  47. package/dist/es/conditions/schemas/address-allowlist.js +8 -0
  48. package/dist/es/conditions/schemas/address-allowlist.js.map +1 -0
  49. package/dist/es/conditions/schemas/context-variable.d.ts +46 -0
  50. package/dist/es/conditions/schemas/contract.d.ts +54 -0
  51. package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +2 -0
  52. package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +3 -0
  53. package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
  54. package/dist/es/conditions/schemas/json-api.d.ts +54 -0
  55. package/dist/es/conditions/schemas/json-rpc.d.ts +54 -0
  56. package/dist/es/conditions/schemas/json.d.ts +46 -0
  57. package/dist/es/conditions/schemas/return-value-test.d.ts +76 -0
  58. package/dist/es/conditions/schemas/return-value-test.js +2 -0
  59. package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
  60. package/dist/es/conditions/schemas/rpc.d.ts +46 -0
  61. package/dist/es/conditions/schemas/sequential.js +6 -2
  62. package/dist/es/conditions/schemas/sequential.js.map +1 -1
  63. package/dist/es/conditions/schemas/time.d.ts +46 -0
  64. package/dist/es/conditions/schemas/utils.js +0 -2
  65. package/dist/es/conditions/schemas/utils.js.map +1 -1
  66. package/dist/es/conditions/schemas/variable-operation.d.ts +48 -0
  67. package/dist/es/conditions/schemas/variable-operation.js +78 -0
  68. package/dist/es/conditions/schemas/variable-operation.js.map +1 -0
  69. package/dist/es/sign.d.ts +2 -2
  70. package/dist/es/sign.js +74 -39
  71. package/dist/es/sign.js.map +1 -1
  72. package/dist/es/types.d.ts +1 -1
  73. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  74. package/dist/tsconfig.es.tsbuildinfo +1 -1
  75. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import { Domain, TacoSignature, UserOperation } from '@nucypher/shared';
1
+ import { Domain, PackedUserOperationToSign, TacoSignature, UserOperationToSign } from '@nucypher/shared';
2
2
  import { ethers } from 'ethers';
3
3
  import { Condition } from './conditions/condition';
4
4
  import { ConditionContext } from './conditions/context';
@@ -22,5 +22,5 @@ export type SignResult = {
22
22
  * @returns A promise that resolves to a SignResult containing the message hash, aggregated signature, and signing results from the Porter service.
23
23
  * @throws An error if the signing process fails due to insufficient signatures or mismatched hashes.
24
24
  */
25
- export declare function signUserOp(provider: ethers.providers.Provider, domain: Domain, cohortId: number, chainId: number, userOp: UserOperation, aaVersion: 'mdt' | '0.8.0' | string, context?: ConditionContext, porterUris?: string[]): Promise<SignResult>;
25
+ export declare function signUserOp(provider: ethers.providers.Provider, domain: Domain, cohortId: number, chainId: number, userOp: UserOperationToSign | PackedUserOperationToSign, aaVersion: 'mdt' | '0.8.0' | string, context?: ConditionContext, porterUris?: string[]): Promise<SignResult>;
26
26
  export declare function setSigningCohortConditions(provider: ethers.providers.JsonRpcProvider, domain: Domain, conditions: Condition, cohortId: number, chainId: number, signer: ethers.Signer): Promise<ethers.ContractTransaction>;
package/dist/cjs/sign.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.signUserOp = signUserOp;
4
4
  exports.setSigningCohortConditions = setSigningCohortConditions;
5
+ const nucypher_core_1 = require("@nucypher/nucypher-core");
5
6
  const shared_1 = require("@nucypher/shared");
6
7
  const ethers_1 = require("ethers");
7
8
  const condition_expr_1 = require("./conditions/condition-expr");
@@ -19,6 +20,30 @@ function aggregateSignatures(signaturesByAddress, threshold) {
19
20
  const allBytes = signatures.flatMap((hex) => Array.from((0, shared_1.fromHexString)(hex)));
20
21
  return `0x${(0, shared_1.toHexString)(new Uint8Array(allBytes))}`;
21
22
  }
23
+ async function makeSigningRequests(cohortId, chainId, signers, userOp, aaVersion, conditionContext) {
24
+ const coreContext = conditionContext
25
+ ? await conditionContext.toCoreContext()
26
+ : null;
27
+ let signingRequest;
28
+ if ((0, shared_1.isPackedUserOperation)(userOp)) {
29
+ const corePackedUserOp = (0, shared_1.toCorePackedUserOperation)(userOp);
30
+ signingRequest = new nucypher_core_1.PackedUserOperationSignatureRequest(corePackedUserOp, cohortId, BigInt(chainId), aaVersion, coreContext);
31
+ }
32
+ else {
33
+ const coreUserOp = (0, shared_1.toCoreUserOperation)(userOp);
34
+ signingRequest = new nucypher_core_1.UserOperationSignatureRequest(coreUserOp, cohortId, BigInt(chainId), aaVersion, coreContext);
35
+ }
36
+ const ephemeralSessionKey = nucypher_core_1.SessionStaticSecret.random();
37
+ const sharedSecrets = Object.fromEntries(signers.map(({ provider, signingRequestStaticKey }) => {
38
+ const sharedSecret = ephemeralSessionKey.deriveSharedSecret(signingRequestStaticKey);
39
+ return [provider, sharedSecret];
40
+ }));
41
+ const encryptedRequests = Object.fromEntries(Object.entries(sharedSecrets).map(([provider, sessionSharedSecret]) => {
42
+ const encryptedRequest = signingRequest.encrypt(sessionSharedSecret, ephemeralSessionKey.publicKey());
43
+ return [provider, encryptedRequest];
44
+ }));
45
+ return { sharedSecrets, encryptedRequests };
46
+ }
22
47
  /**
23
48
  * Signs a UserOperation.
24
49
  * @param provider - The Ethereum provider to use for signing.
@@ -39,17 +64,49 @@ async function signUserOp(provider, domain, cohortId, chainId, userOp, aaVersion
39
64
  const porter = new shared_1.PorterClient(porterUrisFull);
40
65
  const signers = await shared_1.SigningCoordinatorAgent.getParticipants(provider, domain, cohortId);
41
66
  const threshold = await shared_1.SigningCoordinatorAgent.getThreshold(provider, domain, cohortId);
42
- const pythonUserOp = (0, shared_1.convertUserOperationToPython)(userOp);
43
- const signingRequest = new shared_1.UserOperationSignatureRequest(pythonUserOp, aaVersion, cohortId, chainId, context || {}, 'userop');
44
- const signingRequests = Object.fromEntries(signers.map((signer) => [
45
- signer.provider,
46
- (0, shared_1.toBase64)(signingRequest.toBytes()),
47
- ]));
67
+ const { sharedSecrets, encryptedRequests } = await makeSigningRequests(cohortId, chainId, signers, userOp, aaVersion, context);
48
68
  // Build signing request for the user operation
49
- const porterSignResult = await porter.signUserOp(signingRequests, threshold);
69
+ const { encryptedResponses, errors } = await porter.signUserOp(encryptedRequests, threshold);
70
+ if (Object.keys(encryptedResponses).length < threshold) {
71
+ // not enough signatures returned
72
+ throw new Error(ERR_INSUFFICIENT_SIGNATURES(errors));
73
+ }
74
+ const signaturesToAggregate = collectSignatures(encryptedResponses, sharedSecrets, threshold);
75
+ const aggregatedSignature = aggregateSignatures(signaturesToAggregate, threshold);
76
+ return {
77
+ messageHash: Object.values(signaturesToAggregate)[0].messageHash,
78
+ aggregatedSignature,
79
+ signingResults: signaturesToAggregate,
80
+ };
81
+ }
82
+ async function setSigningCohortConditions(provider, domain, conditions, cohortId, chainId, signer) {
83
+ // Convert Condition to ConditionExpression, then to JSON, then to bytes
84
+ const conditionExpression = new condition_expr_1.ConditionExpression(conditions);
85
+ const conditionsJson = conditionExpression.toJson();
86
+ const conditionsBytes = ethers_1.ethers.utils.toUtf8Bytes(conditionsJson);
87
+ // Set conditions on the SigningCoordinator contract
88
+ return await shared_1.SigningCoordinatorAgent.setSigningCohortConditions(provider, domain, cohortId, chainId, conditionsBytes, signer);
89
+ }
90
+ function decryptSignatureResponses(encryptedResponses, sharedSecrets) {
91
+ const decryptedResponses = Object.fromEntries(Object.entries(encryptedResponses).map(([ursulaAddress, encryptedResponse]) => [
92
+ ursulaAddress,
93
+ encryptedResponse.decrypt(sharedSecrets[ursulaAddress]),
94
+ ]));
95
+ const tacoSignatures = Object.fromEntries(Object.entries(decryptedResponses).map(([ursulaAddress, signatureResponse]) => [
96
+ ursulaAddress,
97
+ {
98
+ messageHash: `0x${(0, shared_1.toHexString)(signatureResponse.hash)}`,
99
+ signature: `0x${(0, shared_1.toHexString)(signatureResponse.signature)}`,
100
+ signerAddress: signatureResponse.signer,
101
+ },
102
+ ]));
103
+ return tacoSignatures;
104
+ }
105
+ function collectSignatures(encryptedResponses, sharedSecrets, threshold) {
106
+ const decryptedSignatures = decryptSignatureResponses(encryptedResponses, sharedSecrets);
50
107
  const hashToSignatures = new Map();
51
108
  // Single pass: decode signatures and populate signingResults
52
- for (const [ursulaAddress, signature] of Object.entries(porterSignResult.signingResults)) {
109
+ for (const [ursulaAddress, signature] of Object.entries(decryptedSignatures)) {
53
110
  // For non-optimistic: track hashes and group signatures for aggregation
54
111
  const hash = signature.messageHash;
55
112
  if (!hashToSignatures.has(hash)) {
@@ -57,43 +114,21 @@ async function signUserOp(provider, domain, cohortId, chainId, userOp, aaVersion
57
114
  }
58
115
  hashToSignatures.get(hash)[ursulaAddress] = signature;
59
116
  }
60
- let messageHash = undefined;
117
+ // Find a hash that meets the threshold
61
118
  let signaturesToAggregate = undefined;
62
- for (const [hash, signatures] of hashToSignatures.entries()) {
119
+ for (const signatures of hashToSignatures.values()) {
63
120
  if (Object.keys(signatures).length >= threshold) {
64
121
  signaturesToAggregate = signatures;
65
- messageHash = hash;
66
122
  break;
67
123
  }
68
124
  }
69
125
  // Insufficient signatures for a message hash to meet the threshold
70
- if (!messageHash || !signaturesToAggregate) {
71
- if (hashToSignatures.size > 1 &&
72
- Object.keys(porterSignResult.errors).length < signers.length - threshold) {
73
- // Two things are true:
74
- // 1. we have multiple hashes, which means we have mismatched hashes from different nodes
75
- // we don't really expect this to happen (other than some malicious nodes)
76
- // 2. number of errors still could have allowed for a threshold of signatures
77
- console.error('Porter returned mismatched message hashes:', hashToSignatures);
78
- throw new Error(ERR_MISMATCHED_HASHES(hashToSignatures));
79
- }
80
- else {
81
- throw new Error(ERR_INSUFFICIENT_SIGNATURES(porterSignResult.errors));
82
- }
126
+ if (!signaturesToAggregate) {
127
+ //we have multiple hashes, which means we have mismatched hashes from different nodes
128
+ // we don't really expect this to happen (other than some malicious nodes)
129
+ console.error('Porter returned mismatched message hashes:', hashToSignatures);
130
+ throw new Error(ERR_MISMATCHED_HASHES(hashToSignatures));
83
131
  }
84
- const aggregatedSignature = aggregateSignatures(signaturesToAggregate, threshold);
85
- return {
86
- messageHash,
87
- aggregatedSignature,
88
- signingResults: porterSignResult.signingResults,
89
- };
90
- }
91
- async function setSigningCohortConditions(provider, domain, conditions, cohortId, chainId, signer) {
92
- // Convert Condition to ConditionExpression, then to JSON, then to bytes
93
- const conditionExpression = new condition_expr_1.ConditionExpression(conditions);
94
- const conditionsJson = conditionExpression.toJson();
95
- const conditionsBytes = ethers_1.ethers.utils.toUtf8Bytes(conditionsJson);
96
- // Set conditions on the SigningCoordinator contract
97
- return await shared_1.SigningCoordinatorAgent.setSigningCohortConditions(provider, domain, cohortId, chainId, conditionsBytes, signer);
132
+ return signaturesToAggregate;
98
133
  }
99
134
  //# sourceMappingURL=sign.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":";;AAoEA,gCA4GC;AAED,gEAsBC;AAxMD,6CAa0B;AAC1B,mCAAgC;AAGhC,gEAAkE;AAGlE,MAAM,2BAA2B,GAAG,CAAC,MAAe,EAAE,EAAE,CACtD,qEAAqE,IAAI,CA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AAC,KAAK,CACX,4CAA4C,EAC5C,gBAAgB,CACjB,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC"}
@@ -1,2 +1,2 @@
1
1
  export { Conditions as CoreConditions, Context as CoreContext, } from '@nucypher/nucypher-core';
2
- export type { UserOperation } from '@nucypher/shared';
2
+ export { UserOperationToSign } from '@nucypher/shared';
@@ -2,6 +2,7 @@ import { z } from 'zod';
2
2
  export { baseConditionSchema } from './schemas/common';
3
3
  type ConditionSchema = z.ZodSchema;
4
4
  export type ConditionProps = z.infer<ConditionSchema>;
5
+ export declare const ERR_INVALID_CONDITION: (error: z.ZodError) => string;
5
6
  export declare class Condition {
6
7
  readonly schema: ConditionSchema;
7
8
  readonly value: ConditionProps;
@@ -2,7 +2,7 @@ import { objectEquals } from '@nucypher/shared';
2
2
  import { toJSON } from '../utils';
3
3
  import { USER_ADDRESS_PARAMS } from './const';
4
4
  export { baseConditionSchema } from './schemas/common';
5
- const ERR_INVALID_CONDITION = (error) => `Invalid condition: ${JSON.stringify(error.issues)}`;
5
+ export const ERR_INVALID_CONDITION = (error) => `Invalid condition: ${JSON.stringify(error.issues)}`;
6
6
  export class Condition {
7
7
  schema;
8
8
  value;
@@ -1 +1 @@
1
- {"version":3,"file":"condition.js","sourceRoot":"","sources":["../../../src/conditions/condition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAKvD,MAAM,qBAAqB,GAAG,CAAC,KAAiB,EAAE,EAAE,CAClD,sBAAsB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CA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AM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QAC/B,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACjC,CAAC;IAED,8CAA8C;IACvC,2BAA2B;QAChC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtC,KAAK,MAAM,KAAK,IAAI,mBAAmB,EAAE,CAAC;YACxC,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,sBAAsB;QAC3B,OAAO,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK;QACV,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACpE,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,MAAM,CAAC,KAAgB;QAC5B,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { ContextVariableCondition } from '../base/context-variable';
2
+ import { AddressAllowlistConditionProps } from '../schemas/address-allowlist';
3
+ export { AddressAllowlistConditionProps } from '../schemas/address-allowlist';
4
+ /**
5
+ * A Client-side condition that checks if a user's address is in an allowlist and transforms the object into `ContextVariableCondition`.
6
+ * The nodes process this as a standard context variable that checks if the user's address is in the allowlist.
7
+ * @remark This condition doesn’t have a unique type of its own; it is simply a wrapper for creating a `ContextVariableCondition`.
8
+ */
9
+ export declare class AddressAllowlistCondition extends ContextVariableCondition {
10
+ constructor(value: AddressAllowlistConditionProps);
11
+ }
@@ -0,0 +1,27 @@
1
+ import { USER_ADDRESS_PARAM_DEFAULT } from '@nucypher/taco-auth';
2
+ import { ContextVariableCondition, ContextVariableConditionType, } from '../base/context-variable';
3
+ import { ERR_INVALID_CONDITION } from '../condition';
4
+ import { addressAllowlistConditionSchema, } from '../schemas/address-allowlist';
5
+ /**
6
+ * A Client-side condition that checks if a user's address is in an allowlist and transforms the object into `ContextVariableCondition`.
7
+ * The nodes process this as a standard context variable that checks if the user's address is in the allowlist.
8
+ * @remark This condition doesn’t have a unique type of its own; it is simply a wrapper for creating a `ContextVariableCondition`.
9
+ */
10
+ export class AddressAllowlistCondition extends ContextVariableCondition {
11
+ constructor(value) {
12
+ const { data, error } = AddressAllowlistCondition.validate(addressAllowlistConditionSchema, value);
13
+ if (error) {
14
+ throw new Error(ERR_INVALID_CONDITION(error));
15
+ }
16
+ const contextVariableConditionProps = {
17
+ conditionType: ContextVariableConditionType,
18
+ contextVariable: USER_ADDRESS_PARAM_DEFAULT,
19
+ returnValueTest: {
20
+ comparator: 'in',
21
+ value: data,
22
+ },
23
+ };
24
+ super(contextVariableConditionProps);
25
+ }
26
+ }
27
+ //# sourceMappingURL=address-allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/address-allowlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EACL,wBAAwB,EAExB,4BAA4B,GAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAEL,+BAA+B,GAChC,MAAM,8BAA8B,CAAC;AAItC;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,wBAAwB;IACrE,YAAY,KAAqC;QAC/C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,yBAAyB,CAAC,QAAQ,CACxD,+BAA+B,EAC/B,KAAK,CACN,CAAC;QACF,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,6BAA6B,GAAkC;YACnE,aAAa,EAAE,4BAA4B;YAC3C,eAAe,EAAE,0BAA0B;YAC3C,eAAe,EAAE;gBACf,UAAU,EAAE,IAAI;gBAChB,KAAK,EAAE,IAAI;aACZ;SACF,CAAC;QAEF,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -1,2 +1,3 @@
1
+ export * as addressAllowlist from './address-allowlist';
1
2
  export * as erc20 from './erc20';
2
3
  export * as erc721 from './erc721';
@@ -1,3 +1,4 @@
1
+ export * as addressAllowlist from './address-allowlist';
1
2
  export * as erc20 from './erc20';
2
3
  export * as erc721 from './erc721';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const addressAllowlistConditionSchema: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
3
+ export type AddressAllowlistConditionProps = z.infer<typeof addressAllowlistConditionSchema>;
@@ -0,0 +1,8 @@
1
+ import { EthAddressSchemaStrict } from '@nucypher/shared';
2
+ import { z } from 'zod';
3
+ export const addressAllowlistConditionSchema = z
4
+ .array(EthAddressSchemaStrict)
5
+ .min(1, 'At least one address must be provided')
6
+ .max(25, 'A maximum of 25 addresses is allowed')
7
+ .describe('List of allowed wallet addresses. Addresses should be provided in checksummed form.');
8
+ //# sourceMappingURL=address-allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/address-allowlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,KAAK,CAAC,sBAAsB,CAAC;KAC7B,GAAG,CAAC,CAAC,EAAE,uCAAuC,CAAC;KAC/C,GAAG,CAAC,EAAE,EAAE,sCAAsC,CAAC;KAC/C,QAAQ,CACP,qFAAqF,CACtF,CAAC"}
@@ -6,24 +6,62 @@ export declare const contextVariableConditionSchema: z.ZodObject<{} & {
6
6
  returnValueTest: z.ZodEffects<z.ZodObject<{
7
7
  index: z.ZodOptional<z.ZodNumber>;
8
8
  comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
9
+ operations: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodObject<{
10
+ operation: z.ZodEnum<["+=", "-=", "*=", "/=", "%=", "index", "round", "abs", "avg", "ceil", "ethToWei", "floor", "len", "max", "min", "sum", "weiToEth", "bool", "float", "int", "str"]>;
11
+ value: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
14
+ value?: any;
15
+ }, {
16
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
17
+ value?: any;
18
+ }>, {
19
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
20
+ value?: any;
21
+ }, {
22
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
23
+ value?: any;
24
+ }>, {
25
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
26
+ value?: any;
27
+ }, {
28
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
29
+ value?: any;
30
+ }>, "many">>;
9
31
  } & {
10
32
  value: z.ZodType<any, z.ZodTypeDef, any>;
11
33
  }, "strip", z.ZodTypeAny, {
12
34
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
13
35
  value?: any;
14
36
  index?: number | undefined;
37
+ operations?: {
38
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
39
+ value?: any;
40
+ }[] | undefined;
15
41
  }, {
16
42
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
17
43
  value?: any;
18
44
  index?: number | undefined;
45
+ operations?: {
46
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
47
+ value?: any;
48
+ }[] | undefined;
19
49
  }>, {
20
50
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
21
51
  value?: any;
22
52
  index?: number | undefined;
53
+ operations?: {
54
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
55
+ value?: any;
56
+ }[] | undefined;
23
57
  }, {
24
58
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
25
59
  value?: any;
26
60
  index?: number | undefined;
61
+ operations?: {
62
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
63
+ value?: any;
64
+ }[] | undefined;
27
65
  }>;
28
66
  }, "strict", z.ZodTypeAny, {
29
67
  conditionType: "context-variable";
@@ -32,6 +70,10 @@ export declare const contextVariableConditionSchema: z.ZodObject<{} & {
32
70
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
33
71
  value?: any;
34
72
  index?: number | undefined;
73
+ operations?: {
74
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
75
+ value?: any;
76
+ }[] | undefined;
35
77
  };
36
78
  }, {
37
79
  conditionType: "context-variable";
@@ -40,6 +82,10 @@ export declare const contextVariableConditionSchema: z.ZodObject<{} & {
40
82
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
41
83
  value?: any;
42
84
  index?: number | undefined;
85
+ operations?: {
86
+ operation: "float" | "+=" | "-=" | "*=" | "/=" | "%=" | "index" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
87
+ value?: any;
88
+ }[] | undefined;
43
89
  };
44
90
  }>;
45
91
  export type ContextVariableConditionProps = z.infer<typeof contextVariableConditionSchema>;
@@ -158,24 +158,62 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
158
158
  returnValueTest: z.ZodEffects<z.ZodObject<{
159
159
  index: z.ZodOptional<z.ZodNumber>;
160
160
  comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
161
+ operations: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodEffects<z.ZodObject<{
162
+ operation: z.ZodEnum<["+=", "-=", "*=", "/=", "%=", "index", "round", "abs", "avg", "ceil", "ethToWei", "floor", "len", "max", "min", "sum", "weiToEth", "bool", "float", "int", "str"]>;
163
+ value: z.ZodOptional<z.ZodType<any, z.ZodTypeDef, any>>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
166
+ value?: any;
167
+ }, {
168
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
169
+ value?: any;
170
+ }>, {
171
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
172
+ value?: any;
173
+ }, {
174
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
175
+ value?: any;
176
+ }>, {
177
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
178
+ value?: any;
179
+ }, {
180
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
181
+ value?: any;
182
+ }>, "many">>;
161
183
  } & {
162
184
  value: z.ZodType<any, z.ZodTypeDef, any>;
163
185
  }, "strip", z.ZodTypeAny, {
164
186
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
165
187
  value?: any;
166
188
  index?: number | undefined;
189
+ operations?: {
190
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
191
+ value?: any;
192
+ }[] | undefined;
167
193
  }, {
168
194
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
169
195
  value?: any;
170
196
  index?: number | undefined;
197
+ operations?: {
198
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
199
+ value?: any;
200
+ }[] | undefined;
171
201
  }>, {
172
202
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
173
203
  value?: any;
174
204
  index?: number | undefined;
205
+ operations?: {
206
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
207
+ value?: any;
208
+ }[] | undefined;
175
209
  }, {
176
210
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
177
211
  value?: any;
178
212
  index?: number | undefined;
213
+ operations?: {
214
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
215
+ value?: any;
216
+ }[] | undefined;
179
217
  }>;
180
218
  } & {
181
219
  conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
@@ -328,6 +366,10 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
328
366
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
329
367
  value?: any;
330
368
  index?: number | undefined;
369
+ operations?: {
370
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
371
+ value?: any;
372
+ }[] | undefined;
331
373
  };
332
374
  chain: number;
333
375
  method: string;
@@ -358,6 +400,10 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
358
400
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
359
401
  value?: any;
360
402
  index?: number | undefined;
403
+ operations?: {
404
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
405
+ value?: any;
406
+ }[] | undefined;
361
407
  };
362
408
  chain: number;
363
409
  method: string;
@@ -390,6 +436,10 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
390
436
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
391
437
  value?: any;
392
438
  index?: number | undefined;
439
+ operations?: {
440
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
441
+ value?: any;
442
+ }[] | undefined;
393
443
  };
394
444
  chain: number;
395
445
  method: string;
@@ -420,6 +470,10 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
420
470
  comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
421
471
  value?: any;
422
472
  index?: number | undefined;
473
+ operations?: {
474
+ operation: "float" | "index" | "+=" | "-=" | "*=" | "/=" | "%=" | "round" | "abs" | "avg" | "ceil" | "ethToWei" | "floor" | "len" | "max" | "min" | "sum" | "weiToEth" | "bool" | "int" | "str";
475
+ value?: any;
476
+ }[] | undefined;
423
477
  };
424
478
  chain: number;
425
479
  method: string;
@@ -20,3 +20,5 @@ export * from './rpc';
20
20
  export * from './sequential';
21
21
  export * from './signing';
22
22
  export * from './time';
23
+ export * from './variable-operation';
24
+ export * from './address-allowlist';
@@ -22,4 +22,7 @@ export * from './rpc';
22
22
  export * from './sequential';
23
23
  export * from './signing';
24
24
  export * from './time';
25
+ export * from './variable-operation';
26
+ // ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
27
+ export * from './address-allowlist';
25
28
  //# sourceMappingURL=export-for-zod-doc-gen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"export-for-zod-doc-gen.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/export-for-zod-doc-gen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,gIAAgI;AAChI,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,gIAAgI;AAChI,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"export-for-zod-doc-gen.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/export-for-zod-doc-gen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,gIAAgI;AAChI,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,gIAAgI;AAChI,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,sBAAsB,CAAC;AACrC,gIAAgI;AAChI,cAAc,qBAAqB,CAAC"}