@crediolabs/policy-synth 1.0.0 → 1.1.0

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 (35) hide show
  1. package/dist/install/build-add-context-rule.js +48 -16
  2. package/dist/install/build-install-policy.d.ts +21 -0
  3. package/dist/install/build-install-policy.js +41 -3
  4. package/dist/predicate/encode.d.ts +12 -0
  5. package/dist/predicate/encode.js +5 -1
  6. package/dist/run/index.d.ts +14 -5
  7. package/dist/run/index.js +263 -14
  8. package/dist/run/schemas.d.ts +2277 -474
  9. package/dist/run/schemas.js +173 -14
  10. package/dist/synth/lower.d.ts +6 -2
  11. package/dist/synth/lower.js +21 -8
  12. package/dist/synth/synthesize-from-recording.js +1 -1
  13. package/dist/types.d.ts +18 -1
  14. package/dist-cjs/install/build-add-context-rule.js +48 -16
  15. package/dist-cjs/install/build-install-policy.d.ts +21 -0
  16. package/dist-cjs/install/build-install-policy.js +42 -3
  17. package/dist-cjs/predicate/encode.d.ts +12 -0
  18. package/dist-cjs/predicate/encode.js +5 -0
  19. package/dist-cjs/run/index.d.ts +14 -5
  20. package/dist-cjs/run/index.js +263 -13
  21. package/dist-cjs/run/schemas.d.ts +2277 -474
  22. package/dist-cjs/run/schemas.js +174 -15
  23. package/dist-cjs/synth/lower.d.ts +6 -2
  24. package/dist-cjs/synth/lower.js +21 -8
  25. package/dist-cjs/synth/synthesize-from-recording.js +1 -1
  26. package/dist-cjs/types.d.ts +18 -1
  27. package/package.json +1 -1
  28. package/src/install/build-add-context-rule.ts +65 -21
  29. package/src/install/build-install-policy.ts +65 -10
  30. package/src/predicate/encode.ts +5 -1
  31. package/src/run/index.ts +280 -23
  32. package/src/run/schemas.ts +201 -31
  33. package/src/synth/lower.ts +22 -8
  34. package/src/synth/synthesize-from-recording.ts +1 -1
  35. package/src/types.ts +25 -6
@@ -409,9 +409,9 @@ export declare const InterpreterOptionsSchema: z.ZodObject<{
409
409
  smartAccountAddress: string;
410
410
  installNonce?: number | undefined;
411
411
  }>;
412
- export declare const SynthesizePolicyInputSchema: z.ZodObject<{
412
+ export declare const SynthesizePolicyInputSchema: z.ZodEffects<z.ZodObject<{
413
413
  source: z.ZodLiteral<"recording">;
414
- recordedTx: z.ZodObject<{
414
+ recordedTx: z.ZodOptional<z.ZodObject<{
415
415
  network: z.ZodEnum<["mainnet", "testnet"]>;
416
416
  signers: z.ZodArray<z.ZodString, "many">;
417
417
  invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
@@ -669,7 +669,8 @@ export declare const SynthesizePolicyInputSchema: z.ZodObject<{
669
669
  thresholdUsed: number;
670
670
  }>;
671
671
  sourceAccount: z.ZodString;
672
- }, z.ZodTypeAny, "passthrough">>;
672
+ }, z.ZodTypeAny, "passthrough">>>;
673
+ transactionHash: z.ZodOptional<z.ZodString>;
673
674
  network: z.ZodEnum<["mainnet", "testnet"]>;
674
675
  userResponses: z.ZodOptional<z.ZodObject<{
675
676
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
@@ -705,41 +706,6 @@ export declare const SynthesizePolicyInputSchema: z.ZodObject<{
705
706
  }, "strip", z.ZodTypeAny, {
706
707
  network: "mainnet" | "testnet";
707
708
  source: "recording";
708
- recordedTx: {
709
- signers: string[];
710
- events: {
711
- contract: string;
712
- topics: string[];
713
- data?: unknown;
714
- }[];
715
- sourceAccount: string;
716
- network: "mainnet" | "testnet";
717
- invocations: unknown[];
718
- tokenMovements: {
719
- from: string;
720
- to: string;
721
- amount: string;
722
- token: string;
723
- }[];
724
- authEntries: unknown[];
725
- ledgerSequence: number;
726
- fetchedAt: number;
727
- parseConfidence: {
728
- opaqueScVals: {
729
- type: string;
730
- path: string;
731
- }[];
732
- unknownContracts: {
733
- contract: string;
734
- reason: "no-abi" | "version-mismatch" | "opaque-result";
735
- }[];
736
- overall: number;
737
- knownContracts: string[];
738
- thresholdUsed: number;
739
- };
740
- } & {
741
- [k: string]: unknown;
742
- };
743
709
  interpreter?: {
744
710
  smartAccountAddress: string;
745
711
  installNonce?: number | undefined;
@@ -752,30 +718,67 @@ export declare const SynthesizePolicyInputSchema: z.ZodObject<{
752
718
  confidenceOverride?: {
753
719
  threshold: number;
754
720
  } | undefined;
755
- explain?: boolean | undefined;
756
- }, {
757
- network: "mainnet" | "testnet";
758
- source: "recording";
759
- recordedTx: {
760
- signers: string[];
761
- events: {
762
- contract: string;
763
- topics: string[];
764
- data?: unknown;
765
- }[];
766
- sourceAccount: string;
767
- network: "mainnet" | "testnet";
768
- invocations: unknown[];
769
- tokenMovements: {
721
+ recordedTx?: z.objectOutputType<{
722
+ network: z.ZodEnum<["mainnet", "testnet"]>;
723
+ signers: z.ZodArray<z.ZodString, "many">;
724
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
725
+ tokenMovements: z.ZodArray<z.ZodObject<{
726
+ token: z.ZodString;
727
+ from: z.ZodString;
728
+ to: z.ZodString;
729
+ amount: z.ZodString;
730
+ }, "strip", z.ZodTypeAny, {
770
731
  from: string;
771
732
  to: string;
772
733
  amount: string;
773
734
  token: string;
774
- }[];
775
- authEntries: unknown[];
776
- ledgerSequence: number;
777
- fetchedAt: number;
778
- parseConfidence: {
735
+ }, {
736
+ from: string;
737
+ to: string;
738
+ amount: string;
739
+ token: string;
740
+ }>, "many">;
741
+ events: z.ZodArray<z.ZodObject<{
742
+ contract: z.ZodString;
743
+ topics: z.ZodArray<z.ZodString, "many">;
744
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
745
+ }, "strip", z.ZodTypeAny, {
746
+ contract: string;
747
+ topics: string[];
748
+ data?: unknown;
749
+ }, {
750
+ contract: string;
751
+ topics: string[];
752
+ data?: unknown;
753
+ }>, "many">;
754
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
755
+ ledgerSequence: z.ZodNumber;
756
+ fetchedAt: z.ZodNumber;
757
+ parseConfidence: z.ZodObject<{
758
+ overall: z.ZodNumber;
759
+ knownContracts: z.ZodArray<z.ZodString, "many">;
760
+ unknownContracts: z.ZodArray<z.ZodObject<{
761
+ contract: z.ZodString;
762
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
763
+ }, "strip", z.ZodTypeAny, {
764
+ contract: string;
765
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
766
+ }, {
767
+ contract: string;
768
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
769
+ }>, "many">;
770
+ opaqueScVals: z.ZodArray<z.ZodObject<{
771
+ path: z.ZodString;
772
+ type: z.ZodString;
773
+ }, "strip", z.ZodTypeAny, {
774
+ type: string;
775
+ path: string;
776
+ }, {
777
+ type: string;
778
+ path: string;
779
+ }>, "many">;
780
+ thresholdUsed: z.ZodNumber;
781
+ }, "strip", z.ZodTypeAny, {
779
782
  opaqueScVals: {
780
783
  type: string;
781
784
  path: string;
@@ -787,10 +790,26 @@ export declare const SynthesizePolicyInputSchema: z.ZodObject<{
787
790
  overall: number;
788
791
  knownContracts: string[];
789
792
  thresholdUsed: number;
790
- };
791
- } & {
792
- [k: string]: unknown;
793
- };
793
+ }, {
794
+ opaqueScVals: {
795
+ type: string;
796
+ path: string;
797
+ }[];
798
+ unknownContracts: {
799
+ contract: string;
800
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
801
+ }[];
802
+ overall: number;
803
+ knownContracts: string[];
804
+ thresholdUsed: number;
805
+ }>;
806
+ sourceAccount: z.ZodString;
807
+ }, z.ZodTypeAny, "passthrough"> | undefined;
808
+ transactionHash?: string | undefined;
809
+ explain?: boolean | undefined;
810
+ }, {
811
+ network: "mainnet" | "testnet";
812
+ source: "recording";
794
813
  interpreter?: {
795
814
  smartAccountAddress: string;
796
815
  installNonce?: number | undefined;
@@ -803,20 +822,7 @@ export declare const SynthesizePolicyInputSchema: z.ZodObject<{
803
822
  confidenceOverride?: {
804
823
  threshold: number;
805
824
  } | undefined;
806
- explain?: boolean | undefined;
807
- }>;
808
- export type SynthesizePolicyInput = z.infer<typeof SynthesizePolicyInputSchema>;
809
- /** PredicateLeaf mirrors the core `PredicateLeaf` union. Every variant
810
- * is a `kind` discriminator; literals carry their primitive value inline.
811
- * `literal_vec.elements` is recursive (a vec may contain literals that
812
- * themselves nest) so the leaf schema is lazily self-referential. */
813
- export declare const PredicateLeafSchema: z.ZodType<unknown>;
814
- /** PredicateNode mirrors the core `PredicateNode` union. Recursive through
815
- * `and`; the lazy + annotation pattern keeps the recursion type-safe. */
816
- export declare const PredicateNodeSchema: z.ZodType<unknown>;
817
- export declare const SimulatePolicyInputSchema: z.ZodObject<{
818
- predicate: z.ZodType<unknown, z.ZodTypeDef, unknown>;
819
- permitTx: z.ZodObject<{
825
+ recordedTx?: z.objectInputType<{
820
826
  network: z.ZodEnum<["mainnet", "testnet"]>;
821
827
  signers: z.ZodArray<z.ZodString, "many">;
822
828
  invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
@@ -902,7 +908,25 @@ export declare const SimulatePolicyInputSchema: z.ZodObject<{
902
908
  thresholdUsed: number;
903
909
  }>;
904
910
  sourceAccount: z.ZodString;
905
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
911
+ }, z.ZodTypeAny, "passthrough"> | undefined;
912
+ transactionHash?: string | undefined;
913
+ explain?: boolean | undefined;
914
+ }>, {
915
+ network: "mainnet" | "testnet";
916
+ source: "recording";
917
+ interpreter?: {
918
+ smartAccountAddress: string;
919
+ installNonce?: number | undefined;
920
+ } | undefined;
921
+ userResponses?: {
922
+ limitAmount?: string | undefined;
923
+ validUntilLedger?: number | undefined;
924
+ swapRecipientAllowlist?: string[] | undefined;
925
+ } | undefined;
926
+ confidenceOverride?: {
927
+ threshold: number;
928
+ } | undefined;
929
+ recordedTx?: z.objectOutputType<{
906
930
  network: z.ZodEnum<["mainnet", "testnet"]>;
907
931
  signers: z.ZodArray<z.ZodString, "many">;
908
932
  invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
@@ -988,7 +1012,25 @@ export declare const SimulatePolicyInputSchema: z.ZodObject<{
988
1012
  thresholdUsed: number;
989
1013
  }>;
990
1014
  sourceAccount: z.ZodString;
991
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1015
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1016
+ transactionHash?: string | undefined;
1017
+ explain?: boolean | undefined;
1018
+ }, {
1019
+ network: "mainnet" | "testnet";
1020
+ source: "recording";
1021
+ interpreter?: {
1022
+ smartAccountAddress: string;
1023
+ installNonce?: number | undefined;
1024
+ } | undefined;
1025
+ userResponses?: {
1026
+ limitAmount?: string | undefined;
1027
+ validUntilLedger?: number | undefined;
1028
+ swapRecipientAllowlist?: string[] | undefined;
1029
+ } | undefined;
1030
+ confidenceOverride?: {
1031
+ threshold: number;
1032
+ } | undefined;
1033
+ recordedTx?: z.objectInputType<{
992
1034
  network: z.ZodEnum<["mainnet", "testnet"]>;
993
1035
  signers: z.ZodArray<z.ZodString, "many">;
994
1036
  invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
@@ -1074,89 +1116,28 @@ export declare const SimulatePolicyInputSchema: z.ZodObject<{
1074
1116
  thresholdUsed: number;
1075
1117
  }>;
1076
1118
  sourceAccount: z.ZodString;
1077
- }, z.ZodTypeAny, "passthrough">>;
1078
- validUntilLedger: z.ZodOptional<z.ZodNumber>;
1079
- }, "strip", z.ZodTypeAny, {
1080
- permitTx: {
1081
- signers: string[];
1082
- events: {
1083
- contract: string;
1084
- topics: string[];
1085
- data?: unknown;
1086
- }[];
1087
- sourceAccount: string;
1088
- network: "mainnet" | "testnet";
1089
- invocations: unknown[];
1090
- tokenMovements: {
1091
- from: string;
1092
- to: string;
1093
- amount: string;
1094
- token: string;
1095
- }[];
1096
- authEntries: unknown[];
1097
- ledgerSequence: number;
1098
- fetchedAt: number;
1099
- parseConfidence: {
1100
- opaqueScVals: {
1101
- type: string;
1102
- path: string;
1103
- }[];
1104
- unknownContracts: {
1105
- contract: string;
1106
- reason: "no-abi" | "version-mismatch" | "opaque-result";
1107
- }[];
1108
- overall: number;
1109
- knownContracts: string[];
1110
- thresholdUsed: number;
1111
- };
1112
- } & {
1113
- [k: string]: unknown;
1114
- };
1115
- validUntilLedger?: number | undefined;
1116
- predicate?: unknown;
1117
- }, {
1118
- permitTx: {
1119
- signers: string[];
1120
- events: {
1121
- contract: string;
1122
- topics: string[];
1123
- data?: unknown;
1124
- }[];
1125
- sourceAccount: string;
1126
- network: "mainnet" | "testnet";
1127
- invocations: unknown[];
1128
- tokenMovements: {
1129
- from: string;
1130
- to: string;
1131
- amount: string;
1132
- token: string;
1133
- }[];
1134
- authEntries: unknown[];
1135
- ledgerSequence: number;
1136
- fetchedAt: number;
1137
- parseConfidence: {
1138
- opaqueScVals: {
1139
- type: string;
1140
- path: string;
1141
- }[];
1142
- unknownContracts: {
1143
- contract: string;
1144
- reason: "no-abi" | "version-mismatch" | "opaque-result";
1145
- }[];
1146
- overall: number;
1147
- knownContracts: string[];
1148
- thresholdUsed: number;
1149
- };
1150
- } & {
1151
- [k: string]: unknown;
1152
- };
1153
- validUntilLedger?: number | undefined;
1154
- predicate?: unknown;
1119
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1120
+ transactionHash?: string | undefined;
1121
+ explain?: boolean | undefined;
1155
1122
  }>;
1156
- export type SimulatePolicyInput = z.infer<typeof SimulatePolicyInputSchema>;
1157
- export declare const VerifyPolicyInputSchema: z.ZodObject<{
1158
- predicate: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1159
- permitTx: z.ZodObject<{
1123
+ export type SynthesizePolicyInput = z.infer<typeof SynthesizePolicyInputSchema>;
1124
+ /** PredicateLeaf mirrors the core `PredicateLeaf` union. Every variant
1125
+ * is a `kind` discriminator; literals carry their primitive value inline.
1126
+ * `literal_vec.elements` is recursive (a vec may contain literals that
1127
+ * themselves nest) so the leaf schema is lazily self-referential. */
1128
+ export declare const PredicateLeafSchema: z.ZodType<unknown>;
1129
+ /** PredicateNode mirrors the core `PredicateNode` union. Recursive through
1130
+ * `and`; the lazy + annotation pattern keeps the recursion type-safe. */
1131
+ export declare const PredicateNodeSchema: z.ZodType<unknown>;
1132
+ export declare const SimulatePolicyInputSchema: z.ZodEffects<z.ZodObject<{
1133
+ predicate: z.ZodOptional<z.ZodType<unknown, z.ZodTypeDef, unknown>>;
1134
+ /** The canonical encoding `declare_policy` and `synthesize_policy` both
1135
+ * return. A DECLARED policy has no recording behind it, so re-synthesizing
1136
+ * from a hash would check a different predicate than the one declared -
1137
+ * and the tree is the shape callers mistype. One opaque string is the
1138
+ * handle that path was missing. */
1139
+ encodedPredicate: z.ZodOptional<z.ZodString>;
1140
+ permitTx: z.ZodOptional<z.ZodObject<{
1160
1141
  network: z.ZodEnum<["mainnet", "testnet"]>;
1161
1142
  signers: z.ZodArray<z.ZodString, "many">;
1162
1143
  invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
@@ -1414,29 +1395,983 @@ export declare const VerifyPolicyInputSchema: z.ZodObject<{
1414
1395
  thresholdUsed: number;
1415
1396
  }>;
1416
1397
  sourceAccount: z.ZodString;
1417
- }, z.ZodTypeAny, "passthrough">>;
1398
+ }, z.ZodTypeAny, "passthrough">>>;
1399
+ transactionHash: z.ZodOptional<z.ZodString>;
1400
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
1401
+ /** Needed only with `transactionHash`: lowering a recording to an interpreter
1402
+ * predicate is scoped to the account it will be installed on, and the
1403
+ * self-call gate is defined against it. */
1404
+ smartAccount: z.ZodOptional<z.ZodString>;
1405
+ userResponses: z.ZodOptional<z.ZodObject<{
1406
+ validUntilLedger: z.ZodOptional<z.ZodNumber>;
1407
+ limitAmount: z.ZodOptional<z.ZodString>;
1408
+ swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
1409
+ }, "strict", z.ZodTypeAny, {
1410
+ limitAmount?: string | undefined;
1411
+ validUntilLedger?: number | undefined;
1412
+ swapRecipientAllowlist?: string[] | undefined;
1413
+ }, {
1414
+ limitAmount?: string | undefined;
1415
+ validUntilLedger?: number | undefined;
1416
+ swapRecipientAllowlist?: string[] | undefined;
1417
+ }>>;
1418
1418
  validUntilLedger: z.ZodOptional<z.ZodNumber>;
1419
1419
  }, "strip", z.ZodTypeAny, {
1420
- permitTx: {
1421
- signers: string[];
1422
- events: {
1423
- contract: string;
1424
- topics: string[];
1425
- data?: unknown;
1426
- }[];
1427
- sourceAccount: string;
1428
- network: "mainnet" | "testnet";
1429
- invocations: unknown[];
1430
- tokenMovements: {
1420
+ validUntilLedger?: number | undefined;
1421
+ encodedPredicate?: string | undefined;
1422
+ userResponses?: {
1423
+ limitAmount?: string | undefined;
1424
+ validUntilLedger?: number | undefined;
1425
+ swapRecipientAllowlist?: string[] | undefined;
1426
+ } | undefined;
1427
+ predicate?: unknown;
1428
+ smartAccount?: string | undefined;
1429
+ network?: "mainnet" | "testnet" | undefined;
1430
+ transactionHash?: string | undefined;
1431
+ permitTx?: z.objectOutputType<{
1432
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1433
+ signers: z.ZodArray<z.ZodString, "many">;
1434
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
1435
+ tokenMovements: z.ZodArray<z.ZodObject<{
1436
+ token: z.ZodString;
1437
+ from: z.ZodString;
1438
+ to: z.ZodString;
1439
+ amount: z.ZodString;
1440
+ }, "strip", z.ZodTypeAny, {
1431
1441
  from: string;
1432
1442
  to: string;
1433
1443
  amount: string;
1434
1444
  token: string;
1435
- }[];
1436
- authEntries: unknown[];
1437
- ledgerSequence: number;
1438
- fetchedAt: number;
1439
- parseConfidence: {
1445
+ }, {
1446
+ from: string;
1447
+ to: string;
1448
+ amount: string;
1449
+ token: string;
1450
+ }>, "many">;
1451
+ events: z.ZodArray<z.ZodObject<{
1452
+ contract: z.ZodString;
1453
+ topics: z.ZodArray<z.ZodString, "many">;
1454
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1455
+ }, "strip", z.ZodTypeAny, {
1456
+ contract: string;
1457
+ topics: string[];
1458
+ data?: unknown;
1459
+ }, {
1460
+ contract: string;
1461
+ topics: string[];
1462
+ data?: unknown;
1463
+ }>, "many">;
1464
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
1465
+ ledgerSequence: z.ZodNumber;
1466
+ fetchedAt: z.ZodNumber;
1467
+ parseConfidence: z.ZodObject<{
1468
+ overall: z.ZodNumber;
1469
+ knownContracts: z.ZodArray<z.ZodString, "many">;
1470
+ unknownContracts: z.ZodArray<z.ZodObject<{
1471
+ contract: z.ZodString;
1472
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
1473
+ }, "strip", z.ZodTypeAny, {
1474
+ contract: string;
1475
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1476
+ }, {
1477
+ contract: string;
1478
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1479
+ }>, "many">;
1480
+ opaqueScVals: z.ZodArray<z.ZodObject<{
1481
+ path: z.ZodString;
1482
+ type: z.ZodString;
1483
+ }, "strip", z.ZodTypeAny, {
1484
+ type: string;
1485
+ path: string;
1486
+ }, {
1487
+ type: string;
1488
+ path: string;
1489
+ }>, "many">;
1490
+ thresholdUsed: z.ZodNumber;
1491
+ }, "strip", z.ZodTypeAny, {
1492
+ opaqueScVals: {
1493
+ type: string;
1494
+ path: string;
1495
+ }[];
1496
+ unknownContracts: {
1497
+ contract: string;
1498
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1499
+ }[];
1500
+ overall: number;
1501
+ knownContracts: string[];
1502
+ thresholdUsed: number;
1503
+ }, {
1504
+ opaqueScVals: {
1505
+ type: string;
1506
+ path: string;
1507
+ }[];
1508
+ unknownContracts: {
1509
+ contract: string;
1510
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1511
+ }[];
1512
+ overall: number;
1513
+ knownContracts: string[];
1514
+ thresholdUsed: number;
1515
+ }>;
1516
+ sourceAccount: z.ZodString;
1517
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1518
+ }, {
1519
+ validUntilLedger?: number | undefined;
1520
+ encodedPredicate?: string | undefined;
1521
+ userResponses?: {
1522
+ limitAmount?: string | undefined;
1523
+ validUntilLedger?: number | undefined;
1524
+ swapRecipientAllowlist?: string[] | undefined;
1525
+ } | undefined;
1526
+ predicate?: unknown;
1527
+ smartAccount?: string | undefined;
1528
+ network?: "mainnet" | "testnet" | undefined;
1529
+ transactionHash?: string | undefined;
1530
+ permitTx?: z.objectInputType<{
1531
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1532
+ signers: z.ZodArray<z.ZodString, "many">;
1533
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
1534
+ tokenMovements: z.ZodArray<z.ZodObject<{
1535
+ token: z.ZodString;
1536
+ from: z.ZodString;
1537
+ to: z.ZodString;
1538
+ amount: z.ZodString;
1539
+ }, "strip", z.ZodTypeAny, {
1540
+ from: string;
1541
+ to: string;
1542
+ amount: string;
1543
+ token: string;
1544
+ }, {
1545
+ from: string;
1546
+ to: string;
1547
+ amount: string;
1548
+ token: string;
1549
+ }>, "many">;
1550
+ events: z.ZodArray<z.ZodObject<{
1551
+ contract: z.ZodString;
1552
+ topics: z.ZodArray<z.ZodString, "many">;
1553
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1554
+ }, "strip", z.ZodTypeAny, {
1555
+ contract: string;
1556
+ topics: string[];
1557
+ data?: unknown;
1558
+ }, {
1559
+ contract: string;
1560
+ topics: string[];
1561
+ data?: unknown;
1562
+ }>, "many">;
1563
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
1564
+ ledgerSequence: z.ZodNumber;
1565
+ fetchedAt: z.ZodNumber;
1566
+ parseConfidence: z.ZodObject<{
1567
+ overall: z.ZodNumber;
1568
+ knownContracts: z.ZodArray<z.ZodString, "many">;
1569
+ unknownContracts: z.ZodArray<z.ZodObject<{
1570
+ contract: z.ZodString;
1571
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
1572
+ }, "strip", z.ZodTypeAny, {
1573
+ contract: string;
1574
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1575
+ }, {
1576
+ contract: string;
1577
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1578
+ }>, "many">;
1579
+ opaqueScVals: z.ZodArray<z.ZodObject<{
1580
+ path: z.ZodString;
1581
+ type: z.ZodString;
1582
+ }, "strip", z.ZodTypeAny, {
1583
+ type: string;
1584
+ path: string;
1585
+ }, {
1586
+ type: string;
1587
+ path: string;
1588
+ }>, "many">;
1589
+ thresholdUsed: z.ZodNumber;
1590
+ }, "strip", z.ZodTypeAny, {
1591
+ opaqueScVals: {
1592
+ type: string;
1593
+ path: string;
1594
+ }[];
1595
+ unknownContracts: {
1596
+ contract: string;
1597
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1598
+ }[];
1599
+ overall: number;
1600
+ knownContracts: string[];
1601
+ thresholdUsed: number;
1602
+ }, {
1603
+ opaqueScVals: {
1604
+ type: string;
1605
+ path: string;
1606
+ }[];
1607
+ unknownContracts: {
1608
+ contract: string;
1609
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1610
+ }[];
1611
+ overall: number;
1612
+ knownContracts: string[];
1613
+ thresholdUsed: number;
1614
+ }>;
1615
+ sourceAccount: z.ZodString;
1616
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1617
+ }>, {
1618
+ validUntilLedger?: number | undefined;
1619
+ encodedPredicate?: string | undefined;
1620
+ userResponses?: {
1621
+ limitAmount?: string | undefined;
1622
+ validUntilLedger?: number | undefined;
1623
+ swapRecipientAllowlist?: string[] | undefined;
1624
+ } | undefined;
1625
+ predicate?: unknown;
1626
+ smartAccount?: string | undefined;
1627
+ network?: "mainnet" | "testnet" | undefined;
1628
+ transactionHash?: string | undefined;
1629
+ permitTx?: z.objectOutputType<{
1630
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1631
+ signers: z.ZodArray<z.ZodString, "many">;
1632
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
1633
+ tokenMovements: z.ZodArray<z.ZodObject<{
1634
+ token: z.ZodString;
1635
+ from: z.ZodString;
1636
+ to: z.ZodString;
1637
+ amount: z.ZodString;
1638
+ }, "strip", z.ZodTypeAny, {
1639
+ from: string;
1640
+ to: string;
1641
+ amount: string;
1642
+ token: string;
1643
+ }, {
1644
+ from: string;
1645
+ to: string;
1646
+ amount: string;
1647
+ token: string;
1648
+ }>, "many">;
1649
+ events: z.ZodArray<z.ZodObject<{
1650
+ contract: z.ZodString;
1651
+ topics: z.ZodArray<z.ZodString, "many">;
1652
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1653
+ }, "strip", z.ZodTypeAny, {
1654
+ contract: string;
1655
+ topics: string[];
1656
+ data?: unknown;
1657
+ }, {
1658
+ contract: string;
1659
+ topics: string[];
1660
+ data?: unknown;
1661
+ }>, "many">;
1662
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
1663
+ ledgerSequence: z.ZodNumber;
1664
+ fetchedAt: z.ZodNumber;
1665
+ parseConfidence: z.ZodObject<{
1666
+ overall: z.ZodNumber;
1667
+ knownContracts: z.ZodArray<z.ZodString, "many">;
1668
+ unknownContracts: z.ZodArray<z.ZodObject<{
1669
+ contract: z.ZodString;
1670
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
1671
+ }, "strip", z.ZodTypeAny, {
1672
+ contract: string;
1673
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1674
+ }, {
1675
+ contract: string;
1676
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1677
+ }>, "many">;
1678
+ opaqueScVals: z.ZodArray<z.ZodObject<{
1679
+ path: z.ZodString;
1680
+ type: z.ZodString;
1681
+ }, "strip", z.ZodTypeAny, {
1682
+ type: string;
1683
+ path: string;
1684
+ }, {
1685
+ type: string;
1686
+ path: string;
1687
+ }>, "many">;
1688
+ thresholdUsed: z.ZodNumber;
1689
+ }, "strip", z.ZodTypeAny, {
1690
+ opaqueScVals: {
1691
+ type: string;
1692
+ path: string;
1693
+ }[];
1694
+ unknownContracts: {
1695
+ contract: string;
1696
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1697
+ }[];
1698
+ overall: number;
1699
+ knownContracts: string[];
1700
+ thresholdUsed: number;
1701
+ }, {
1702
+ opaqueScVals: {
1703
+ type: string;
1704
+ path: string;
1705
+ }[];
1706
+ unknownContracts: {
1707
+ contract: string;
1708
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1709
+ }[];
1710
+ overall: number;
1711
+ knownContracts: string[];
1712
+ thresholdUsed: number;
1713
+ }>;
1714
+ sourceAccount: z.ZodString;
1715
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1716
+ }, {
1717
+ validUntilLedger?: number | undefined;
1718
+ encodedPredicate?: string | undefined;
1719
+ userResponses?: {
1720
+ limitAmount?: string | undefined;
1721
+ validUntilLedger?: number | undefined;
1722
+ swapRecipientAllowlist?: string[] | undefined;
1723
+ } | undefined;
1724
+ predicate?: unknown;
1725
+ smartAccount?: string | undefined;
1726
+ network?: "mainnet" | "testnet" | undefined;
1727
+ transactionHash?: string | undefined;
1728
+ permitTx?: z.objectInputType<{
1729
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1730
+ signers: z.ZodArray<z.ZodString, "many">;
1731
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
1732
+ tokenMovements: z.ZodArray<z.ZodObject<{
1733
+ token: z.ZodString;
1734
+ from: z.ZodString;
1735
+ to: z.ZodString;
1736
+ amount: z.ZodString;
1737
+ }, "strip", z.ZodTypeAny, {
1738
+ from: string;
1739
+ to: string;
1740
+ amount: string;
1741
+ token: string;
1742
+ }, {
1743
+ from: string;
1744
+ to: string;
1745
+ amount: string;
1746
+ token: string;
1747
+ }>, "many">;
1748
+ events: z.ZodArray<z.ZodObject<{
1749
+ contract: z.ZodString;
1750
+ topics: z.ZodArray<z.ZodString, "many">;
1751
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1752
+ }, "strip", z.ZodTypeAny, {
1753
+ contract: string;
1754
+ topics: string[];
1755
+ data?: unknown;
1756
+ }, {
1757
+ contract: string;
1758
+ topics: string[];
1759
+ data?: unknown;
1760
+ }>, "many">;
1761
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
1762
+ ledgerSequence: z.ZodNumber;
1763
+ fetchedAt: z.ZodNumber;
1764
+ parseConfidence: z.ZodObject<{
1765
+ overall: z.ZodNumber;
1766
+ knownContracts: z.ZodArray<z.ZodString, "many">;
1767
+ unknownContracts: z.ZodArray<z.ZodObject<{
1768
+ contract: z.ZodString;
1769
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
1770
+ }, "strip", z.ZodTypeAny, {
1771
+ contract: string;
1772
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1773
+ }, {
1774
+ contract: string;
1775
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1776
+ }>, "many">;
1777
+ opaqueScVals: z.ZodArray<z.ZodObject<{
1778
+ path: z.ZodString;
1779
+ type: z.ZodString;
1780
+ }, "strip", z.ZodTypeAny, {
1781
+ type: string;
1782
+ path: string;
1783
+ }, {
1784
+ type: string;
1785
+ path: string;
1786
+ }>, "many">;
1787
+ thresholdUsed: z.ZodNumber;
1788
+ }, "strip", z.ZodTypeAny, {
1789
+ opaqueScVals: {
1790
+ type: string;
1791
+ path: string;
1792
+ }[];
1793
+ unknownContracts: {
1794
+ contract: string;
1795
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1796
+ }[];
1797
+ overall: number;
1798
+ knownContracts: string[];
1799
+ thresholdUsed: number;
1800
+ }, {
1801
+ opaqueScVals: {
1802
+ type: string;
1803
+ path: string;
1804
+ }[];
1805
+ unknownContracts: {
1806
+ contract: string;
1807
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1808
+ }[];
1809
+ overall: number;
1810
+ knownContracts: string[];
1811
+ thresholdUsed: number;
1812
+ }>;
1813
+ sourceAccount: z.ZodString;
1814
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1815
+ }>;
1816
+ export type SimulatePolicyInput = z.infer<typeof SimulatePolicyInputSchema>;
1817
+ export declare const VerifyPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1818
+ predicate: z.ZodOptional<z.ZodType<unknown, z.ZodTypeDef, unknown>>;
1819
+ /** The canonical encoding `declare_policy` and `synthesize_policy` both
1820
+ * return. A DECLARED policy has no recording behind it, so re-synthesizing
1821
+ * from a hash would check a different predicate than the one declared -
1822
+ * and the tree is the shape callers mistype. One opaque string is the
1823
+ * handle that path was missing. */
1824
+ encodedPredicate: z.ZodOptional<z.ZodString>;
1825
+ permitTx: z.ZodOptional<z.ZodObject<{
1826
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1827
+ signers: z.ZodArray<z.ZodString, "many">;
1828
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
1829
+ tokenMovements: z.ZodArray<z.ZodObject<{
1830
+ token: z.ZodString;
1831
+ from: z.ZodString;
1832
+ to: z.ZodString;
1833
+ amount: z.ZodString;
1834
+ }, "strip", z.ZodTypeAny, {
1835
+ from: string;
1836
+ to: string;
1837
+ amount: string;
1838
+ token: string;
1839
+ }, {
1840
+ from: string;
1841
+ to: string;
1842
+ amount: string;
1843
+ token: string;
1844
+ }>, "many">;
1845
+ events: z.ZodArray<z.ZodObject<{
1846
+ contract: z.ZodString;
1847
+ topics: z.ZodArray<z.ZodString, "many">;
1848
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1849
+ }, "strip", z.ZodTypeAny, {
1850
+ contract: string;
1851
+ topics: string[];
1852
+ data?: unknown;
1853
+ }, {
1854
+ contract: string;
1855
+ topics: string[];
1856
+ data?: unknown;
1857
+ }>, "many">;
1858
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
1859
+ ledgerSequence: z.ZodNumber;
1860
+ fetchedAt: z.ZodNumber;
1861
+ parseConfidence: z.ZodObject<{
1862
+ overall: z.ZodNumber;
1863
+ knownContracts: z.ZodArray<z.ZodString, "many">;
1864
+ unknownContracts: z.ZodArray<z.ZodObject<{
1865
+ contract: z.ZodString;
1866
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
1867
+ }, "strip", z.ZodTypeAny, {
1868
+ contract: string;
1869
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1870
+ }, {
1871
+ contract: string;
1872
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1873
+ }>, "many">;
1874
+ opaqueScVals: z.ZodArray<z.ZodObject<{
1875
+ path: z.ZodString;
1876
+ type: z.ZodString;
1877
+ }, "strip", z.ZodTypeAny, {
1878
+ type: string;
1879
+ path: string;
1880
+ }, {
1881
+ type: string;
1882
+ path: string;
1883
+ }>, "many">;
1884
+ thresholdUsed: z.ZodNumber;
1885
+ }, "strip", z.ZodTypeAny, {
1886
+ opaqueScVals: {
1887
+ type: string;
1888
+ path: string;
1889
+ }[];
1890
+ unknownContracts: {
1891
+ contract: string;
1892
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1893
+ }[];
1894
+ overall: number;
1895
+ knownContracts: string[];
1896
+ thresholdUsed: number;
1897
+ }, {
1898
+ opaqueScVals: {
1899
+ type: string;
1900
+ path: string;
1901
+ }[];
1902
+ unknownContracts: {
1903
+ contract: string;
1904
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1905
+ }[];
1906
+ overall: number;
1907
+ knownContracts: string[];
1908
+ thresholdUsed: number;
1909
+ }>;
1910
+ sourceAccount: z.ZodString;
1911
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1912
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1913
+ signers: z.ZodArray<z.ZodString, "many">;
1914
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
1915
+ tokenMovements: z.ZodArray<z.ZodObject<{
1916
+ token: z.ZodString;
1917
+ from: z.ZodString;
1918
+ to: z.ZodString;
1919
+ amount: z.ZodString;
1920
+ }, "strip", z.ZodTypeAny, {
1921
+ from: string;
1922
+ to: string;
1923
+ amount: string;
1924
+ token: string;
1925
+ }, {
1926
+ from: string;
1927
+ to: string;
1928
+ amount: string;
1929
+ token: string;
1930
+ }>, "many">;
1931
+ events: z.ZodArray<z.ZodObject<{
1932
+ contract: z.ZodString;
1933
+ topics: z.ZodArray<z.ZodString, "many">;
1934
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
1935
+ }, "strip", z.ZodTypeAny, {
1936
+ contract: string;
1937
+ topics: string[];
1938
+ data?: unknown;
1939
+ }, {
1940
+ contract: string;
1941
+ topics: string[];
1942
+ data?: unknown;
1943
+ }>, "many">;
1944
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
1945
+ ledgerSequence: z.ZodNumber;
1946
+ fetchedAt: z.ZodNumber;
1947
+ parseConfidence: z.ZodObject<{
1948
+ overall: z.ZodNumber;
1949
+ knownContracts: z.ZodArray<z.ZodString, "many">;
1950
+ unknownContracts: z.ZodArray<z.ZodObject<{
1951
+ contract: z.ZodString;
1952
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
1953
+ }, "strip", z.ZodTypeAny, {
1954
+ contract: string;
1955
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1956
+ }, {
1957
+ contract: string;
1958
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1959
+ }>, "many">;
1960
+ opaqueScVals: z.ZodArray<z.ZodObject<{
1961
+ path: z.ZodString;
1962
+ type: z.ZodString;
1963
+ }, "strip", z.ZodTypeAny, {
1964
+ type: string;
1965
+ path: string;
1966
+ }, {
1967
+ type: string;
1968
+ path: string;
1969
+ }>, "many">;
1970
+ thresholdUsed: z.ZodNumber;
1971
+ }, "strip", z.ZodTypeAny, {
1972
+ opaqueScVals: {
1973
+ type: string;
1974
+ path: string;
1975
+ }[];
1976
+ unknownContracts: {
1977
+ contract: string;
1978
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1979
+ }[];
1980
+ overall: number;
1981
+ knownContracts: string[];
1982
+ thresholdUsed: number;
1983
+ }, {
1984
+ opaqueScVals: {
1985
+ type: string;
1986
+ path: string;
1987
+ }[];
1988
+ unknownContracts: {
1989
+ contract: string;
1990
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
1991
+ }[];
1992
+ overall: number;
1993
+ knownContracts: string[];
1994
+ thresholdUsed: number;
1995
+ }>;
1996
+ sourceAccount: z.ZodString;
1997
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1998
+ network: z.ZodEnum<["mainnet", "testnet"]>;
1999
+ signers: z.ZodArray<z.ZodString, "many">;
2000
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
2001
+ tokenMovements: z.ZodArray<z.ZodObject<{
2002
+ token: z.ZodString;
2003
+ from: z.ZodString;
2004
+ to: z.ZodString;
2005
+ amount: z.ZodString;
2006
+ }, "strip", z.ZodTypeAny, {
2007
+ from: string;
2008
+ to: string;
2009
+ amount: string;
2010
+ token: string;
2011
+ }, {
2012
+ from: string;
2013
+ to: string;
2014
+ amount: string;
2015
+ token: string;
2016
+ }>, "many">;
2017
+ events: z.ZodArray<z.ZodObject<{
2018
+ contract: z.ZodString;
2019
+ topics: z.ZodArray<z.ZodString, "many">;
2020
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
2021
+ }, "strip", z.ZodTypeAny, {
2022
+ contract: string;
2023
+ topics: string[];
2024
+ data?: unknown;
2025
+ }, {
2026
+ contract: string;
2027
+ topics: string[];
2028
+ data?: unknown;
2029
+ }>, "many">;
2030
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
2031
+ ledgerSequence: z.ZodNumber;
2032
+ fetchedAt: z.ZodNumber;
2033
+ parseConfidence: z.ZodObject<{
2034
+ overall: z.ZodNumber;
2035
+ knownContracts: z.ZodArray<z.ZodString, "many">;
2036
+ unknownContracts: z.ZodArray<z.ZodObject<{
2037
+ contract: z.ZodString;
2038
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
2039
+ }, "strip", z.ZodTypeAny, {
2040
+ contract: string;
2041
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2042
+ }, {
2043
+ contract: string;
2044
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2045
+ }>, "many">;
2046
+ opaqueScVals: z.ZodArray<z.ZodObject<{
2047
+ path: z.ZodString;
2048
+ type: z.ZodString;
2049
+ }, "strip", z.ZodTypeAny, {
2050
+ type: string;
2051
+ path: string;
2052
+ }, {
2053
+ type: string;
2054
+ path: string;
2055
+ }>, "many">;
2056
+ thresholdUsed: z.ZodNumber;
2057
+ }, "strip", z.ZodTypeAny, {
2058
+ opaqueScVals: {
2059
+ type: string;
2060
+ path: string;
2061
+ }[];
2062
+ unknownContracts: {
2063
+ contract: string;
2064
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2065
+ }[];
2066
+ overall: number;
2067
+ knownContracts: string[];
2068
+ thresholdUsed: number;
2069
+ }, {
2070
+ opaqueScVals: {
2071
+ type: string;
2072
+ path: string;
2073
+ }[];
2074
+ unknownContracts: {
2075
+ contract: string;
2076
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2077
+ }[];
2078
+ overall: number;
2079
+ knownContracts: string[];
2080
+ thresholdUsed: number;
2081
+ }>;
2082
+ sourceAccount: z.ZodString;
2083
+ }, z.ZodTypeAny, "passthrough">>>;
2084
+ transactionHash: z.ZodOptional<z.ZodString>;
2085
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
2086
+ /** Needed only with `transactionHash`: lowering a recording to an interpreter
2087
+ * predicate is scoped to the account it will be installed on, and the
2088
+ * self-call gate is defined against it. */
2089
+ smartAccount: z.ZodOptional<z.ZodString>;
2090
+ userResponses: z.ZodOptional<z.ZodObject<{
2091
+ validUntilLedger: z.ZodOptional<z.ZodNumber>;
2092
+ limitAmount: z.ZodOptional<z.ZodString>;
2093
+ swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
2094
+ }, "strict", z.ZodTypeAny, {
2095
+ limitAmount?: string | undefined;
2096
+ validUntilLedger?: number | undefined;
2097
+ swapRecipientAllowlist?: string[] | undefined;
2098
+ }, {
2099
+ limitAmount?: string | undefined;
2100
+ validUntilLedger?: number | undefined;
2101
+ swapRecipientAllowlist?: string[] | undefined;
2102
+ }>>;
2103
+ validUntilLedger: z.ZodOptional<z.ZodNumber>;
2104
+ }, "strip", z.ZodTypeAny, {
2105
+ validUntilLedger?: number | undefined;
2106
+ encodedPredicate?: string | undefined;
2107
+ userResponses?: {
2108
+ limitAmount?: string | undefined;
2109
+ validUntilLedger?: number | undefined;
2110
+ swapRecipientAllowlist?: string[] | undefined;
2111
+ } | undefined;
2112
+ predicate?: unknown;
2113
+ smartAccount?: string | undefined;
2114
+ network?: "mainnet" | "testnet" | undefined;
2115
+ transactionHash?: string | undefined;
2116
+ permitTx?: z.objectOutputType<{
2117
+ network: z.ZodEnum<["mainnet", "testnet"]>;
2118
+ signers: z.ZodArray<z.ZodString, "many">;
2119
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
2120
+ tokenMovements: z.ZodArray<z.ZodObject<{
2121
+ token: z.ZodString;
2122
+ from: z.ZodString;
2123
+ to: z.ZodString;
2124
+ amount: z.ZodString;
2125
+ }, "strip", z.ZodTypeAny, {
2126
+ from: string;
2127
+ to: string;
2128
+ amount: string;
2129
+ token: string;
2130
+ }, {
2131
+ from: string;
2132
+ to: string;
2133
+ amount: string;
2134
+ token: string;
2135
+ }>, "many">;
2136
+ events: z.ZodArray<z.ZodObject<{
2137
+ contract: z.ZodString;
2138
+ topics: z.ZodArray<z.ZodString, "many">;
2139
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
2140
+ }, "strip", z.ZodTypeAny, {
2141
+ contract: string;
2142
+ topics: string[];
2143
+ data?: unknown;
2144
+ }, {
2145
+ contract: string;
2146
+ topics: string[];
2147
+ data?: unknown;
2148
+ }>, "many">;
2149
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
2150
+ ledgerSequence: z.ZodNumber;
2151
+ fetchedAt: z.ZodNumber;
2152
+ parseConfidence: z.ZodObject<{
2153
+ overall: z.ZodNumber;
2154
+ knownContracts: z.ZodArray<z.ZodString, "many">;
2155
+ unknownContracts: z.ZodArray<z.ZodObject<{
2156
+ contract: z.ZodString;
2157
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
2158
+ }, "strip", z.ZodTypeAny, {
2159
+ contract: string;
2160
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2161
+ }, {
2162
+ contract: string;
2163
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2164
+ }>, "many">;
2165
+ opaqueScVals: z.ZodArray<z.ZodObject<{
2166
+ path: z.ZodString;
2167
+ type: z.ZodString;
2168
+ }, "strip", z.ZodTypeAny, {
2169
+ type: string;
2170
+ path: string;
2171
+ }, {
2172
+ type: string;
2173
+ path: string;
2174
+ }>, "many">;
2175
+ thresholdUsed: z.ZodNumber;
2176
+ }, "strip", z.ZodTypeAny, {
2177
+ opaqueScVals: {
2178
+ type: string;
2179
+ path: string;
2180
+ }[];
2181
+ unknownContracts: {
2182
+ contract: string;
2183
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2184
+ }[];
2185
+ overall: number;
2186
+ knownContracts: string[];
2187
+ thresholdUsed: number;
2188
+ }, {
2189
+ opaqueScVals: {
2190
+ type: string;
2191
+ path: string;
2192
+ }[];
2193
+ unknownContracts: {
2194
+ contract: string;
2195
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2196
+ }[];
2197
+ overall: number;
2198
+ knownContracts: string[];
2199
+ thresholdUsed: number;
2200
+ }>;
2201
+ sourceAccount: z.ZodString;
2202
+ }, z.ZodTypeAny, "passthrough"> | undefined;
2203
+ }, {
2204
+ validUntilLedger?: number | undefined;
2205
+ encodedPredicate?: string | undefined;
2206
+ userResponses?: {
2207
+ limitAmount?: string | undefined;
2208
+ validUntilLedger?: number | undefined;
2209
+ swapRecipientAllowlist?: string[] | undefined;
2210
+ } | undefined;
2211
+ predicate?: unknown;
2212
+ smartAccount?: string | undefined;
2213
+ network?: "mainnet" | "testnet" | undefined;
2214
+ transactionHash?: string | undefined;
2215
+ permitTx?: z.objectInputType<{
2216
+ network: z.ZodEnum<["mainnet", "testnet"]>;
2217
+ signers: z.ZodArray<z.ZodString, "many">;
2218
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
2219
+ tokenMovements: z.ZodArray<z.ZodObject<{
2220
+ token: z.ZodString;
2221
+ from: z.ZodString;
2222
+ to: z.ZodString;
2223
+ amount: z.ZodString;
2224
+ }, "strip", z.ZodTypeAny, {
2225
+ from: string;
2226
+ to: string;
2227
+ amount: string;
2228
+ token: string;
2229
+ }, {
2230
+ from: string;
2231
+ to: string;
2232
+ amount: string;
2233
+ token: string;
2234
+ }>, "many">;
2235
+ events: z.ZodArray<z.ZodObject<{
2236
+ contract: z.ZodString;
2237
+ topics: z.ZodArray<z.ZodString, "many">;
2238
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
2239
+ }, "strip", z.ZodTypeAny, {
2240
+ contract: string;
2241
+ topics: string[];
2242
+ data?: unknown;
2243
+ }, {
2244
+ contract: string;
2245
+ topics: string[];
2246
+ data?: unknown;
2247
+ }>, "many">;
2248
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
2249
+ ledgerSequence: z.ZodNumber;
2250
+ fetchedAt: z.ZodNumber;
2251
+ parseConfidence: z.ZodObject<{
2252
+ overall: z.ZodNumber;
2253
+ knownContracts: z.ZodArray<z.ZodString, "many">;
2254
+ unknownContracts: z.ZodArray<z.ZodObject<{
2255
+ contract: z.ZodString;
2256
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
2257
+ }, "strip", z.ZodTypeAny, {
2258
+ contract: string;
2259
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2260
+ }, {
2261
+ contract: string;
2262
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2263
+ }>, "many">;
2264
+ opaqueScVals: z.ZodArray<z.ZodObject<{
2265
+ path: z.ZodString;
2266
+ type: z.ZodString;
2267
+ }, "strip", z.ZodTypeAny, {
2268
+ type: string;
2269
+ path: string;
2270
+ }, {
2271
+ type: string;
2272
+ path: string;
2273
+ }>, "many">;
2274
+ thresholdUsed: z.ZodNumber;
2275
+ }, "strip", z.ZodTypeAny, {
2276
+ opaqueScVals: {
2277
+ type: string;
2278
+ path: string;
2279
+ }[];
2280
+ unknownContracts: {
2281
+ contract: string;
2282
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2283
+ }[];
2284
+ overall: number;
2285
+ knownContracts: string[];
2286
+ thresholdUsed: number;
2287
+ }, {
2288
+ opaqueScVals: {
2289
+ type: string;
2290
+ path: string;
2291
+ }[];
2292
+ unknownContracts: {
2293
+ contract: string;
2294
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2295
+ }[];
2296
+ overall: number;
2297
+ knownContracts: string[];
2298
+ thresholdUsed: number;
2299
+ }>;
2300
+ sourceAccount: z.ZodString;
2301
+ }, z.ZodTypeAny, "passthrough"> | undefined;
2302
+ }>, {
2303
+ validUntilLedger?: number | undefined;
2304
+ encodedPredicate?: string | undefined;
2305
+ userResponses?: {
2306
+ limitAmount?: string | undefined;
2307
+ validUntilLedger?: number | undefined;
2308
+ swapRecipientAllowlist?: string[] | undefined;
2309
+ } | undefined;
2310
+ predicate?: unknown;
2311
+ smartAccount?: string | undefined;
2312
+ network?: "mainnet" | "testnet" | undefined;
2313
+ transactionHash?: string | undefined;
2314
+ permitTx?: z.objectOutputType<{
2315
+ network: z.ZodEnum<["mainnet", "testnet"]>;
2316
+ signers: z.ZodArray<z.ZodString, "many">;
2317
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
2318
+ tokenMovements: z.ZodArray<z.ZodObject<{
2319
+ token: z.ZodString;
2320
+ from: z.ZodString;
2321
+ to: z.ZodString;
2322
+ amount: z.ZodString;
2323
+ }, "strip", z.ZodTypeAny, {
2324
+ from: string;
2325
+ to: string;
2326
+ amount: string;
2327
+ token: string;
2328
+ }, {
2329
+ from: string;
2330
+ to: string;
2331
+ amount: string;
2332
+ token: string;
2333
+ }>, "many">;
2334
+ events: z.ZodArray<z.ZodObject<{
2335
+ contract: z.ZodString;
2336
+ topics: z.ZodArray<z.ZodString, "many">;
2337
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
2338
+ }, "strip", z.ZodTypeAny, {
2339
+ contract: string;
2340
+ topics: string[];
2341
+ data?: unknown;
2342
+ }, {
2343
+ contract: string;
2344
+ topics: string[];
2345
+ data?: unknown;
2346
+ }>, "many">;
2347
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
2348
+ ledgerSequence: z.ZodNumber;
2349
+ fetchedAt: z.ZodNumber;
2350
+ parseConfidence: z.ZodObject<{
2351
+ overall: z.ZodNumber;
2352
+ knownContracts: z.ZodArray<z.ZodString, "many">;
2353
+ unknownContracts: z.ZodArray<z.ZodObject<{
2354
+ contract: z.ZodString;
2355
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
2356
+ }, "strip", z.ZodTypeAny, {
2357
+ contract: string;
2358
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2359
+ }, {
2360
+ contract: string;
2361
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2362
+ }>, "many">;
2363
+ opaqueScVals: z.ZodArray<z.ZodObject<{
2364
+ path: z.ZodString;
2365
+ type: z.ZodString;
2366
+ }, "strip", z.ZodTypeAny, {
2367
+ type: string;
2368
+ path: string;
2369
+ }, {
2370
+ type: string;
2371
+ path: string;
2372
+ }>, "many">;
2373
+ thresholdUsed: z.ZodNumber;
2374
+ }, "strip", z.ZodTypeAny, {
1440
2375
  opaqueScVals: {
1441
2376
  type: string;
1442
2377
  path: string;
@@ -1448,33 +2383,94 @@ export declare const VerifyPolicyInputSchema: z.ZodObject<{
1448
2383
  overall: number;
1449
2384
  knownContracts: string[];
1450
2385
  thresholdUsed: number;
1451
- };
1452
- } & {
1453
- [k: string]: unknown;
1454
- };
2386
+ }, {
2387
+ opaqueScVals: {
2388
+ type: string;
2389
+ path: string;
2390
+ }[];
2391
+ unknownContracts: {
2392
+ contract: string;
2393
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2394
+ }[];
2395
+ overall: number;
2396
+ knownContracts: string[];
2397
+ thresholdUsed: number;
2398
+ }>;
2399
+ sourceAccount: z.ZodString;
2400
+ }, z.ZodTypeAny, "passthrough"> | undefined;
2401
+ }, {
1455
2402
  validUntilLedger?: number | undefined;
2403
+ encodedPredicate?: string | undefined;
2404
+ userResponses?: {
2405
+ limitAmount?: string | undefined;
2406
+ validUntilLedger?: number | undefined;
2407
+ swapRecipientAllowlist?: string[] | undefined;
2408
+ } | undefined;
1456
2409
  predicate?: unknown;
1457
- }, {
1458
- permitTx: {
1459
- signers: string[];
1460
- events: {
1461
- contract: string;
1462
- topics: string[];
1463
- data?: unknown;
1464
- }[];
1465
- sourceAccount: string;
1466
- network: "mainnet" | "testnet";
1467
- invocations: unknown[];
1468
- tokenMovements: {
2410
+ smartAccount?: string | undefined;
2411
+ network?: "mainnet" | "testnet" | undefined;
2412
+ transactionHash?: string | undefined;
2413
+ permitTx?: z.objectInputType<{
2414
+ network: z.ZodEnum<["mainnet", "testnet"]>;
2415
+ signers: z.ZodArray<z.ZodString, "many">;
2416
+ invocations: z.ZodArray<z.ZodType<unknown, z.ZodTypeDef, unknown>, "many">;
2417
+ tokenMovements: z.ZodArray<z.ZodObject<{
2418
+ token: z.ZodString;
2419
+ from: z.ZodString;
2420
+ to: z.ZodString;
2421
+ amount: z.ZodString;
2422
+ }, "strip", z.ZodTypeAny, {
1469
2423
  from: string;
1470
2424
  to: string;
1471
2425
  amount: string;
1472
2426
  token: string;
1473
- }[];
1474
- authEntries: unknown[];
1475
- ledgerSequence: number;
1476
- fetchedAt: number;
1477
- parseConfidence: {
2427
+ }, {
2428
+ from: string;
2429
+ to: string;
2430
+ amount: string;
2431
+ token: string;
2432
+ }>, "many">;
2433
+ events: z.ZodArray<z.ZodObject<{
2434
+ contract: z.ZodString;
2435
+ topics: z.ZodArray<z.ZodString, "many">;
2436
+ data: z.ZodType<unknown, z.ZodTypeDef, unknown>;
2437
+ }, "strip", z.ZodTypeAny, {
2438
+ contract: string;
2439
+ topics: string[];
2440
+ data?: unknown;
2441
+ }, {
2442
+ contract: string;
2443
+ topics: string[];
2444
+ data?: unknown;
2445
+ }>, "many">;
2446
+ authEntries: z.ZodArray<z.ZodUnknown, "many">;
2447
+ ledgerSequence: z.ZodNumber;
2448
+ fetchedAt: z.ZodNumber;
2449
+ parseConfidence: z.ZodObject<{
2450
+ overall: z.ZodNumber;
2451
+ knownContracts: z.ZodArray<z.ZodString, "many">;
2452
+ unknownContracts: z.ZodArray<z.ZodObject<{
2453
+ contract: z.ZodString;
2454
+ reason: z.ZodEnum<["no-abi", "version-mismatch", "opaque-result"]>;
2455
+ }, "strip", z.ZodTypeAny, {
2456
+ contract: string;
2457
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2458
+ }, {
2459
+ contract: string;
2460
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2461
+ }>, "many">;
2462
+ opaqueScVals: z.ZodArray<z.ZodObject<{
2463
+ path: z.ZodString;
2464
+ type: z.ZodString;
2465
+ }, "strip", z.ZodTypeAny, {
2466
+ type: string;
2467
+ path: string;
2468
+ }, {
2469
+ type: string;
2470
+ path: string;
2471
+ }>, "many">;
2472
+ thresholdUsed: z.ZodNumber;
2473
+ }, "strip", z.ZodTypeAny, {
1478
2474
  opaqueScVals: {
1479
2475
  type: string;
1480
2476
  path: string;
@@ -1486,12 +2482,21 @@ export declare const VerifyPolicyInputSchema: z.ZodObject<{
1486
2482
  overall: number;
1487
2483
  knownContracts: string[];
1488
2484
  thresholdUsed: number;
1489
- };
1490
- } & {
1491
- [k: string]: unknown;
1492
- };
1493
- validUntilLedger?: number | undefined;
1494
- predicate?: unknown;
2485
+ }, {
2486
+ opaqueScVals: {
2487
+ type: string;
2488
+ path: string;
2489
+ }[];
2490
+ unknownContracts: {
2491
+ contract: string;
2492
+ reason: "no-abi" | "version-mismatch" | "opaque-result";
2493
+ }[];
2494
+ overall: number;
2495
+ knownContracts: string[];
2496
+ thresholdUsed: number;
2497
+ }>;
2498
+ sourceAccount: z.ZodString;
2499
+ }, z.ZodTypeAny, "passthrough"> | undefined;
1495
2500
  }>;
1496
2501
  export type VerifyPolicyInput = z.infer<typeof VerifyPolicyInputSchema>;
1497
2502
  /** A rule ALREADY on the account, as the caller observed it. Supplying these
@@ -1634,6 +2639,10 @@ export declare const RPC_URL_BY_NETWORK: Record<Network, string>;
1634
2639
  * these to a user must say so rather than implying we vouch for the code.
1635
2640
  * Provenance detail in `docs/audit/README.md` finding 7. */
1636
2641
  export type OzBuiltinPolicy = 'spending_limit' | 'simple_threshold' | 'weighted_threshold';
2642
+ /** The upstream tag the deployed policy instances were built from. Exported so
2643
+ * `scripts/upstream-drift-check.ts` can compare it against the latest upstream
2644
+ * release; a tag recorded only in prose cannot be checked by anything. */
2645
+ export declare const PINNED_OZ_STELLAR_CONTRACTS_TAG = "v0.7.2";
1637
2646
  /** Instance addresses per network. Exported so consumers import the pin
1638
2647
  * instead of copying a literal - a copied address is how a testnet id ends up
1639
2648
  * being queried against mainnet, which returns `Error(Storage, MissingValue)`
@@ -1739,7 +2748,7 @@ export declare const DeclarePolicyInputSchema: z.ZodObject<{
1739
2748
  } | undefined;
1740
2749
  }>;
1741
2750
  export type DeclarePolicyInput = z.infer<typeof DeclarePolicyInputSchema>;
1742
- export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2751
+ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
1743
2752
  /** Rules already on the account. Supplying them turns on the cross-rule
1744
2753
  * authority scan, which reports every existing rule a signer of this
1745
2754
  * install could name INSTEAD - including an unpoliced one, against which
@@ -1782,42 +2791,644 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1782
2791
  address: string;
1783
2792
  kind: "delegated";
1784
2793
  }>, z.ZodObject<{
1785
- kind: z.ZodLiteral<"external">;
1786
- verifier: z.ZodString;
1787
- keyBytes: z.ZodString;
2794
+ kind: z.ZodLiteral<"external">;
2795
+ verifier: z.ZodString;
2796
+ keyBytes: z.ZodString;
2797
+ }, "strip", z.ZodTypeAny, {
2798
+ kind: "external";
2799
+ verifier: string;
2800
+ keyBytes: string;
2801
+ }, {
2802
+ kind: "external";
2803
+ verifier: string;
2804
+ keyBytes: string;
2805
+ }>]>, "many">;
2806
+ policyAddresses: z.ZodArray<z.ZodString, "many">;
2807
+ predicate: z.ZodOptional<z.ZodType<unknown, z.ZodTypeDef, unknown>>;
2808
+ }, "strip", z.ZodTypeAny, {
2809
+ signers: ({
2810
+ address: string;
2811
+ kind: "delegated";
2812
+ } | {
2813
+ kind: "external";
2814
+ verifier: string;
2815
+ keyBytes: string;
2816
+ })[];
2817
+ id: number;
2818
+ policyAddresses: string[];
2819
+ contextType: {
2820
+ kind: "default";
2821
+ } | {
2822
+ kind: "call_contract";
2823
+ contract: string;
2824
+ } | {
2825
+ kind: "create_contract";
2826
+ wasmHash: string;
2827
+ };
2828
+ predicate?: unknown;
2829
+ }, {
2830
+ signers: ({
2831
+ address: string;
2832
+ kind: "delegated";
2833
+ } | {
2834
+ kind: "external";
2835
+ verifier: string;
2836
+ keyBytes: string;
2837
+ })[];
2838
+ id: number;
2839
+ policyAddresses: string[];
2840
+ contextType: {
2841
+ kind: "default";
2842
+ } | {
2843
+ kind: "call_contract";
2844
+ contract: string;
2845
+ } | {
2846
+ kind: "create_contract";
2847
+ wasmHash: string;
2848
+ };
2849
+ predicate?: unknown;
2850
+ }>, "many">>;
2851
+ /** The smart account contract address (C...) that will receive the rule. */
2852
+ smartAccount: z.ZodString;
2853
+ /** The signer that authorises the install (G... wallet). Used only for
2854
+ * sequence number + auth nonce simulation; never persisted, never signed. */
2855
+ sourceAccount: z.ZodString;
2856
+ /** Target network for the install. Selects which interpreter pin and
2857
+ * which RPC URL are valid by default. Defaults to `testnet` so the
2858
+ * pre-mainnet callers keep working: they were always pointing at
2859
+ * the testnet pin, so defaulting testnet here is the conservative
2860
+ * continuation, NOT a silent fall-through that bypasses the gate.
2861
+ * A caller that targets mainnet MUST set this to `mainnet` (the
2862
+ * pin and RPC pin do not move by themselves). */
2863
+ network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
2864
+ /** The proposed rule draft. Mirrors the core `ContextRuleDraft` shape.
2865
+ *
2866
+ * Optional because of `fromHash` below. An agent cannot reliably retype the
2867
+ * `contextRule` that `synthesize_policy` returned - it is nested, and the
2868
+ * observed failures were exactly that: `validUntilLedger` sent as a string,
2869
+ * `signers` as "", `policies` as an object instead of an array. Supplying
2870
+ * `fromHash` instead lets the server rebuild the same rule it just
2871
+ * produced, rather than asking the caller to transcribe it. */
2872
+ rule: z.ZodOptional<z.ZodEffects<z.ZodObject<{
2873
+ contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2874
+ kind: z.ZodLiteral<"default">;
2875
+ }, "strip", z.ZodTypeAny, {
2876
+ kind: "default";
2877
+ }, {
2878
+ kind: "default";
2879
+ }>, z.ZodObject<{
2880
+ kind: z.ZodLiteral<"call_contract">;
2881
+ contract: z.ZodString;
2882
+ }, "strip", z.ZodTypeAny, {
2883
+ kind: "call_contract";
2884
+ contract: string;
2885
+ }, {
2886
+ kind: "call_contract";
2887
+ contract: string;
2888
+ }>, z.ZodObject<{
2889
+ kind: z.ZodLiteral<"create_contract">;
2890
+ wasmHash: z.ZodString;
2891
+ }, "strip", z.ZodTypeAny, {
2892
+ kind: "create_contract";
2893
+ wasmHash: string;
2894
+ }, {
2895
+ kind: "create_contract";
2896
+ wasmHash: string;
2897
+ }>]>;
2898
+ name: z.ZodString;
2899
+ validUntilLedger: z.ZodNullable<z.ZodNumber>;
2900
+ signers: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2901
+ kind: z.ZodLiteral<"delegated">;
2902
+ address: z.ZodString;
2903
+ }, "strip", z.ZodTypeAny, {
2904
+ address: string;
2905
+ kind: "delegated";
2906
+ }, {
2907
+ address: string;
2908
+ kind: "delegated";
2909
+ }>, z.ZodObject<{
2910
+ kind: z.ZodLiteral<"external">;
2911
+ verifier: z.ZodString;
2912
+ keyBytes: z.ZodString;
2913
+ }, "strip", z.ZodTypeAny, {
2914
+ kind: "external";
2915
+ verifier: string;
2916
+ keyBytes: string;
2917
+ }, {
2918
+ kind: "external";
2919
+ verifier: string;
2920
+ keyBytes: string;
2921
+ }>]>, "many">;
2922
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
2923
+ * an OpenZeppelin built-in can sit together and both must permit. That
2924
+ * pairing is what expresses a rolling total: the predicate bounds each
2925
+ * call, the built-in bounds the sum across calls. */
2926
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2927
+ kind: z.ZodLiteral<"interpreter">;
2928
+ interpreterAddress: z.ZodString;
2929
+ predicateBlobBase64: z.ZodString;
2930
+ }, "strip", z.ZodTypeAny, {
2931
+ kind: "interpreter";
2932
+ interpreterAddress: string;
2933
+ predicateBlobBase64: string;
2934
+ }, {
2935
+ kind: "interpreter";
2936
+ interpreterAddress: string;
2937
+ predicateBlobBase64: string;
2938
+ }>, z.ZodObject<{
2939
+ kind: z.ZodLiteral<"spending_limit">;
2940
+ policyAddress: z.ZodString;
2941
+ /** LEDGERS, not seconds. */
2942
+ periodLedgers: z.ZodNumber;
2943
+ spendingLimit: z.ZodString;
2944
+ }, "strip", z.ZodTypeAny, {
2945
+ kind: "spending_limit";
2946
+ spendingLimit: string;
2947
+ periodLedgers: number;
2948
+ policyAddress: string;
2949
+ }, {
2950
+ kind: "spending_limit";
2951
+ spendingLimit: string;
2952
+ periodLedgers: number;
2953
+ policyAddress: string;
2954
+ }>]>, "many">;
2955
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2956
+ contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2957
+ kind: z.ZodLiteral<"default">;
2958
+ }, "strip", z.ZodTypeAny, {
2959
+ kind: "default";
2960
+ }, {
2961
+ kind: "default";
2962
+ }>, z.ZodObject<{
2963
+ kind: z.ZodLiteral<"call_contract">;
2964
+ contract: z.ZodString;
2965
+ }, "strip", z.ZodTypeAny, {
2966
+ kind: "call_contract";
2967
+ contract: string;
2968
+ }, {
2969
+ kind: "call_contract";
2970
+ contract: string;
2971
+ }>, z.ZodObject<{
2972
+ kind: z.ZodLiteral<"create_contract">;
2973
+ wasmHash: z.ZodString;
2974
+ }, "strip", z.ZodTypeAny, {
2975
+ kind: "create_contract";
2976
+ wasmHash: string;
2977
+ }, {
2978
+ kind: "create_contract";
2979
+ wasmHash: string;
2980
+ }>]>;
2981
+ name: z.ZodString;
2982
+ validUntilLedger: z.ZodNullable<z.ZodNumber>;
2983
+ signers: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2984
+ kind: z.ZodLiteral<"delegated">;
2985
+ address: z.ZodString;
2986
+ }, "strip", z.ZodTypeAny, {
2987
+ address: string;
2988
+ kind: "delegated";
2989
+ }, {
2990
+ address: string;
2991
+ kind: "delegated";
2992
+ }>, z.ZodObject<{
2993
+ kind: z.ZodLiteral<"external">;
2994
+ verifier: z.ZodString;
2995
+ keyBytes: z.ZodString;
2996
+ }, "strip", z.ZodTypeAny, {
2997
+ kind: "external";
2998
+ verifier: string;
2999
+ keyBytes: string;
3000
+ }, {
3001
+ kind: "external";
3002
+ verifier: string;
3003
+ keyBytes: string;
3004
+ }>]>, "many">;
3005
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3006
+ * an OpenZeppelin built-in can sit together and both must permit. That
3007
+ * pairing is what expresses a rolling total: the predicate bounds each
3008
+ * call, the built-in bounds the sum across calls. */
3009
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3010
+ kind: z.ZodLiteral<"interpreter">;
3011
+ interpreterAddress: z.ZodString;
3012
+ predicateBlobBase64: z.ZodString;
3013
+ }, "strip", z.ZodTypeAny, {
3014
+ kind: "interpreter";
3015
+ interpreterAddress: string;
3016
+ predicateBlobBase64: string;
3017
+ }, {
3018
+ kind: "interpreter";
3019
+ interpreterAddress: string;
3020
+ predicateBlobBase64: string;
3021
+ }>, z.ZodObject<{
3022
+ kind: z.ZodLiteral<"spending_limit">;
3023
+ policyAddress: z.ZodString;
3024
+ /** LEDGERS, not seconds. */
3025
+ periodLedgers: z.ZodNumber;
3026
+ spendingLimit: z.ZodString;
3027
+ }, "strip", z.ZodTypeAny, {
3028
+ kind: "spending_limit";
3029
+ spendingLimit: string;
3030
+ periodLedgers: number;
3031
+ policyAddress: string;
3032
+ }, {
3033
+ kind: "spending_limit";
3034
+ spendingLimit: string;
3035
+ periodLedgers: number;
3036
+ policyAddress: string;
3037
+ }>]>, "many">;
3038
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3039
+ contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3040
+ kind: z.ZodLiteral<"default">;
3041
+ }, "strip", z.ZodTypeAny, {
3042
+ kind: "default";
3043
+ }, {
3044
+ kind: "default";
3045
+ }>, z.ZodObject<{
3046
+ kind: z.ZodLiteral<"call_contract">;
3047
+ contract: z.ZodString;
3048
+ }, "strip", z.ZodTypeAny, {
3049
+ kind: "call_contract";
3050
+ contract: string;
3051
+ }, {
3052
+ kind: "call_contract";
3053
+ contract: string;
3054
+ }>, z.ZodObject<{
3055
+ kind: z.ZodLiteral<"create_contract">;
3056
+ wasmHash: z.ZodString;
3057
+ }, "strip", z.ZodTypeAny, {
3058
+ kind: "create_contract";
3059
+ wasmHash: string;
3060
+ }, {
3061
+ kind: "create_contract";
3062
+ wasmHash: string;
3063
+ }>]>;
3064
+ name: z.ZodString;
3065
+ validUntilLedger: z.ZodNullable<z.ZodNumber>;
3066
+ signers: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3067
+ kind: z.ZodLiteral<"delegated">;
3068
+ address: z.ZodString;
3069
+ }, "strip", z.ZodTypeAny, {
3070
+ address: string;
3071
+ kind: "delegated";
3072
+ }, {
3073
+ address: string;
3074
+ kind: "delegated";
3075
+ }>, z.ZodObject<{
3076
+ kind: z.ZodLiteral<"external">;
3077
+ verifier: z.ZodString;
3078
+ keyBytes: z.ZodString;
3079
+ }, "strip", z.ZodTypeAny, {
3080
+ kind: "external";
3081
+ verifier: string;
3082
+ keyBytes: string;
3083
+ }, {
3084
+ kind: "external";
3085
+ verifier: string;
3086
+ keyBytes: string;
3087
+ }>]>, "many">;
3088
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3089
+ * an OpenZeppelin built-in can sit together and both must permit. That
3090
+ * pairing is what expresses a rolling total: the predicate bounds each
3091
+ * call, the built-in bounds the sum across calls. */
3092
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3093
+ kind: z.ZodLiteral<"interpreter">;
3094
+ interpreterAddress: z.ZodString;
3095
+ predicateBlobBase64: z.ZodString;
3096
+ }, "strip", z.ZodTypeAny, {
3097
+ kind: "interpreter";
3098
+ interpreterAddress: string;
3099
+ predicateBlobBase64: string;
3100
+ }, {
3101
+ kind: "interpreter";
3102
+ interpreterAddress: string;
3103
+ predicateBlobBase64: string;
3104
+ }>, z.ZodObject<{
3105
+ kind: z.ZodLiteral<"spending_limit">;
3106
+ policyAddress: z.ZodString;
3107
+ /** LEDGERS, not seconds. */
3108
+ periodLedgers: z.ZodNumber;
3109
+ spendingLimit: z.ZodString;
3110
+ }, "strip", z.ZodTypeAny, {
3111
+ kind: "spending_limit";
3112
+ spendingLimit: string;
3113
+ periodLedgers: number;
3114
+ policyAddress: string;
3115
+ }, {
3116
+ kind: "spending_limit";
3117
+ spendingLimit: string;
3118
+ periodLedgers: number;
3119
+ policyAddress: string;
3120
+ }>]>, "many">;
3121
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
3122
+ contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3123
+ kind: z.ZodLiteral<"default">;
3124
+ }, "strip", z.ZodTypeAny, {
3125
+ kind: "default";
3126
+ }, {
3127
+ kind: "default";
3128
+ }>, z.ZodObject<{
3129
+ kind: z.ZodLiteral<"call_contract">;
3130
+ contract: z.ZodString;
3131
+ }, "strip", z.ZodTypeAny, {
3132
+ kind: "call_contract";
3133
+ contract: string;
3134
+ }, {
3135
+ kind: "call_contract";
3136
+ contract: string;
3137
+ }>, z.ZodObject<{
3138
+ kind: z.ZodLiteral<"create_contract">;
3139
+ wasmHash: z.ZodString;
3140
+ }, "strip", z.ZodTypeAny, {
3141
+ kind: "create_contract";
3142
+ wasmHash: string;
3143
+ }, {
3144
+ kind: "create_contract";
3145
+ wasmHash: string;
3146
+ }>]>;
3147
+ name: z.ZodString;
3148
+ validUntilLedger: z.ZodNullable<z.ZodNumber>;
3149
+ signers: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3150
+ kind: z.ZodLiteral<"delegated">;
3151
+ address: z.ZodString;
3152
+ }, "strip", z.ZodTypeAny, {
3153
+ address: string;
3154
+ kind: "delegated";
3155
+ }, {
3156
+ address: string;
3157
+ kind: "delegated";
3158
+ }>, z.ZodObject<{
3159
+ kind: z.ZodLiteral<"external">;
3160
+ verifier: z.ZodString;
3161
+ keyBytes: z.ZodString;
3162
+ }, "strip", z.ZodTypeAny, {
3163
+ kind: "external";
3164
+ verifier: string;
3165
+ keyBytes: string;
3166
+ }, {
3167
+ kind: "external";
3168
+ verifier: string;
3169
+ keyBytes: string;
3170
+ }>]>, "many">;
3171
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3172
+ * an OpenZeppelin built-in can sit together and both must permit. That
3173
+ * pairing is what expresses a rolling total: the predicate bounds each
3174
+ * call, the built-in bounds the sum across calls. */
3175
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3176
+ kind: z.ZodLiteral<"interpreter">;
3177
+ interpreterAddress: z.ZodString;
3178
+ predicateBlobBase64: z.ZodString;
3179
+ }, "strip", z.ZodTypeAny, {
3180
+ kind: "interpreter";
3181
+ interpreterAddress: string;
3182
+ predicateBlobBase64: string;
3183
+ }, {
3184
+ kind: "interpreter";
3185
+ interpreterAddress: string;
3186
+ predicateBlobBase64: string;
3187
+ }>, z.ZodObject<{
3188
+ kind: z.ZodLiteral<"spending_limit">;
3189
+ policyAddress: z.ZodString;
3190
+ /** LEDGERS, not seconds. */
3191
+ periodLedgers: z.ZodNumber;
3192
+ spendingLimit: z.ZodString;
3193
+ }, "strip", z.ZodTypeAny, {
3194
+ kind: "spending_limit";
3195
+ spendingLimit: string;
3196
+ periodLedgers: number;
3197
+ policyAddress: string;
3198
+ }, {
3199
+ kind: "spending_limit";
3200
+ spendingLimit: string;
3201
+ periodLedgers: number;
3202
+ policyAddress: string;
3203
+ }>]>, "many">;
3204
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3205
+ contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3206
+ kind: z.ZodLiteral<"default">;
3207
+ }, "strip", z.ZodTypeAny, {
3208
+ kind: "default";
3209
+ }, {
3210
+ kind: "default";
3211
+ }>, z.ZodObject<{
3212
+ kind: z.ZodLiteral<"call_contract">;
3213
+ contract: z.ZodString;
3214
+ }, "strip", z.ZodTypeAny, {
3215
+ kind: "call_contract";
3216
+ contract: string;
3217
+ }, {
3218
+ kind: "call_contract";
3219
+ contract: string;
3220
+ }>, z.ZodObject<{
3221
+ kind: z.ZodLiteral<"create_contract">;
3222
+ wasmHash: z.ZodString;
3223
+ }, "strip", z.ZodTypeAny, {
3224
+ kind: "create_contract";
3225
+ wasmHash: string;
3226
+ }, {
3227
+ kind: "create_contract";
3228
+ wasmHash: string;
3229
+ }>]>;
3230
+ name: z.ZodString;
3231
+ validUntilLedger: z.ZodNullable<z.ZodNumber>;
3232
+ signers: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3233
+ kind: z.ZodLiteral<"delegated">;
3234
+ address: z.ZodString;
3235
+ }, "strip", z.ZodTypeAny, {
3236
+ address: string;
3237
+ kind: "delegated";
3238
+ }, {
3239
+ address: string;
3240
+ kind: "delegated";
3241
+ }>, z.ZodObject<{
3242
+ kind: z.ZodLiteral<"external">;
3243
+ verifier: z.ZodString;
3244
+ keyBytes: z.ZodString;
3245
+ }, "strip", z.ZodTypeAny, {
3246
+ kind: "external";
3247
+ verifier: string;
3248
+ keyBytes: string;
3249
+ }, {
3250
+ kind: "external";
3251
+ verifier: string;
3252
+ keyBytes: string;
3253
+ }>]>, "many">;
3254
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3255
+ * an OpenZeppelin built-in can sit together and both must permit. That
3256
+ * pairing is what expresses a rolling total: the predicate bounds each
3257
+ * call, the built-in bounds the sum across calls. */
3258
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3259
+ kind: z.ZodLiteral<"interpreter">;
3260
+ interpreterAddress: z.ZodString;
3261
+ predicateBlobBase64: z.ZodString;
3262
+ }, "strip", z.ZodTypeAny, {
3263
+ kind: "interpreter";
3264
+ interpreterAddress: string;
3265
+ predicateBlobBase64: string;
3266
+ }, {
3267
+ kind: "interpreter";
3268
+ interpreterAddress: string;
3269
+ predicateBlobBase64: string;
3270
+ }>, z.ZodObject<{
3271
+ kind: z.ZodLiteral<"spending_limit">;
3272
+ policyAddress: z.ZodString;
3273
+ /** LEDGERS, not seconds. */
3274
+ periodLedgers: z.ZodNumber;
3275
+ spendingLimit: z.ZodString;
1788
3276
  }, "strip", z.ZodTypeAny, {
1789
- kind: "external";
1790
- verifier: string;
1791
- keyBytes: string;
3277
+ kind: "spending_limit";
3278
+ spendingLimit: string;
3279
+ periodLedgers: number;
3280
+ policyAddress: string;
1792
3281
  }, {
1793
- kind: "external";
1794
- verifier: string;
1795
- keyBytes: string;
3282
+ kind: "spending_limit";
3283
+ spendingLimit: string;
3284
+ periodLedgers: number;
3285
+ policyAddress: string;
1796
3286
  }>]>, "many">;
1797
- policyAddresses: z.ZodArray<z.ZodString, "many">;
1798
- predicate: z.ZodOptional<z.ZodType<unknown, z.ZodTypeDef, unknown>>;
3287
+ }, z.ZodTypeAny, "passthrough">>>;
3288
+ /** Build the rule here instead of receiving it: record this transaction,
3289
+ * synthesize against `smartAccount`, and install the result. The
3290
+ * agent-friendly counterpart to `rule`, and the same handle
3291
+ * `synthesize_policy` accepts. */
3292
+ fromHash: z.ZodOptional<z.ZodObject<{
3293
+ transactionHash: z.ZodString;
3294
+ /** The keys this rule governs. Synthesis cannot choose them: it reads a
3295
+ * transaction, and which keys a rule binds is the caller's security
3296
+ * decision, not an inference from one recording. Naming a key here
3297
+ * attaches it as a delegated signer. A rule with no signer is refused
3298
+ * on chain, so this is required in practice; the `rule` form remains
3299
+ * the way to attach an external (verifier + key bytes) signer. */
3300
+ signers: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
3301
+ userResponses: z.ZodOptional<z.ZodObject<{
3302
+ validUntilLedger: z.ZodOptional<z.ZodNumber>;
3303
+ limitAmount: z.ZodOptional<z.ZodString>;
3304
+ swapRecipientAllowlist: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
3305
+ }, "strict", z.ZodTypeAny, {
3306
+ limitAmount?: string | undefined;
3307
+ validUntilLedger?: number | undefined;
3308
+ swapRecipientAllowlist?: string[] | undefined;
3309
+ }, {
3310
+ limitAmount?: string | undefined;
3311
+ validUntilLedger?: number | undefined;
3312
+ swapRecipientAllowlist?: string[] | undefined;
3313
+ }>>;
1799
3314
  }, "strip", z.ZodTypeAny, {
1800
- signers: ({
1801
- address: string;
1802
- kind: "delegated";
1803
- } | {
1804
- kind: "external";
1805
- verifier: string;
1806
- keyBytes: string;
1807
- })[];
1808
- id: number;
1809
- policyAddresses: string[];
1810
- contextType: {
1811
- kind: "default";
1812
- } | {
1813
- kind: "call_contract";
1814
- contract: string;
1815
- } | {
1816
- kind: "create_contract";
1817
- wasmHash: string;
1818
- };
1819
- predicate?: unknown;
3315
+ transactionHash: string;
3316
+ signers?: string[] | undefined;
3317
+ userResponses?: {
3318
+ limitAmount?: string | undefined;
3319
+ validUntilLedger?: number | undefined;
3320
+ swapRecipientAllowlist?: string[] | undefined;
3321
+ } | undefined;
3322
+ }, {
3323
+ transactionHash: string;
3324
+ signers?: string[] | undefined;
3325
+ userResponses?: {
3326
+ limitAmount?: string | undefined;
3327
+ validUntilLedger?: number | undefined;
3328
+ swapRecipientAllowlist?: string[] | undefined;
3329
+ } | undefined;
3330
+ }>>;
3331
+ /** Install a predicate the caller ALREADY holds - the base64 string
3332
+ * `declare_policy` returns.
3333
+ *
3334
+ * Without this there is no route from `declare_policy` to here:
3335
+ * `fromHash` re-synthesizes from a recording and would discard the
3336
+ * declared predicate, and `rule` means hand-building a draft that the
3337
+ * tool boundary types as `unknown`, so the caller is guessing. An agent
3338
+ * asked to do that invented a requirement to deploy a signer contract,
3339
+ * which is not a thing - a delegated signer is a plain account address.
3340
+ *
3341
+ * The context rule type is taken FROM the predicate: if it pins a
3342
+ * contract, the rule is scoped to that contract. One source of truth, so
3343
+ * the rule's scope cannot drift from what the predicate actually checks. */
3344
+ fromPredicate: z.ZodOptional<z.ZodObject<{
3345
+ encodedPredicate: z.ZodString;
3346
+ /** The keys this rule governs, as plain Stellar account addresses. */
3347
+ signers: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
3348
+ name: z.ZodOptional<z.ZodString>;
3349
+ validUntilLedger: z.ZodOptional<z.ZodNumber>;
3350
+ }, "strip", z.ZodTypeAny, {
3351
+ signers: string[];
3352
+ encodedPredicate: string;
3353
+ validUntilLedger?: number | undefined;
3354
+ name?: string | undefined;
3355
+ }, {
3356
+ signers: string[];
3357
+ encodedPredicate: string;
3358
+ validUntilLedger?: number | undefined;
3359
+ name?: string | undefined;
3360
+ }>>;
3361
+ /** Per-rule install nonce. Defaults to 1, which is the only correct value
3362
+ * here: this tool builds `add_context_rule`, the account assigns a NEW
3363
+ * rule id, and the interpreter has no stored nonce for a rule that does
3364
+ * not exist yet. Required, it was undiscoverable - an agent has no way to
3365
+ * read it, and asking cost a round trip on a value the server already
3366
+ * knows. Supply it only to re-install over an existing rule, where the
3367
+ * interpreter wants `stored_nonce + 1`. */
3368
+ installNonce: z.ZodOptional<z.ZodNumber>;
3369
+ /** Optional RPC URL override. Defaults to the pinned RPC for the
3370
+ * selected `network` (testnet by default, mainnet when
3371
+ * `network: 'mainnet'`); the override is refused unless
3372
+ * `allowUnpinnedRpcUrl: true`, because the auth nonce and
3373
+ * rootInvocation in the response come from whichever RPC answered. */
3374
+ rpcUrl: z.ZodOptional<z.ZodString>;
3375
+ /** Opt-in to using a non-pinned RPC URL. Without this flag the tool
3376
+ * refuses any `rpcUrl` other than the pinned RPC for the selected
3377
+ * network because the caller's auth-digest binds to whatever the
3378
+ * RPC returned. */
3379
+ allowUnpinnedRpcUrl: z.ZodOptional<z.ZodBoolean>;
3380
+ /** Attach an OpenZeppelin `spending_limit` beside the predicate, giving the
3381
+ * rule a ROLLING TOTAL as well as a per-call bound. Both must permit,
3382
+ * because policies on one rule compose as all-of.
3383
+ *
3384
+ * This is the only way to express "N per day": the interpreter is handed
3385
+ * one call and keeps no state, so a predicate cannot add up spending
3386
+ * across calls. Composes with all three ways of naming the rule.
3387
+ *
3388
+ * The primitive meters the third argument of a call named exactly
3389
+ * `transfer` and requires a `call_contract` rule scope, so the rule must
3390
+ * be pinned to the token whose transfers it meters. */
3391
+ spendingLimit: z.ZodOptional<z.ZodObject<{
3392
+ /** Rolling total in the token's smallest unit. */
3393
+ amount: z.ZodString;
3394
+ /** Window length in LEDGERS. Stellar closes one in roughly five
3395
+ * seconds, so a period in seconds is an approximation of this. */
3396
+ periodLedgers: z.ZodNumber;
3397
+ }, "strip", z.ZodTypeAny, {
3398
+ amount: string;
3399
+ periodLedgers: number;
1820
3400
  }, {
3401
+ amount: string;
3402
+ periodLedgers: number;
3403
+ }>>;
3404
+ /** Opt-in to installing a rule that bounds no amount, when the recording
3405
+ * behind `fromHash` showed a spend.
3406
+ *
3407
+ * Default-deny, because the failure is silent and reads as success: such
3408
+ * a rule installs cleanly, verifies cleanly - a missing constraint
3409
+ * generates no deny case to fail - and caps nothing. That combination
3410
+ * reached the chain once already. A rule with no spend to bound is
3411
+ * unaffected; only the case the synthesizer explicitly flagged is
3412
+ * refused. */
3413
+ allowUnboundedAmount: z.ZodOptional<z.ZodBoolean>;
3414
+ /** Opt-in to pointing the rule's interpreter policy at any address
3415
+ * other than the pinned interpreter for the selected network.
3416
+ * Default-deny: a caller that controls the interpreter can permit
3417
+ * everything. Selecting `network: 'mainnet'` is NOT an opt-in -
3418
+ * the mainnet pin is its own deny-by-default anchor. */
3419
+ allowUnpinnedInterpreter: z.ZodOptional<z.ZodBoolean>;
3420
+ /** Base fee in stroops; defaults to BASE_FEE (100). */
3421
+ baseFee: z.ZodOptional<z.ZodNumber>;
3422
+ }, "strip", z.ZodTypeAny, {
3423
+ smartAccount: string;
3424
+ sourceAccount: string;
3425
+ installNonce?: number | undefined;
3426
+ spendingLimit?: {
3427
+ amount: string;
3428
+ periodLedgers: number;
3429
+ } | undefined;
3430
+ network?: "mainnet" | "testnet" | undefined;
3431
+ existingRules?: {
1821
3432
  signers: ({
1822
3433
  address: string;
1823
3434
  kind: "delegated";
@@ -1838,22 +3449,8 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1838
3449
  wasmHash: string;
1839
3450
  };
1840
3451
  predicate?: unknown;
1841
- }>, "many">>;
1842
- /** The smart account contract address (C...) that will receive the rule. */
1843
- smartAccount: z.ZodString;
1844
- /** The signer that authorises the install (G... wallet). Used only for
1845
- * sequence number + auth nonce simulation; never persisted, never signed. */
1846
- sourceAccount: z.ZodString;
1847
- /** Target network for the install. Selects which interpreter pin and
1848
- * which RPC URL are valid by default. Defaults to `testnet` so the
1849
- * pre-mainnet callers keep working: they were always pointing at
1850
- * the testnet pin, so defaulting testnet here is the conservative
1851
- * continuation, NOT a silent fall-through that bypasses the gate.
1852
- * A caller that targets mainnet MUST set this to `mainnet` (the
1853
- * pin and RPC pin do not move by themselves). */
1854
- network: z.ZodOptional<z.ZodEnum<["mainnet", "testnet"]>>;
1855
- /** The proposed rule draft. Mirrors the core `ContextRuleDraft` shape. */
1856
- rule: z.ZodEffects<z.ZodObject<{
3452
+ }[] | undefined;
3453
+ rule?: z.objectOutputType<{
1857
3454
  contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1858
3455
  kind: z.ZodLiteral<"default">;
1859
3456
  }, "strip", z.ZodTypeAny, {
@@ -1903,7 +3500,11 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1903
3500
  verifier: string;
1904
3501
  keyBytes: string;
1905
3502
  }>]>, "many">;
1906
- policies: z.ZodArray<z.ZodObject<{
3503
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3504
+ * an OpenZeppelin built-in can sit together and both must permit. That
3505
+ * pairing is what expresses a rolling total: the predicate bounds each
3506
+ * call, the built-in bounds the sum across calls. */
3507
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1907
3508
  kind: z.ZodLiteral<"interpreter">;
1908
3509
  interpreterAddress: z.ZodString;
1909
3510
  predicateBlobBase64: z.ZodString;
@@ -1915,8 +3516,76 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1915
3516
  kind: "interpreter";
1916
3517
  interpreterAddress: string;
1917
3518
  predicateBlobBase64: string;
1918
- }>, "many">;
1919
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3519
+ }>, z.ZodObject<{
3520
+ kind: z.ZodLiteral<"spending_limit">;
3521
+ policyAddress: z.ZodString;
3522
+ /** LEDGERS, not seconds. */
3523
+ periodLedgers: z.ZodNumber;
3524
+ spendingLimit: z.ZodString;
3525
+ }, "strip", z.ZodTypeAny, {
3526
+ kind: "spending_limit";
3527
+ spendingLimit: string;
3528
+ periodLedgers: number;
3529
+ policyAddress: string;
3530
+ }, {
3531
+ kind: "spending_limit";
3532
+ spendingLimit: string;
3533
+ periodLedgers: number;
3534
+ policyAddress: string;
3535
+ }>]>, "many">;
3536
+ }, z.ZodTypeAny, "passthrough"> | undefined;
3537
+ fromHash?: {
3538
+ transactionHash: string;
3539
+ signers?: string[] | undefined;
3540
+ userResponses?: {
3541
+ limitAmount?: string | undefined;
3542
+ validUntilLedger?: number | undefined;
3543
+ swapRecipientAllowlist?: string[] | undefined;
3544
+ } | undefined;
3545
+ } | undefined;
3546
+ fromPredicate?: {
3547
+ signers: string[];
3548
+ encodedPredicate: string;
3549
+ validUntilLedger?: number | undefined;
3550
+ name?: string | undefined;
3551
+ } | undefined;
3552
+ rpcUrl?: string | undefined;
3553
+ allowUnpinnedRpcUrl?: boolean | undefined;
3554
+ allowUnboundedAmount?: boolean | undefined;
3555
+ allowUnpinnedInterpreter?: boolean | undefined;
3556
+ baseFee?: number | undefined;
3557
+ }, {
3558
+ smartAccount: string;
3559
+ sourceAccount: string;
3560
+ installNonce?: number | undefined;
3561
+ spendingLimit?: {
3562
+ amount: string;
3563
+ periodLedgers: number;
3564
+ } | undefined;
3565
+ network?: "mainnet" | "testnet" | undefined;
3566
+ existingRules?: {
3567
+ signers: ({
3568
+ address: string;
3569
+ kind: "delegated";
3570
+ } | {
3571
+ kind: "external";
3572
+ verifier: string;
3573
+ keyBytes: string;
3574
+ })[];
3575
+ id: number;
3576
+ policyAddresses: string[];
3577
+ contextType: {
3578
+ kind: "default";
3579
+ } | {
3580
+ kind: "call_contract";
3581
+ contract: string;
3582
+ } | {
3583
+ kind: "create_contract";
3584
+ wasmHash: string;
3585
+ };
3586
+ predicate?: unknown;
3587
+ }[] | undefined;
3588
+ rule?: z.objectInputType<{
1920
3589
  contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1921
3590
  kind: z.ZodLiteral<"default">;
1922
3591
  }, "strip", z.ZodTypeAny, {
@@ -1966,7 +3635,11 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1966
3635
  verifier: string;
1967
3636
  keyBytes: string;
1968
3637
  }>]>, "many">;
1969
- policies: z.ZodArray<z.ZodObject<{
3638
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3639
+ * an OpenZeppelin built-in can sit together and both must permit. That
3640
+ * pairing is what expresses a rolling total: the predicate bounds each
3641
+ * call, the built-in bounds the sum across calls. */
3642
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1970
3643
  kind: z.ZodLiteral<"interpreter">;
1971
3644
  interpreterAddress: z.ZodString;
1972
3645
  predicateBlobBase64: z.ZodString;
@@ -1978,8 +3651,76 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
1978
3651
  kind: "interpreter";
1979
3652
  interpreterAddress: string;
1980
3653
  predicateBlobBase64: string;
1981
- }>, "many">;
1982
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3654
+ }>, z.ZodObject<{
3655
+ kind: z.ZodLiteral<"spending_limit">;
3656
+ policyAddress: z.ZodString;
3657
+ /** LEDGERS, not seconds. */
3658
+ periodLedgers: z.ZodNumber;
3659
+ spendingLimit: z.ZodString;
3660
+ }, "strip", z.ZodTypeAny, {
3661
+ kind: "spending_limit";
3662
+ spendingLimit: string;
3663
+ periodLedgers: number;
3664
+ policyAddress: string;
3665
+ }, {
3666
+ kind: "spending_limit";
3667
+ spendingLimit: string;
3668
+ periodLedgers: number;
3669
+ policyAddress: string;
3670
+ }>]>, "many">;
3671
+ }, z.ZodTypeAny, "passthrough"> | undefined;
3672
+ fromHash?: {
3673
+ transactionHash: string;
3674
+ signers?: string[] | undefined;
3675
+ userResponses?: {
3676
+ limitAmount?: string | undefined;
3677
+ validUntilLedger?: number | undefined;
3678
+ swapRecipientAllowlist?: string[] | undefined;
3679
+ } | undefined;
3680
+ } | undefined;
3681
+ fromPredicate?: {
3682
+ signers: string[];
3683
+ encodedPredicate: string;
3684
+ validUntilLedger?: number | undefined;
3685
+ name?: string | undefined;
3686
+ } | undefined;
3687
+ rpcUrl?: string | undefined;
3688
+ allowUnpinnedRpcUrl?: boolean | undefined;
3689
+ allowUnboundedAmount?: boolean | undefined;
3690
+ allowUnpinnedInterpreter?: boolean | undefined;
3691
+ baseFee?: number | undefined;
3692
+ }>, {
3693
+ smartAccount: string;
3694
+ sourceAccount: string;
3695
+ installNonce?: number | undefined;
3696
+ spendingLimit?: {
3697
+ amount: string;
3698
+ periodLedgers: number;
3699
+ } | undefined;
3700
+ network?: "mainnet" | "testnet" | undefined;
3701
+ existingRules?: {
3702
+ signers: ({
3703
+ address: string;
3704
+ kind: "delegated";
3705
+ } | {
3706
+ kind: "external";
3707
+ verifier: string;
3708
+ keyBytes: string;
3709
+ })[];
3710
+ id: number;
3711
+ policyAddresses: string[];
3712
+ contextType: {
3713
+ kind: "default";
3714
+ } | {
3715
+ kind: "call_contract";
3716
+ contract: string;
3717
+ } | {
3718
+ kind: "create_contract";
3719
+ wasmHash: string;
3720
+ };
3721
+ predicate?: unknown;
3722
+ }[] | undefined;
3723
+ rule?: z.objectOutputType<{
1983
3724
  contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
1984
3725
  kind: z.ZodLiteral<"default">;
1985
3726
  }, "strip", z.ZodTypeAny, {
@@ -2029,7 +3770,11 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2029
3770
  verifier: string;
2030
3771
  keyBytes: string;
2031
3772
  }>]>, "many">;
2032
- policies: z.ZodArray<z.ZodObject<{
3773
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3774
+ * an OpenZeppelin built-in can sit together and both must permit. That
3775
+ * pairing is what expresses a rolling total: the predicate bounds each
3776
+ * call, the built-in bounds the sum across calls. */
3777
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2033
3778
  kind: z.ZodLiteral<"interpreter">;
2034
3779
  interpreterAddress: z.ZodString;
2035
3780
  predicateBlobBase64: z.ZodString;
@@ -2041,8 +3786,76 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2041
3786
  kind: "interpreter";
2042
3787
  interpreterAddress: string;
2043
3788
  predicateBlobBase64: string;
2044
- }>, "many">;
2045
- }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
3789
+ }>, z.ZodObject<{
3790
+ kind: z.ZodLiteral<"spending_limit">;
3791
+ policyAddress: z.ZodString;
3792
+ /** LEDGERS, not seconds. */
3793
+ periodLedgers: z.ZodNumber;
3794
+ spendingLimit: z.ZodString;
3795
+ }, "strip", z.ZodTypeAny, {
3796
+ kind: "spending_limit";
3797
+ spendingLimit: string;
3798
+ periodLedgers: number;
3799
+ policyAddress: string;
3800
+ }, {
3801
+ kind: "spending_limit";
3802
+ spendingLimit: string;
3803
+ periodLedgers: number;
3804
+ policyAddress: string;
3805
+ }>]>, "many">;
3806
+ }, z.ZodTypeAny, "passthrough"> | undefined;
3807
+ fromHash?: {
3808
+ transactionHash: string;
3809
+ signers?: string[] | undefined;
3810
+ userResponses?: {
3811
+ limitAmount?: string | undefined;
3812
+ validUntilLedger?: number | undefined;
3813
+ swapRecipientAllowlist?: string[] | undefined;
3814
+ } | undefined;
3815
+ } | undefined;
3816
+ fromPredicate?: {
3817
+ signers: string[];
3818
+ encodedPredicate: string;
3819
+ validUntilLedger?: number | undefined;
3820
+ name?: string | undefined;
3821
+ } | undefined;
3822
+ rpcUrl?: string | undefined;
3823
+ allowUnpinnedRpcUrl?: boolean | undefined;
3824
+ allowUnboundedAmount?: boolean | undefined;
3825
+ allowUnpinnedInterpreter?: boolean | undefined;
3826
+ baseFee?: number | undefined;
3827
+ }, {
3828
+ smartAccount: string;
3829
+ sourceAccount: string;
3830
+ installNonce?: number | undefined;
3831
+ spendingLimit?: {
3832
+ amount: string;
3833
+ periodLedgers: number;
3834
+ } | undefined;
3835
+ network?: "mainnet" | "testnet" | undefined;
3836
+ existingRules?: {
3837
+ signers: ({
3838
+ address: string;
3839
+ kind: "delegated";
3840
+ } | {
3841
+ kind: "external";
3842
+ verifier: string;
3843
+ keyBytes: string;
3844
+ })[];
3845
+ id: number;
3846
+ policyAddresses: string[];
3847
+ contextType: {
3848
+ kind: "default";
3849
+ } | {
3850
+ kind: "call_contract";
3851
+ contract: string;
3852
+ } | {
3853
+ kind: "create_contract";
3854
+ wasmHash: string;
3855
+ };
3856
+ predicate?: unknown;
3857
+ }[] | undefined;
3858
+ rule?: z.objectInputType<{
2046
3859
  contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2047
3860
  kind: z.ZodLiteral<"default">;
2048
3861
  }, "strip", z.ZodTypeAny, {
@@ -2092,7 +3905,11 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2092
3905
  verifier: string;
2093
3906
  keyBytes: string;
2094
3907
  }>]>, "many">;
2095
- policies: z.ZodArray<z.ZodObject<{
3908
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
3909
+ * an OpenZeppelin built-in can sit together and both must permit. That
3910
+ * pairing is what expresses a rolling total: the predicate bounds each
3911
+ * call, the built-in bounds the sum across calls. */
3912
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2096
3913
  kind: z.ZodLiteral<"interpreter">;
2097
3914
  interpreterAddress: z.ZodString;
2098
3915
  predicateBlobBase64: z.ZodString;
@@ -2104,8 +3921,76 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2104
3921
  kind: "interpreter";
2105
3922
  interpreterAddress: string;
2106
3923
  predicateBlobBase64: string;
2107
- }>, "many">;
2108
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3924
+ }>, z.ZodObject<{
3925
+ kind: z.ZodLiteral<"spending_limit">;
3926
+ policyAddress: z.ZodString;
3927
+ /** LEDGERS, not seconds. */
3928
+ periodLedgers: z.ZodNumber;
3929
+ spendingLimit: z.ZodString;
3930
+ }, "strip", z.ZodTypeAny, {
3931
+ kind: "spending_limit";
3932
+ spendingLimit: string;
3933
+ periodLedgers: number;
3934
+ policyAddress: string;
3935
+ }, {
3936
+ kind: "spending_limit";
3937
+ spendingLimit: string;
3938
+ periodLedgers: number;
3939
+ policyAddress: string;
3940
+ }>]>, "many">;
3941
+ }, z.ZodTypeAny, "passthrough"> | undefined;
3942
+ fromHash?: {
3943
+ transactionHash: string;
3944
+ signers?: string[] | undefined;
3945
+ userResponses?: {
3946
+ limitAmount?: string | undefined;
3947
+ validUntilLedger?: number | undefined;
3948
+ swapRecipientAllowlist?: string[] | undefined;
3949
+ } | undefined;
3950
+ } | undefined;
3951
+ fromPredicate?: {
3952
+ signers: string[];
3953
+ encodedPredicate: string;
3954
+ validUntilLedger?: number | undefined;
3955
+ name?: string | undefined;
3956
+ } | undefined;
3957
+ rpcUrl?: string | undefined;
3958
+ allowUnpinnedRpcUrl?: boolean | undefined;
3959
+ allowUnboundedAmount?: boolean | undefined;
3960
+ allowUnpinnedInterpreter?: boolean | undefined;
3961
+ baseFee?: number | undefined;
3962
+ }>, {
3963
+ smartAccount: string;
3964
+ sourceAccount: string;
3965
+ installNonce?: number | undefined;
3966
+ spendingLimit?: {
3967
+ amount: string;
3968
+ periodLedgers: number;
3969
+ } | undefined;
3970
+ network?: "mainnet" | "testnet" | undefined;
3971
+ existingRules?: {
3972
+ signers: ({
3973
+ address: string;
3974
+ kind: "delegated";
3975
+ } | {
3976
+ kind: "external";
3977
+ verifier: string;
3978
+ keyBytes: string;
3979
+ })[];
3980
+ id: number;
3981
+ policyAddresses: string[];
3982
+ contextType: {
3983
+ kind: "default";
3984
+ } | {
3985
+ kind: "call_contract";
3986
+ contract: string;
3987
+ } | {
3988
+ kind: "create_contract";
3989
+ wasmHash: string;
3990
+ };
3991
+ predicate?: unknown;
3992
+ }[] | undefined;
3993
+ rule?: z.objectOutputType<{
2109
3994
  contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2110
3995
  kind: z.ZodLiteral<"default">;
2111
3996
  }, "strip", z.ZodTypeAny, {
@@ -2155,7 +4040,11 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2155
4040
  verifier: string;
2156
4041
  keyBytes: string;
2157
4042
  }>]>, "many">;
2158
- policies: z.ZodArray<z.ZodObject<{
4043
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
4044
+ * an OpenZeppelin built-in can sit together and both must permit. That
4045
+ * pairing is what expresses a rolling total: the predicate bounds each
4046
+ * call, the built-in bounds the sum across calls. */
4047
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
2159
4048
  kind: z.ZodLiteral<"interpreter">;
2160
4049
  interpreterAddress: z.ZodString;
2161
4050
  predicateBlobBase64: z.ZodString;
@@ -2167,120 +4056,52 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2167
4056
  kind: "interpreter";
2168
4057
  interpreterAddress: string;
2169
4058
  predicateBlobBase64: string;
2170
- }>, "many">;
2171
- }, z.ZodTypeAny, "passthrough">>;
2172
- /** Per-rule install nonce; 1 for a fresh install. */
2173
- installNonce: z.ZodNumber;
2174
- /** Optional RPC URL override. Defaults to the pinned RPC for the
2175
- * selected `network` (testnet by default, mainnet when
2176
- * `network: 'mainnet'`); the override is refused unless
2177
- * `allowUnpinnedRpcUrl: true`, because the auth nonce and
2178
- * rootInvocation in the response come from whichever RPC answered. */
2179
- rpcUrl: z.ZodOptional<z.ZodString>;
2180
- /** Opt-in to using a non-pinned RPC URL. Without this flag the tool
2181
- * refuses any `rpcUrl` other than the pinned RPC for the selected
2182
- * network because the caller's auth-digest binds to whatever the
2183
- * RPC returned. */
2184
- allowUnpinnedRpcUrl: z.ZodOptional<z.ZodBoolean>;
2185
- /** Opt-in to pointing the rule's interpreter policy at any address
2186
- * other than the pinned interpreter for the selected network.
2187
- * Default-deny: a caller that controls the interpreter can permit
2188
- * everything. Selecting `network: 'mainnet'` is NOT an opt-in -
2189
- * the mainnet pin is its own deny-by-default anchor. */
2190
- allowUnpinnedInterpreter: z.ZodOptional<z.ZodBoolean>;
2191
- /** Base fee in stroops; defaults to BASE_FEE (100). */
2192
- baseFee: z.ZodOptional<z.ZodNumber>;
2193
- }, "strip", z.ZodTypeAny, {
2194
- smartAccount: string;
2195
- sourceAccount: string;
2196
- installNonce: number;
2197
- rule: {
2198
- signers: ({
2199
- address: string;
2200
- kind: "delegated";
2201
- } | {
2202
- kind: "external";
2203
- verifier: string;
2204
- keyBytes: string;
2205
- })[];
2206
- validUntilLedger: number | null;
2207
- contextRuleType: {
2208
- kind: "default";
2209
- } | {
2210
- kind: "call_contract";
2211
- contract: string;
2212
- } | {
2213
- kind: "create_contract";
2214
- wasmHash: string;
2215
- };
2216
- policies: {
2217
- kind: "interpreter";
2218
- interpreterAddress: string;
2219
- predicateBlobBase64: string;
2220
- }[];
2221
- name: string;
2222
- } & {
2223
- [k: string]: unknown;
2224
- };
2225
- network?: "mainnet" | "testnet" | undefined;
2226
- existingRules?: {
2227
- signers: ({
2228
- address: string;
2229
- kind: "delegated";
2230
- } | {
2231
- kind: "external";
2232
- verifier: string;
2233
- keyBytes: string;
2234
- })[];
2235
- id: number;
2236
- policyAddresses: string[];
2237
- contextType: {
2238
- kind: "default";
2239
- } | {
2240
- kind: "call_contract";
2241
- contract: string;
2242
- } | {
2243
- kind: "create_contract";
2244
- wasmHash: string;
2245
- };
2246
- predicate?: unknown;
2247
- }[] | undefined;
4059
+ }>, z.ZodObject<{
4060
+ kind: z.ZodLiteral<"spending_limit">;
4061
+ policyAddress: z.ZodString;
4062
+ /** LEDGERS, not seconds. */
4063
+ periodLedgers: z.ZodNumber;
4064
+ spendingLimit: z.ZodString;
4065
+ }, "strip", z.ZodTypeAny, {
4066
+ kind: "spending_limit";
4067
+ spendingLimit: string;
4068
+ periodLedgers: number;
4069
+ policyAddress: string;
4070
+ }, {
4071
+ kind: "spending_limit";
4072
+ spendingLimit: string;
4073
+ periodLedgers: number;
4074
+ policyAddress: string;
4075
+ }>]>, "many">;
4076
+ }, z.ZodTypeAny, "passthrough"> | undefined;
4077
+ fromHash?: {
4078
+ transactionHash: string;
4079
+ signers?: string[] | undefined;
4080
+ userResponses?: {
4081
+ limitAmount?: string | undefined;
4082
+ validUntilLedger?: number | undefined;
4083
+ swapRecipientAllowlist?: string[] | undefined;
4084
+ } | undefined;
4085
+ } | undefined;
4086
+ fromPredicate?: {
4087
+ signers: string[];
4088
+ encodedPredicate: string;
4089
+ validUntilLedger?: number | undefined;
4090
+ name?: string | undefined;
4091
+ } | undefined;
2248
4092
  rpcUrl?: string | undefined;
2249
4093
  allowUnpinnedRpcUrl?: boolean | undefined;
4094
+ allowUnboundedAmount?: boolean | undefined;
2250
4095
  allowUnpinnedInterpreter?: boolean | undefined;
2251
4096
  baseFee?: number | undefined;
2252
4097
  }, {
2253
4098
  smartAccount: string;
2254
4099
  sourceAccount: string;
2255
- installNonce: number;
2256
- rule: {
2257
- signers: ({
2258
- address: string;
2259
- kind: "delegated";
2260
- } | {
2261
- kind: "external";
2262
- verifier: string;
2263
- keyBytes: string;
2264
- })[];
2265
- validUntilLedger: number | null;
2266
- contextRuleType: {
2267
- kind: "default";
2268
- } | {
2269
- kind: "call_contract";
2270
- contract: string;
2271
- } | {
2272
- kind: "create_contract";
2273
- wasmHash: string;
2274
- };
2275
- policies: {
2276
- kind: "interpreter";
2277
- interpreterAddress: string;
2278
- predicateBlobBase64: string;
2279
- }[];
2280
- name: string;
2281
- } & {
2282
- [k: string]: unknown;
2283
- };
4100
+ installNonce?: number | undefined;
4101
+ spendingLimit?: {
4102
+ amount: string;
4103
+ periodLedgers: number;
4104
+ } | undefined;
2284
4105
  network?: "mainnet" | "testnet" | undefined;
2285
4106
  existingRules?: {
2286
4107
  signers: ({
@@ -2304,126 +4125,108 @@ export declare const InstallPolicyInputSchema: z.ZodEffects<z.ZodObject<{
2304
4125
  };
2305
4126
  predicate?: unknown;
2306
4127
  }[] | undefined;
2307
- rpcUrl?: string | undefined;
2308
- allowUnpinnedRpcUrl?: boolean | undefined;
2309
- allowUnpinnedInterpreter?: boolean | undefined;
2310
- baseFee?: number | undefined;
2311
- }>, {
2312
- smartAccount: string;
2313
- sourceAccount: string;
2314
- installNonce: number;
2315
- rule: {
2316
- signers: ({
2317
- address: string;
2318
- kind: "delegated";
2319
- } | {
2320
- kind: "external";
2321
- verifier: string;
2322
- keyBytes: string;
2323
- })[];
2324
- validUntilLedger: number | null;
2325
- contextRuleType: {
4128
+ rule?: z.objectInputType<{
4129
+ contextRuleType: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4130
+ kind: z.ZodLiteral<"default">;
4131
+ }, "strip", z.ZodTypeAny, {
2326
4132
  kind: "default";
2327
- } | {
4133
+ }, {
4134
+ kind: "default";
4135
+ }>, z.ZodObject<{
4136
+ kind: z.ZodLiteral<"call_contract">;
4137
+ contract: z.ZodString;
4138
+ }, "strip", z.ZodTypeAny, {
2328
4139
  kind: "call_contract";
2329
4140
  contract: string;
2330
- } | {
4141
+ }, {
4142
+ kind: "call_contract";
4143
+ contract: string;
4144
+ }>, z.ZodObject<{
4145
+ kind: z.ZodLiteral<"create_contract">;
4146
+ wasmHash: z.ZodString;
4147
+ }, "strip", z.ZodTypeAny, {
2331
4148
  kind: "create_contract";
2332
4149
  wasmHash: string;
2333
- };
2334
- policies: {
2335
- kind: "interpreter";
2336
- interpreterAddress: string;
2337
- predicateBlobBase64: string;
2338
- }[];
2339
- name: string;
2340
- } & {
2341
- [k: string]: unknown;
2342
- };
2343
- network?: "mainnet" | "testnet" | undefined;
2344
- existingRules?: {
2345
- signers: ({
4150
+ }, {
4151
+ kind: "create_contract";
4152
+ wasmHash: string;
4153
+ }>]>;
4154
+ name: z.ZodString;
4155
+ validUntilLedger: z.ZodNullable<z.ZodNumber>;
4156
+ signers: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4157
+ kind: z.ZodLiteral<"delegated">;
4158
+ address: z.ZodString;
4159
+ }, "strip", z.ZodTypeAny, {
2346
4160
  address: string;
2347
4161
  kind: "delegated";
2348
- } | {
4162
+ }, {
4163
+ address: string;
4164
+ kind: "delegated";
4165
+ }>, z.ZodObject<{
4166
+ kind: z.ZodLiteral<"external">;
4167
+ verifier: z.ZodString;
4168
+ keyBytes: z.ZodString;
4169
+ }, "strip", z.ZodTypeAny, {
2349
4170
  kind: "external";
2350
4171
  verifier: string;
2351
4172
  keyBytes: string;
2352
- })[];
2353
- id: number;
2354
- policyAddresses: string[];
2355
- contextType: {
2356
- kind: "default";
2357
- } | {
2358
- kind: "call_contract";
2359
- contract: string;
2360
- } | {
2361
- kind: "create_contract";
2362
- wasmHash: string;
2363
- };
2364
- predicate?: unknown;
2365
- }[] | undefined;
2366
- rpcUrl?: string | undefined;
2367
- allowUnpinnedRpcUrl?: boolean | undefined;
2368
- allowUnpinnedInterpreter?: boolean | undefined;
2369
- baseFee?: number | undefined;
2370
- }, {
2371
- smartAccount: string;
2372
- sourceAccount: string;
2373
- installNonce: number;
2374
- rule: {
2375
- signers: ({
2376
- address: string;
2377
- kind: "delegated";
2378
- } | {
4173
+ }, {
2379
4174
  kind: "external";
2380
4175
  verifier: string;
2381
4176
  keyBytes: string;
2382
- })[];
2383
- validUntilLedger: number | null;
2384
- contextRuleType: {
2385
- kind: "default";
2386
- } | {
2387
- kind: "call_contract";
2388
- contract: string;
2389
- } | {
2390
- kind: "create_contract";
2391
- wasmHash: string;
2392
- };
2393
- policies: {
4177
+ }>]>, "many">;
4178
+ /** Policies on one rule compose as ALL-OF, so an interpreter predicate and
4179
+ * an OpenZeppelin built-in can sit together and both must permit. That
4180
+ * pairing is what expresses a rolling total: the predicate bounds each
4181
+ * call, the built-in bounds the sum across calls. */
4182
+ policies: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
4183
+ kind: z.ZodLiteral<"interpreter">;
4184
+ interpreterAddress: z.ZodString;
4185
+ predicateBlobBase64: z.ZodString;
4186
+ }, "strip", z.ZodTypeAny, {
2394
4187
  kind: "interpreter";
2395
4188
  interpreterAddress: string;
2396
4189
  predicateBlobBase64: string;
2397
- }[];
2398
- name: string;
2399
- } & {
2400
- [k: string]: unknown;
2401
- };
2402
- network?: "mainnet" | "testnet" | undefined;
2403
- existingRules?: {
2404
- signers: ({
2405
- address: string;
2406
- kind: "delegated";
2407
- } | {
2408
- kind: "external";
2409
- verifier: string;
2410
- keyBytes: string;
2411
- })[];
2412
- id: number;
2413
- policyAddresses: string[];
2414
- contextType: {
2415
- kind: "default";
2416
- } | {
2417
- kind: "call_contract";
2418
- contract: string;
2419
- } | {
2420
- kind: "create_contract";
2421
- wasmHash: string;
2422
- };
2423
- predicate?: unknown;
2424
- }[] | undefined;
4190
+ }, {
4191
+ kind: "interpreter";
4192
+ interpreterAddress: string;
4193
+ predicateBlobBase64: string;
4194
+ }>, z.ZodObject<{
4195
+ kind: z.ZodLiteral<"spending_limit">;
4196
+ policyAddress: z.ZodString;
4197
+ /** LEDGERS, not seconds. */
4198
+ periodLedgers: z.ZodNumber;
4199
+ spendingLimit: z.ZodString;
4200
+ }, "strip", z.ZodTypeAny, {
4201
+ kind: "spending_limit";
4202
+ spendingLimit: string;
4203
+ periodLedgers: number;
4204
+ policyAddress: string;
4205
+ }, {
4206
+ kind: "spending_limit";
4207
+ spendingLimit: string;
4208
+ periodLedgers: number;
4209
+ policyAddress: string;
4210
+ }>]>, "many">;
4211
+ }, z.ZodTypeAny, "passthrough"> | undefined;
4212
+ fromHash?: {
4213
+ transactionHash: string;
4214
+ signers?: string[] | undefined;
4215
+ userResponses?: {
4216
+ limitAmount?: string | undefined;
4217
+ validUntilLedger?: number | undefined;
4218
+ swapRecipientAllowlist?: string[] | undefined;
4219
+ } | undefined;
4220
+ } | undefined;
4221
+ fromPredicate?: {
4222
+ signers: string[];
4223
+ encodedPredicate: string;
4224
+ validUntilLedger?: number | undefined;
4225
+ name?: string | undefined;
4226
+ } | undefined;
2425
4227
  rpcUrl?: string | undefined;
2426
4228
  allowUnpinnedRpcUrl?: boolean | undefined;
4229
+ allowUnboundedAmount?: boolean | undefined;
2427
4230
  allowUnpinnedInterpreter?: boolean | undefined;
2428
4231
  baseFee?: number | undefined;
2429
4232
  }>;