@nucypher/taco 0.7.0-alpha.3 → 0.7.0-alpha.5
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/dist/cjs/conditions/condition.d.ts +1 -0
- package/dist/cjs/conditions/condition.js +4 -3
- package/dist/cjs/conditions/condition.js.map +1 -1
- package/dist/cjs/conditions/predefined/address-allowlist.d.ts +11 -0
- package/dist/cjs/conditions/predefined/address-allowlist.js +31 -0
- package/dist/cjs/conditions/predefined/address-allowlist.js.map +1 -0
- package/dist/cjs/conditions/predefined/index.d.ts +1 -0
- package/dist/cjs/conditions/predefined/index.js +2 -1
- package/dist/cjs/conditions/predefined/index.js.map +1 -1
- package/dist/cjs/conditions/schemas/address-allowlist.d.ts +3 -0
- package/dist/cjs/conditions/schemas/address-allowlist.js +11 -0
- package/dist/cjs/conditions/schemas/address-allowlist.js.map +1 -0
- package/dist/cjs/conditions/schemas/context-variable.d.ts +46 -0
- package/dist/cjs/conditions/schemas/contract.d.ts +54 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +2 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +3 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
- package/dist/cjs/conditions/schemas/json-api.d.ts +54 -0
- package/dist/cjs/conditions/schemas/json-rpc.d.ts +54 -0
- package/dist/cjs/conditions/schemas/json.d.ts +46 -0
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +76 -0
- package/dist/cjs/conditions/schemas/return-value-test.js +2 -0
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/cjs/conditions/schemas/rpc.d.ts +46 -0
- package/dist/cjs/conditions/schemas/sequential.js +6 -2
- package/dist/cjs/conditions/schemas/sequential.js.map +1 -1
- package/dist/cjs/conditions/schemas/time.d.ts +46 -0
- package/dist/cjs/conditions/schemas/utils.js +0 -2
- package/dist/cjs/conditions/schemas/utils.js.map +1 -1
- package/dist/cjs/conditions/schemas/variable-operation.d.ts +48 -0
- package/dist/cjs/conditions/schemas/variable-operation.js +81 -0
- package/dist/cjs/conditions/schemas/variable-operation.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sign.d.ts +7 -2
- package/dist/cjs/sign.js +86 -46
- package/dist/cjs/sign.js.map +1 -1
- package/dist/cjs/types.d.ts +1 -1
- package/dist/es/conditions/condition.d.ts +1 -0
- package/dist/es/conditions/condition.js +1 -1
- package/dist/es/conditions/condition.js.map +1 -1
- package/dist/es/conditions/predefined/address-allowlist.d.ts +11 -0
- package/dist/es/conditions/predefined/address-allowlist.js +27 -0
- package/dist/es/conditions/predefined/address-allowlist.js.map +1 -0
- package/dist/es/conditions/predefined/index.d.ts +1 -0
- package/dist/es/conditions/predefined/index.js +1 -0
- package/dist/es/conditions/predefined/index.js.map +1 -1
- package/dist/es/conditions/schemas/address-allowlist.d.ts +3 -0
- package/dist/es/conditions/schemas/address-allowlist.js +8 -0
- package/dist/es/conditions/schemas/address-allowlist.js.map +1 -0
- package/dist/es/conditions/schemas/context-variable.d.ts +46 -0
- package/dist/es/conditions/schemas/contract.d.ts +54 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +2 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +3 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
- package/dist/es/conditions/schemas/json-api.d.ts +54 -0
- package/dist/es/conditions/schemas/json-rpc.d.ts +54 -0
- package/dist/es/conditions/schemas/json.d.ts +46 -0
- package/dist/es/conditions/schemas/return-value-test.d.ts +76 -0
- package/dist/es/conditions/schemas/return-value-test.js +2 -0
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/es/conditions/schemas/rpc.d.ts +46 -0
- package/dist/es/conditions/schemas/sequential.js +6 -2
- package/dist/es/conditions/schemas/sequential.js.map +1 -1
- package/dist/es/conditions/schemas/time.d.ts +46 -0
- package/dist/es/conditions/schemas/utils.js +0 -2
- package/dist/es/conditions/schemas/utils.js.map +1 -1
- package/dist/es/conditions/schemas/variable-operation.d.ts +48 -0
- package/dist/es/conditions/schemas/variable-operation.js +78 -0
- package/dist/es/conditions/schemas/variable-operation.js.map +1 -0
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.js +1 -1
- package/dist/es/index.js.map +1 -1
- package/dist/es/sign.d.ts +7 -2
- package/dist/es/sign.js +87 -47
- package/dist/es/sign.js.map +1 -1
- package/dist/es/types.d.ts +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
-
export { Domain, domains, fromBytes, getPorterUris, initialize, toBytes, toHexString, } from '@nucypher/shared';
|
|
2
|
+
export { Domain, PackedUserOperationToSign, UserOperationToSign, domains, fromBytes, getPorterUris, initialize, toBytes, toHexString, } from '@nucypher/shared';
|
|
3
3
|
export * as conditions from './conditions';
|
|
4
|
-
export { setSigningCohortConditions, signUserOp } from './sign';
|
|
4
|
+
export { SignResult, TacoSignature, setSigningCohortConditions, signUserOp, } from './sign';
|
|
5
5
|
export { decrypt, encrypt, encryptWithPublicKey } from './taco';
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA4E;AAAnE,6GAAA,YAAY,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC1C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA4E;AAAnE,6GAAA,YAAY,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC1C,2CAU0B;AANxB,iGAAA,OAAO,OAAA;AACP,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AACb,oGAAA,UAAU,OAAA;AACV,iGAAA,OAAO,OAAA;AACP,qGAAA,WAAW,OAAA;AAGb,2DAA2C;AAE3C,+BAKgB;AAFd,kHAAA,0BAA0B,OAAA;AAC1B,kGAAA,UAAU,OAAA;AAEZ,+BAAgE;AAAvD,+FAAA,OAAO,OAAA;AAAE,+FAAA,OAAO,OAAA;AAAE,4GAAA,oBAAoB,OAAA"}
|
package/dist/cjs/sign.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { Domain,
|
|
1
|
+
import { Domain, PackedUserOperationToSign, UserOperationToSign } from '@nucypher/shared';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
3
|
import { Condition } from './conditions/condition';
|
|
4
4
|
import { ConditionContext } from './conditions/context';
|
|
5
|
+
export type TacoSignature = {
|
|
6
|
+
messageHash: string;
|
|
7
|
+
signature: string;
|
|
8
|
+
signerAddress: string;
|
|
9
|
+
};
|
|
5
10
|
export type SignResult = {
|
|
6
11
|
messageHash: string;
|
|
7
12
|
aggregatedSignature: string;
|
|
@@ -22,5 +27,5 @@ export type SignResult = {
|
|
|
22
27
|
* @returns A promise that resolves to a SignResult containing the message hash, aggregated signature, and signing results from the Porter service.
|
|
23
28
|
* @throws An error if the signing process fails due to insufficient signatures or mismatched hashes.
|
|
24
29
|
*/
|
|
25
|
-
export declare function signUserOp(provider: ethers.providers.Provider, domain: Domain, cohortId: number, chainId: number, userOp:
|
|
30
|
+
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
31
|
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,23 +2,53 @@
|
|
|
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");
|
|
8
9
|
const ERR_INSUFFICIENT_SIGNATURES = (errors) => `Threshold of signatures not met; TACo signing failed with errors: ${JSON.stringify(errors)}`;
|
|
9
10
|
const ERR_MISMATCHED_HASHES = (hashToSignatures) => `Threshold of signatures not met; multiple mismatched hashes found: ${JSON.stringify(Object.fromEntries(hashToSignatures.entries()))}`;
|
|
10
|
-
function aggregateSignatures(
|
|
11
|
-
// Aggregate hex signatures by concatenating them; being careful to
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
function aggregateSignatures(signatures, threshold) {
|
|
12
|
+
// Aggregate hex signatures by concatenating them; being careful to sort
|
|
13
|
+
// and remove the '0x' prefix from each signature except the first one.
|
|
14
|
+
// sort by signer address
|
|
15
|
+
const sortedSignatures = [...signatures]
|
|
16
|
+
.sort((a, b) => a.signerAddress
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
.localeCompare(b.signerAddress.toLowerCase()))
|
|
19
|
+
.map((sig) => sig.signature);
|
|
20
|
+
const thresholdSignatures = sortedSignatures.slice(0, threshold);
|
|
21
|
+
if (thresholdSignatures.length === 1) {
|
|
22
|
+
return thresholdSignatures[0];
|
|
17
23
|
}
|
|
18
24
|
// Concatenate signatures
|
|
19
|
-
const allBytes =
|
|
25
|
+
const allBytes = thresholdSignatures.flatMap((sig) => Array.from((0, shared_1.fromHexString)(sig)));
|
|
20
26
|
return `0x${(0, shared_1.toHexString)(new Uint8Array(allBytes))}`;
|
|
21
27
|
}
|
|
28
|
+
async function makeSigningRequests(cohortId, chainId, signers, userOp, aaVersion, conditionContext) {
|
|
29
|
+
const coreContext = conditionContext
|
|
30
|
+
? await conditionContext.toCoreContext()
|
|
31
|
+
: null;
|
|
32
|
+
let signingRequest;
|
|
33
|
+
if ((0, shared_1.isPackedUserOperation)(userOp)) {
|
|
34
|
+
const corePackedUserOp = (0, shared_1.toCorePackedUserOperation)(userOp);
|
|
35
|
+
signingRequest = new nucypher_core_1.PackedUserOperationSignatureRequest(corePackedUserOp, cohortId, BigInt(chainId), aaVersion, coreContext);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
const coreUserOp = (0, shared_1.toCoreUserOperation)(userOp);
|
|
39
|
+
signingRequest = new nucypher_core_1.UserOperationSignatureRequest(coreUserOp, cohortId, BigInt(chainId), aaVersion, coreContext);
|
|
40
|
+
}
|
|
41
|
+
const ephemeralSessionKey = nucypher_core_1.SessionStaticSecret.random();
|
|
42
|
+
const sharedSecrets = Object.fromEntries(signers.map(({ provider, signingRequestStaticKey }) => {
|
|
43
|
+
const sharedSecret = ephemeralSessionKey.deriveSharedSecret(signingRequestStaticKey);
|
|
44
|
+
return [provider, sharedSecret];
|
|
45
|
+
}));
|
|
46
|
+
const encryptedRequests = Object.fromEntries(Object.entries(sharedSecrets).map(([provider, sessionSharedSecret]) => {
|
|
47
|
+
const encryptedRequest = signingRequest.encrypt(sessionSharedSecret, ephemeralSessionKey.publicKey());
|
|
48
|
+
return [provider, encryptedRequest];
|
|
49
|
+
}));
|
|
50
|
+
return { sharedSecrets, encryptedRequests };
|
|
51
|
+
}
|
|
22
52
|
/**
|
|
23
53
|
* Signs a UserOperation.
|
|
24
54
|
* @param provider - The Ethereum provider to use for signing.
|
|
@@ -39,17 +69,49 @@ async function signUserOp(provider, domain, cohortId, chainId, userOp, aaVersion
|
|
|
39
69
|
const porter = new shared_1.PorterClient(porterUrisFull);
|
|
40
70
|
const signers = await shared_1.SigningCoordinatorAgent.getParticipants(provider, domain, cohortId);
|
|
41
71
|
const threshold = await shared_1.SigningCoordinatorAgent.getThreshold(provider, domain, cohortId);
|
|
42
|
-
const
|
|
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
|
-
]));
|
|
72
|
+
const { sharedSecrets, encryptedRequests } = await makeSigningRequests(cohortId, chainId, signers, userOp, aaVersion, context);
|
|
48
73
|
// Build signing request for the user operation
|
|
49
|
-
const
|
|
74
|
+
const { encryptedResponses, errors } = await porter.signUserOp(encryptedRequests, threshold);
|
|
75
|
+
if (Object.keys(encryptedResponses).length < threshold) {
|
|
76
|
+
// not enough signatures returned
|
|
77
|
+
throw new Error(ERR_INSUFFICIENT_SIGNATURES(errors));
|
|
78
|
+
}
|
|
79
|
+
const signaturesToAggregate = collectSignatures(encryptedResponses, sharedSecrets, threshold);
|
|
80
|
+
const aggregatedSignature = aggregateSignatures(Object.values(signaturesToAggregate), threshold);
|
|
81
|
+
return {
|
|
82
|
+
messageHash: Object.values(signaturesToAggregate)[0].messageHash,
|
|
83
|
+
aggregatedSignature,
|
|
84
|
+
signingResults: signaturesToAggregate,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async function setSigningCohortConditions(provider, domain, conditions, cohortId, chainId, signer) {
|
|
88
|
+
// Convert Condition to ConditionExpression, then to JSON, then to bytes
|
|
89
|
+
const conditionExpression = new condition_expr_1.ConditionExpression(conditions);
|
|
90
|
+
const conditionsJson = conditionExpression.toJson();
|
|
91
|
+
const conditionsBytes = ethers_1.ethers.utils.toUtf8Bytes(conditionsJson);
|
|
92
|
+
// Set conditions on the SigningCoordinator contract
|
|
93
|
+
return await shared_1.SigningCoordinatorAgent.setSigningCohortConditions(provider, domain, cohortId, chainId, conditionsBytes, signer);
|
|
94
|
+
}
|
|
95
|
+
function decryptSignatureResponses(encryptedResponses, sharedSecrets) {
|
|
96
|
+
const decryptedResponses = Object.fromEntries(Object.entries(encryptedResponses).map(([ursulaAddress, encryptedResponse]) => [
|
|
97
|
+
ursulaAddress,
|
|
98
|
+
encryptedResponse.decrypt(sharedSecrets[ursulaAddress]),
|
|
99
|
+
]));
|
|
100
|
+
const tacoSignatures = Object.fromEntries(Object.entries(decryptedResponses).map(([ursulaAddress, signatureResponse]) => [
|
|
101
|
+
ursulaAddress,
|
|
102
|
+
{
|
|
103
|
+
messageHash: `0x${(0, shared_1.toHexString)(signatureResponse.hash)}`,
|
|
104
|
+
signature: `0x${(0, shared_1.toHexString)(signatureResponse.signature)}`,
|
|
105
|
+
signerAddress: signatureResponse.signer,
|
|
106
|
+
},
|
|
107
|
+
]));
|
|
108
|
+
return tacoSignatures;
|
|
109
|
+
}
|
|
110
|
+
function collectSignatures(encryptedResponses, sharedSecrets, threshold) {
|
|
111
|
+
const decryptedSignatures = decryptSignatureResponses(encryptedResponses, sharedSecrets);
|
|
50
112
|
const hashToSignatures = new Map();
|
|
51
113
|
// Single pass: decode signatures and populate signingResults
|
|
52
|
-
for (const [ursulaAddress, signature] of Object.entries(
|
|
114
|
+
for (const [ursulaAddress, signature] of Object.entries(decryptedSignatures)) {
|
|
53
115
|
// For non-optimistic: track hashes and group signatures for aggregation
|
|
54
116
|
const hash = signature.messageHash;
|
|
55
117
|
if (!hashToSignatures.has(hash)) {
|
|
@@ -57,43 +119,21 @@ async function signUserOp(provider, domain, cohortId, chainId, userOp, aaVersion
|
|
|
57
119
|
}
|
|
58
120
|
hashToSignatures.get(hash)[ursulaAddress] = signature;
|
|
59
121
|
}
|
|
60
|
-
|
|
122
|
+
// Find a hash that meets the threshold
|
|
61
123
|
let signaturesToAggregate = undefined;
|
|
62
|
-
for (const
|
|
124
|
+
for (const signatures of hashToSignatures.values()) {
|
|
63
125
|
if (Object.keys(signatures).length >= threshold) {
|
|
64
126
|
signaturesToAggregate = signatures;
|
|
65
|
-
messageHash = hash;
|
|
66
127
|
break;
|
|
67
128
|
}
|
|
68
129
|
}
|
|
69
130
|
// Insufficient signatures for a message hash to meet the threshold
|
|
70
|
-
if (!
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
-
}
|
|
131
|
+
if (!signaturesToAggregate) {
|
|
132
|
+
// we have multiple hashes, which means we have mismatched hashes from different nodes
|
|
133
|
+
// we don't really expect this to happen (other than some malicious nodes)
|
|
134
|
+
console.error('Porter returned mismatched message hashes:', hashToSignatures);
|
|
135
|
+
throw new Error(ERR_MISMATCHED_HASHES(hashToSignatures));
|
|
83
136
|
}
|
|
84
|
-
|
|
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);
|
|
137
|
+
return signaturesToAggregate;
|
|
98
138
|
}
|
|
99
139
|
//# sourceMappingURL=sign.js.map
|
package/dist/cjs/sign.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":";;AA4JA,gCA8DC;AAED,gEAsBC;AAlPD,2DAQiC;AACjC,6CAa0B;AAC1B,mCAAgC;AAGhC,gEAAkE;AAGlE,MAAM,2BAA2B,GAAG,CAAC,MAAe,EAAE,EAAE,CACtD,qEAAqE,IAAI,CAAC,SAAS,CACjF,MAAM,CACP,EAAE,CAAC;AACN,MAAM,qBAAqB,GAAG,CAC5B,gBAAyE,EACzE,EAAE,CACF,sEAAsE,IAAI,CAAC,SAAS,CAClF,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAC/C,EAAE,CAAC;AAcN,SAAS,mBAAmB,CAC1B,UAA2B,EAC3B,SAAiB;IAEjB,wEAAwE;IACxE,wEAAwE;IAExE,yBAAyB;IACzB,MAAM,gBAAgB,GAAG,CAAC,GAAG,UAAU,CAAC;SACrC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,aAAa;SACZ,WAAW,EAAE;SACb,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC,CAChD;SACA,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAE/B,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACjE,IAAI,mBAAmB,CAAC,MAAM,KAAK,C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CAAuC;IACvC,IAAI,qBAAqB,GAAG,SAAS,CAAC;IACtC,KAAK,MAAM,UAAU,IAAI,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC;QACnD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;YAChD,qBAAqB,GAAG,UAAU,CAAC;YACnC,MAAM;QACR,CAAC;IACH,CAAC;IAED,mEAAmE;IACnE,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC3B,sFAAsF;QACtF,6EAA6E;QAC7E,OAAO,CAAC,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"}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Conditions as CoreConditions, Context as CoreContext, } from '@nucypher/nucypher-core';
|
|
2
|
-
export
|
|
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,
|
|
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,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAiB,EAAE,EAAE,CACzD,sBAAsB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;AAEvD,MAAM,OAAO,SAAS;IAEF;IACA;IAFlB,YACkB,MAAuB,EACvB,KAAqB;QADrB,WAAM,GAAN,MAAM,CAAiB;QACvB,UAAK,GAAL,KAAK,CAAgB;QAErC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1D,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;QAC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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 +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,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;
|
|
@@ -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"}
|